Skip to content

Instantly share code, notes, and snippets.

View johndunne's full-sized avatar

John Dunne johndunne

View GitHub Profile
@jordiboehme
jordiboehme / gist:3526472
Created August 30, 2012 11:13
Handling Camera and Album UIImages on iOS
//
// ImageHelper.h
// Tabris
//
// Created by Jordi Böhme López on 22.08.12.
// Copyright (c) 2012 EclipseSource. All rights reserved.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
@ikbear
ikbear / sortmap.go
Created November 8, 2012 12:59
Sort Map(golang)
package main
// sort a map's keys in descending order of its values.
import "sort"
type sortedMap struct {
m map[string]int
s []string
}
@kylelemons
kylelemons / datemath.go
Created September 2, 2013 17:44
Fun with Date arithmetic!
package main
import (
"fmt"
"log"
"math/rand"
"time"
)
type Snapshot struct {
@tejainece
tejainece / StreamToString.go
Created April 2, 2014 18:29
Golang: io.Reader stream to string or byte slice
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
@kachayev
kachayev / concurrency-in-go.md
Last active May 31, 2024 09:34
Channels Are Not Enough or Why Pipelining Is Not That Easy
@NatashaTheRobot
NatashaTheRobot / WatchConnectivitySingletonDemo.swift
Last active May 21, 2024 18:21
WatchConnectivity Singleton Demo
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)
@tboerger
tboerger / gist:4840e1b5464fc26fbb165b168be23345
Created February 17, 2017 09:37
Golang LDAP search and authentication
package main
import (
"fmt"
"strings"
"gopkg.in/ldap.v2"
)
const (
ldapServer = "ad.example.com:389"
@thurt
thurt / revprox.go
Last active July 17, 2024 20:38 — forked from JalfResi/revprox.go
Simple reverse proxy in Go (forked from original to use a struct instead of a closure)
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@HodGreeley
HodGreeley / README-Couchbase-Docker.adoc
Last active July 7, 2022 14:42
Docker Scripts to Simplify Setup with Couchbase

Docker Scripts to Simplify Setup with Couchbase