Skip to content

Instantly share code, notes, and snippets.

@squarism
squarism / required_libs.txt
Last active August 29, 2015 13:56
Libraries Needed for any Language
I'm making this list specifically for any language but I have golang in mind.
Persistence Clients
- mysql
- postgres
- redis
- memcache
- mongodb
- elasticsearch
- solr
// imma go newb.
package main
import "fmt"
type User struct {
email string
enabled bool
}
@squarism
squarism / massive_brew.sh
Last active August 29, 2015 13:56
Massive Brew Install
# homebrew got all wonky
# here's my dev env
$ brew install autojump bazaar boost curl ctags elixir elasticsearch \
erlang git haskell-platform jq lame libpng libxml2 libxslt lua mariadb \
memcached mongodb netcat nginx nmap node phantomjs postgresql pstree python3 \
rabbitmq readline redis rethinkdb riak scala siege sqlite tmux tree v8 watch wget yajl
# rvm will install things too if you do `rvm requirements`
@squarism
squarism / pmap.rb
Last active August 29, 2015 14:00
ruby pmap
# Ruby pmap, like Scala's pmap method.
# ------------------------------------
# modified from t-a-w.blogspot.com
require 'thread'
module Enumerable
def pmap(n)
todo = Queue.new
@squarism
squarism / baseball_stories.txt
Last active August 29, 2015 14:03
Baseball Stories
Strike Out
----------
1. Pitcher pitches ball
2. A strike happens
3. Umpire sees strike
4. Umpire updates internal count
5. Umpire shouts strike to field
6. Pitcher pitches ball, after hearing call in field
... repeat
7. Third strike is called
package main
import "fmt"
type Doer interface {
Do(i int)
}
type Base struct{}
func (b Base) Do(i int) {
@squarism
squarism / go_tour.go
Last active August 29, 2015 14:03
Go Tour Excercies
// Exercise 25 - Loops and Functions
// --------------------------------------------------------------------
package main
import (
"fmt"
"math"
)
define_behavior :sliding do
requires :director
setup do
actor.has_attribute :x_tween
actor.has_attribute :y_tween
actor.has_attributes tween_time: opts[:time]
director.when :update do |time|
if actor.x_tween
@squarism
squarism / words_we_need.txt
Last active August 29, 2015 14:13
Words That Need to Exist
I don't want or expect any of these to stick.
I just want a list of made-up words that I can define and use once or twice.
----------------------------------------------------------------------------
When someone mishears or misunderstands you and now much later you have to do something extra to fix the situation.
When you have something funny to say way too late while in bed.
Something you learned on your own but you don't think you are professional at it.
@squarism
squarism / swagger.md
Created January 23, 2015 23:00
Swagger Grape Weirdness

Imma turn this into a blog post soon but in the meantime wanted to give the Google index a hit on

  cannot load such file -- grape-swagger

The grape-swagger gem is forked right now (2015-01-23). If you simply follow the docs, you're going to get a require error.

In Gemfile, change gem "grape-swagger-rails" to this: gem "grape-swagger-rails", github: "BrandyMint/grape-swagger-rails"