Skip to content

Commit

Permalink
Merge pull request #39 from ahmetalpbalkan/docs-migration
Browse files Browse the repository at this point in the history
Move github site to docs/
  • Loading branch information
ahmetb authored Sep 11, 2016
2 parents b1c935a + bfd640d commit 1a980ea
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 0 deletions.
158 changes: 158 additions & 0 deletions docs/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@

body {
margin: 0;
padding: 0;
background-color: #fbfcfc;

font-family: 'proxima-nova', sans-serif;
font-weight: 300;
}

h1, h2, h3, h4 {
font-weight: 200;
}

h1, h2, h3, h4 {
font-family: 'museo', serif;
}

p {
line-height: 160%;
font-weight: 200;
font-size: 130%;
}

header {
text-align: center;
padding: 2em 10em 5em 10em;

background-color: #355c7d;
color: #fbfcfc;
}

header > h1 {
font-size: 420%;
margin-bottom: 1em;
}

header > h2 {
margin-bottom: 1em;
}

header a {
color: #1abc9c;
}
header a:hover {
color: #16a085;
}

.promo {
clear:both;
text-align: center;
margin-top: 3em;
}
.promo p {
margin-top: 1em;
font-size: 120%;
}

body > section {
text-align: center;
padding: 1em 0 2em 0;
color: white;
}

section.features {
background-color: #8e6e85;
}

section.features .inner {
width: 70%;
margin: 0 auto;
}

section.features h3 {
font-size: 180%;
margin-top: 2em;
margin-bottom: 1.5em;
}

section.features aside {
text-align: center;
padding: 0 2%;
padding-bottom: 1em;
}

section.demo {
background-color: rgb(192,108,132);
padding-bottom: 4em;
}

section.demo .inner {
width: 70%;
margin: 0 auto;
}

section.demo h2 {
margin-top: 2em;
}

table {
margin-top: 2em;
border: 0;
width: 100%;
}

table td {
vertical-align: top;
text-align: left;
padding-bottom: .5em;
}

td.docs {
width: 40%;
text-align: justify;
padding-right: 2%;
}

td.code {
width: 60%;
}



section.about {
background-color: #16a085;
padding: 4em 0 8em 0;
color: #ecf0f1;
}
section.about .inner {
width: 60%;
}

section.about h2 {
color: white;
margin-bottom: 2em;
}

section.about a:not(.btn) {
color: #2c3e50;
}
section.about a:not(.btn):hover {
color: #bdc3c7;
}

section.about .inner {
width: 60%;
margin: 0 auto;
}

footer {
background-color: #16a085;
color: #1abc9c;
font-size: 80%;
text-align: center;
width: 100%;
clear: both;
padding-bottom: 1em;
}
Binary file added docs/img/ahmet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/kalan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
219 changes: 219 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>go-linq: LINQ query functions over slices for Golang</title>
<meta name="viewport" content="width=device-width">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/main.css">
<link href='//fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'>
<meta name="author" content="Ahmet Alp Balkan">

<script type="text/javascript" src="//use.typekit.net/wnk8juw.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>

<body>
<header>
<h1>go-linq</h1>

<h2>.NET's Language Integrated Query (LINQ) library for Go</h2>

<p>
Query and manipulate Go slices and collections using SQL-like methods.
<br/>Written in pure Go with no dependencies, tested with 100% code coverage.
</p>

<div class='promo'>
<p>
<iframe src="http://ghbtns.com/github-btn.html?user=ahmetalpbalkan&repo=go-linq&type=watch&count=true&size=large" allowtransparency="true"
frameborder="0" scrolling="0" width="142px" height="30px" style='margin-left:30px'></iframe>
</p>

<p>
<a class='btn btn-default btn-lg' href='https://github.com/ahmetalpbalkan/go-linq'>Fork it!</a>
<a class='btn btn-default btn-lg' href='http://godoc.org/github.com/ahmetalpbalkan/go-linq'>GoDoc</a>
</p>

</header>

<section class='features'>
<div class='inner row'>
<aside class='col-md-4'>
<h3>Bring your type</h3>
<p>
There are no generics in Go, but
<nobr>go-linq</nobr> supports arrays, slices, maps, strings and channels out-of-the-box, or any collection
that implements <code>.Comparable</code>.
</p>
</aside>

