Skip to content

Instantly share code, notes, and snippets.

/*
A Goroutine safe pattern using channels that abstracts away the channels
This is a concept of creating a goroutine safe object that uses channels under the covers to communicate
with the internal map[string]string structure. I know that typically this kind of solution may done
with mutexes but the excercise was in using channels on purpose although they are heavier.
Note a couple of points:
- When using channels, you can still build a public-facing api that nicely abstracts them away, therefore
@zennro
zennro / proxy.go
Last active August 29, 2015 14:12 — forked from vmihailenco/proxy.go
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@zennro
zennro / client.go
Last active August 29, 2015 14:12 — forked from spikebike/client.go
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@zennro
zennro / mac-apps.md
Last active August 29, 2015 14:10 — forked from erikreagan/mac-apps.md

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@zennro
zennro / rot13.rb
Last active August 29, 2015 14:10 — forked from rwoeber/rot13.rb
# or simply:
'foobar'.tr 'A-Za-z','N-ZA-Mn-za-m'
# rot(x)
class String
def rot(num = 13)
return self.split("").collect { |ch|
if /^[a-z]$/ === ch
((ch[0] + num - 'a'[0]) % 26 + 'a'[0]).chr
@zennro
zennro / chat.go
Last active August 29, 2015 14:07
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
@zennro
zennro / proxy.go
Last active August 29, 2015 14:07 — forked from vmihailenco/proxy.go
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
package main
import (
"fmt"
"runtime"
"time"
)
func waitAround(die chan bool) {
<- die
@zennro
zennro / http_get.go
Last active August 29, 2015 14:07 — forked from ijt/http_get.go
package main
import (
"fmt"
"http"
"io/ioutil"
"os"
)
func main() {