This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"constraints" | |
"fmt" | |
) | |
func main() { | |
fmt.Println(Sum(1, 2, 3, 4)) | |
fmt.Println(Sum("1", "2", "3")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
gen := GetIncrementor() | |
for i := gen(); i <= 10; i = gen() { | |
fmt.Println(i) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
"github.com/codegangsta/negroni" | |
) | |
func Mids() negroni.HandlerFunc { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"image/jpeg" | |
"io/ioutil" | |
"log" | |
"os" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def even(gen): | |
for i in gen: | |
if i % 2 == 0: | |
yield i | |
def stringify(gen): | |
for i in gen: | |
yield str(i) | |
def transduce(gen): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"os" | |
"runtime" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Monad interface { | |
Bind(func(interface{}, Monad) Monad) Monad | |
Return(interface{}) Monad | |
} | |
// First, let's do Maybe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jakecoffman.ldap | |
import org.apache.directory.api.ldap.model.entry.DefaultEntry | |
import org.apache.directory.api.ldap.model.message.SearchScope | |
import org.apache.directory.ldap.client.api.LdapConnectionConfig | |
import org.apache.directory.ldap.client.api.LdapNetworkConnection | |
import org.apache.directory.ldap.client.api.NoVerificationTrustManager | |
// I hope this helps someone | |
def sslConfig = new LdapConnectionConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def randomElement | |
// simulate user input, for instance | |
if (new Random().nextInt() % 2 == 0) { | |
randomElement = new Element1() | |
} else { | |
randomElement = new Element2() | |
} | |
new PrinterVisitor().visit(randomElement) |
OlderNewer