<aside class='col-md-4'>
<h3>Method syntax</h3>
<p style='text-align: center;'>
<code>From(slice)</code> <code>.Where(predicate)</code> <code>.Select(selector)</code> <code>.ToSlice(&result)</code>
<br/> Easy as that. Just keep writing your queries.
</p>
</aside>

<aside class='col-md-4'>
<h3>Concurrency</h3>
<p>
Your queries can share data between goroutines by calling <code>.FromChannel()</code> and <code>.ToChannel()</code> methods.
</p>
</aside>
</div>
</section>

<section class='demo hidden-xs'>
<h2>Basic</h2>
<p>Find average age of students over 20.</p>
<div class='inner row'>
<table>
<tr>
<td class='docs'>
Import your <code>[]Student</code>.
</td>

<td class='code'><code>
results := From(students).
</code></td>
</tr>

<tr>
<td class='docs'>
Find those over 20.<br/> So we make type assertion to our input type.
</td>

<td class='code'><code>
Where(func (s interface{}) bool {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;return s.(Student).age >= 20<br/>
}).
</code></td>
</tr>

<tr>
<td class='docs'>
Select their ages.
</td>

<td class='code'><code>
Select(func (s interface{}) interface{} {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;return s.(Student).age<br/>
}).
</code></td>
</tr>
<tr>
<td class='docs'>
Find the average.
</td>

<td class='code'><code>
Average()
</code></td>
</tr>
</table>
</div>

<h2>Concurrent</h2>
<div class='inner row'>
<p>Count websites that have a favicon.ico.</p>
<table>
<tr>
<td class='docs'>
&nbsp;
</td>

<td class='code'><code>
urls := make(chan interface{})<br/>
results := make(chan interface{})
</code></td>
</tr>

<tr>
<td class='docs'>
Convert domain names to full URLs.
</td>

<td class='code'><code>
go func(domains []string) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;From(domains).Select(func(d interface{}) interface{} {</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return fmt.Sprintf("http://%s/favicon.ico", d)</br>
&nbsp;&nbsp;&nbsp;&nbsp;}).ToChannel(urls)</br>
}(domains)
</code></td>
</tr>

<tr>
<td class='docs'>
Let's run the following in parallel.<br/>Request favicon for each domain.
</td>

<td class='code'><code>
go func() {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;defer close(results)</br>
&nbsp;&nbsp;&nbsp;&nbsp;var wg sync.WaitGroup</br>
&nbsp;&nbsp;&nbsp;&nbsp;for url := range urls {</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wg.Add(1)</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;go func(url string) {</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;defer wg.Done()</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resp, _ := http.Get(url)</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results <- resp.StatusCode</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}(url.(string))</br>
&nbsp;&nbsp;&nbsp;&nbsp;}</br>
&nbsp;&nbsp;&nbsp;&nbsp;wg.Wait()</br>
}()
</code></td>
</tr>

<tr>
<td class='docs'>
Count websites.
</td>

<td class='code'><code>
FromChannel(results).CountWith(func(r interface{}) bool {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;return r.(int) == 200<br/>
})
</code></td>
</tr>
</table>
</section>

<section class='about'>

<h2>About</h2>
<div class='inner'>
<p>
If you have suggestions or improvements, feel free to contact or submit a pull request. All contributions are welcomed.
</p>

<p>
This library is brought you by <a href='http://kalan.rocks/'>Alexander (kalan) Kalankhodzhaev</a>
and <a href='https://twitter.com/ahmetalpbalkan'>@ahmetalpbalkan</a>.
</p>
<p>
<a href='http://kalan.rocks/'><img src='img/kalan.png' width='150' height='150' alt="Alexander (kalan) Kalankhodzhaev, 2016" /></a>
<a href='http://ahmetalpbalkan.com'><img src='img/ahmet.png' width='150' height='150' alt="Ahmet Alp Balkan, 2013" /></a>
</p>

</div>
</section>

<footer>
Lovingly made in Moscow and Seattle.
</footer>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-45321252-3', 'ahmetalpbalkan.github.io');
ga('send', 'pageview');
</script>
</body>

</html>

0 comments on commit 1a980ea

Please sign in to comment.