Skip to content

Instantly share code, notes, and snippets.

View kamal's full-sized avatar

Kamal Fariz Mahyuddin kamal

View GitHub Profile
#!/bin/bash
if ! VBoxManage showvminfo $(VBoxManage list vms|grep dvm|awk '{print $1}'|tr -d '"')|grep -q running
then
VBoxManage startvm $(VBoxManage list vms|grep dvm|awk '{print $1}'|tr -d '"') --type headless
ssh docker@localhost -p 2222 -i ~/.vagrant.d/insecure_private_key "sudo ifconfig eth1 10.1.2.3"
fi
# run VBoxManage modifyvm $(VBoxManage list vms|grep dvm|awk '{print $1}'|tr -d '"') --natpf1 "docker,tcp,127.0.0.1,4243,,4243" once for below
export DOCKER_HOST=tcp://127.0.0.1:4243
/usr/local/bin/docker $*
var get = Ember.get, set = Ember.set, doc = document;
var FastSelectComponent = Ember.Component.extend({
items: null,
valuePath: 'value',
labelPath: 'label',
value: null,
selected: null,
tagName: 'select',
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@drnic
drnic / Guardfile
Created April 5, 2012 06:45
An example Guardfile with the works for a Rails app
guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
@mislav
mislav / application_with_config.rb
Created August 24, 2010 17:43
Read custom config from settings.yml into a Rails 3 app
# needs the "hashie" gem in Gemfile
require 'erb'
module Movies
class Application < Rails::Application
# read from "settings.yml" and optional "settings.local.yml"
settings = ERB.new(IO.read(File.expand_path('../settings.yml', __FILE__))).result
mash = Hashie::Mash.new(YAML::load(settings)[Rails.env.to_s])