Skip to content

Instantly share code, notes, and snippets.

@chrismytton
chrismytton / Pow.md
Created December 18, 2012 22:45
Using chruby with pow

chruby can be used with [pow] to select a specific Ruby per project, or system-wide.

System wide

To set a default Ruby for all pow apps, puts the following in ~/.powconfig.

~/.powconfig

@chrismytton
chrismytton / 01-README.md
Created October 29, 2012 20:46
Mutt Gmail config with OS X keychain

Mutt/Gmail/OS X Keychain

Create a new keychain item, enter the Keychain Item Name as mutt, the Account Name as your gmail email address and then enter your password, then add the keychain item.

2-step auth

If you're using Google 2-step auth, you'll need to generate an Application-specific password from your Google Account settings and enter that as the password.

times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.022 000.022: --- VIM STARTING ---
000.239 000.217: Allocated generic buffers
001.005 000.766: locale set
001.016 000.011: clipboard setup
@chrismytton
chrismytton / gist:3789119
Created September 26, 2012 16:46
rbx-environment
~% echo $RBX_ROOT
/Users/chris/.rbenv/versions/rbx-2.0.0-dev
~% echo $PATH
/Users/chris/.rbenv/versions/rbx-2.0.0-dev/gems/1.9/bin:/Users/chris/.rbenv/shims:/Users/chris/.rbenv/bin:/Users/chris/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
~% rbenv shell rbx-2.0.0-dev
~% ruby -v
rubinius 2.0.0dev (1.9.3 ca63c49c yyyy-mm-dd JI) [x86_64-apple-darwin12.1.0]
@chrismytton
chrismytton / ping-output.md
Created September 20, 2012 20:48
Goroutines

In ping.go the printer runs in a goroutine and the main thread is blocked by fmt.Scanln. As expected it prints ping, then pong.

In ping2.go the printer itself is blocking the main thread. When run it returns ping twice before returning a pong.

$ go run ping.go
ping
pong
ping
pong
vagrant@web1:~$ bundle -v
The program 'bundle' is currently not installed. You can install it by typing:
sudo apt-get install ruby-bundler
@chrismytton
chrismytton / gist:3229620
Created August 1, 2012 18:35
Default bundler gem setup
$ bundle gem neography
create neography/Gemfile
create neography/Rakefile
create neography/LICENSE
create neography/README.md
create neography/.gitignore
create neography/neography.gemspec
create neography/lib/neography.rb
create neography/lib/neography/version.rb
Initializating git repo in /Users/chris/neography
require 'execjs'
class SgNodeMapper
def method_missing(method, *args, &block)
context.call("nodemapper.#{method.to_s.camelize(:lower)}", *args)
end
private
@chrismytton
chrismytton / shoreman.rb
Created March 4, 2012 16:38
shoreman (foreman in shell) homebrew formula
require 'formula'
class Shoreman < Formula
homepage 'https://github.com/hecticjeff/shoreman'
head 'https://github.com/hecticjeff/shoreman.git'
def install
bin.install 'shoreman.sh' => 'shoreman'
end
end
@chrismytton
chrismytton / .gitignore
Created February 17, 2012 23:11
bookmarklet creater
/node_modules