Skip to content

Instantly share code, notes, and snippets.

@mikeclymer
mikeclymer / api.go
Last active Aug 29, 2015
Testing out using middleware chaining for resource representations and different route contexts. negroni + httprouter
View api.go
package main
import (
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"com/acme/api/resources"
)
func main() {
n := negroni.Classic()
@mikeclymer
mikeclymer / create_riak_cluster.sh
Last active Dec 26, 2015
Modification of https://gist.github.com/iotaweb/6137662 to create a local Riak 1.4.2 cluster on Mac OS X.
View create_riak_cluster.sh
#!/bin/sh
CWD=$(cd $(dirname $0); pwd)
echo "This script will create a local riak cluster for development purposes only."
echo "Prerequisites: install riak using homebrew (tested with v1.4.2)."
echo "The cluster will be created in the current directory."
echo "Riak admin is enabled with no security.\n"
read -p "Enter a name for your cluster [cluster]: " name
View gist:444518
class Feed
include Mongoid::Document
...
class << self
def type1
self.collection_name = "feeds.type1"
all
end
View gist:442385
respond_to :html, :json
def index
respond_with(@feeds = Feed.all) do |format|
format.json { render :json => {
:feeds => @feeds
},
:callback => params[:callback]
}
end
You can’t perform that action at this time.