Skip to content

Instantly share code, notes, and snippets.

# Description:
# Get the top news item from HN
#
# Commands:
# hubot hn - Return the top item on HN
module.exports = (robot) ->
robot.respond /hn( me)?$/i, (msg) ->
story = hnTopStory(msg)
console.log story
package main
import (
"log"
"sync"
"time"
)
// Global wait group
var jobs sync.WaitGroup
@aodin
aodin / gist:9493340
Created March 11, 2014 19:34
Insert to PostGres
package main
import (
"database/sql"
"log"
_ "github.com/lib/pq"
)
func connect(driver string, credentials string) *sql.DB {
@aodin
aodin / gist:9493190
Last active March 23, 2024 20:24
Parsing JSON in a request body with Go
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
type Message struct {
package repo
import (
"testing"
)
func BenchmarkIsRemote(b *testing.B) {
repos := []Repo{
{Path: "git://github.com/foo/far"},
{Path: "git://github.com/foo/far.git"},
package repo
import (
"fmt"
"regexp"
"strings"
)
type Repo struct {
// The path of the Repoisotry. This could be