Skip to content

Instantly share code, notes, and snippets.

@yarinb
yarinb / git-setup.sh
Created August 16, 2011 16:28
Git setup niceties
# via https://gist.github.com/419201#file_gitconfig.bash
# Install (from Matt's gist) these useful Git aliases & configurations with the following command:
# $ bash <(curl -s https://raw.github.com/gist/419201/gitconfig.bash)
git config --global color.ui auto # colorize output (Git 1.5.5 or later)
git config --global color.interactive auto # and from 1.5.4 onwards, this will works:
echo "Set your name & email to be added to your commits."
echo -n "Please enter your name: "
@yarinb
yarinb / jirb
Created September 27, 2011 18:09
Jirb doesn't work properly without JRUBY_OPTS
➜ ~ rvm use jruby
Using /Users/yarinb/.rvm/gems/jruby-1.6.4
➜ ~ which jirb (jruby-1.6.4)
/Users/yarinb/.rvm/rubies/jruby-1.6.4/bin/jirb
➜ ~ jirb (jruby-1.6.4)
Object.new
Object.new
#<Object:0x62565cf8>
1+1
1+1
@yarinb
yarinb / env
Created September 27, 2011 18:19
current env
# This loads some niceties for irb, courtesy of rvm.
# It also loads your custom ~/.irbrc if it exists.
# If you want to customize the irbrc for ONLY this version of
# ruby then edit this file. It will only be deleted if you do
# an "rvm install" over this ruby version.
if ENV["rvm_path"].nil?
require File.join(ENV["HOME"], "irbrc")
else
@yarinb
yarinb / rbenv-install-system-wide.sh
Created October 11, 2011 12:51
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Extras for RubyGems and Rails:
apt-get -y install zlib1g-dev
apt-get -y install libssl-dev libsqlite3-dev
apt-get -y install libreadline5-dev
@yarinb
yarinb / ubuntu-11.10-gems.erb
Created October 18, 2011 23:33 — forked from kashif/ubuntu-11.10-gems.erb
Chef bootstrap With rvm and ruby 1.9.2 on ubuntu 11.10
bash -c '
<% if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %>
EOP
) > ~/.curlrc
<% end -%>
if [ ! -f /usr/bin/chef-client ]; then
@yarinb
yarinb / gist:1389255
Created November 23, 2011 17:15
compass config in config/compass.rb
# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here.
project_type = :rails
sass_options = {:debug_info => true}
# Set this to the root of your project when deployed:
http_path = "/"
# You can select your preferred output style here (can be overridden via the command line):
@yarinb
yarinb / jobs.json
Created January 8, 2012 09:35
XML vs. JSON?
{
"jobs":[
{
"jobname":"ServerPingJob.groovy",
"period":5,
"timeUnit":"SECONDS",
"jobMode":"ASYNCHRONOUS",
"disabled":true,
"params":[
{
@yarinb
yarinb / gist:2071032
Created March 18, 2012 12:13
LUA IS AWESOME
require "reactor"
require "net"
local buffer = {}
local server = net:server(function(c)
print("connected", c)
c:on("end", function()
print("disconnected")
end)
@yarinb
yarinb / hack.sh
Created March 31, 2012 10:27 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@yarinb
yarinb / gist:2510013
Created April 27, 2012 15:07
has_many :through
class User < ActiveRecord::Base
attr_accessible :name
has_many :bookings
has_many :events, :through => :bookings
end
class Event < ActiveRecord::Base
attr_accessible :title