Skip to content

Instantly share code, notes, and snippets.

@jbgo
jbgo / Gemfile
Last active October 19, 2015 16:32
Examples for Better TDD in PHP with Rake and Guard https://opensolitude.com/2015/10/18/phpunit-tests-rake-guard.html
source "https://rubygems.org"
gem "guard-rake"
@jbgo
jbgo / tictactoe.rb
Created March 7, 2014 19:31
Interactive tic tac toe game
class TicTacToeApp
NIL_GAME = [
[nil, nil, nil],
[nil, nil, nil],
[nil, nil, nil]
]
def initialize
@game = NIL_GAME
@jbgo
jbgo / Gemfile
Created February 15, 2014 19:16
Heroku-style config management with capistrano and chef
gem 'dotenv-rails'
group :deployment do
gem 'capistrano', '~>2.15'
gem 'chef'
end
@jbgo
jbgo / go-isms.md
Last active December 31, 2015 22:49
go-isms

Starting a collection of common programming tasks expressed in Go.

Read a file as a string

Imports: bytes, io/ioutil

data, err := ioutil.ReadFile("path/to/file")
buf := bytes.NewBuffer(data)
str := buf.String()
@jbgo
jbgo / README.md
Last active December 30, 2015 06:38
Comparing ruby and go

Comparison of a simple, idiomatic ruby program to a similar go program.

To run the ruby program: ruby mammals.rb

To run the go program: go run mammals.go

Read the detailed comparison on my blog.

@jbgo
jbgo / Gemfile
Created November 1, 2013 20:45
deprecation warnings in test after upgrading from rails 4.0.0 to 4.0.1
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
@jbgo
jbgo / README.md
Last active December 26, 2015 07:59
tmux cheat sheet

tmux config

~/.tmux.conf

send the prefix

Default prefix: ^b

Getting help

@jbgo
jbgo / Vagrantfile
Created August 18, 2013 20:51
Getting started with ansible on OS X
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.ssh.forward_agent = true
@jbgo
jbgo / gist:5901518
Last active December 19, 2015 04:59
Cross-browser iframe access (tested with IE 7+)

For those unfortunate times when you need to use duct tape to support a slick user experience on really old browsers.

frame = $('iframe').get(0)

doc = if frame.contentWindow
  frame.contentWindow.document
else
  frame.contentDocument