Skip to content

Instantly share code, notes, and snippets.

View akiatoji's full-sized avatar
🕋
Currently traveling in time.

Aki Atoji akiatoji

🕋
Currently traveling in time.
  • TARDIS
View GitHub Profile
@akiatoji
akiatoji / hack.sh
Created March 31, 2012 13:53 — 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
#
#Steps to install RVM + Ruby 1.9.2 + Rails + nginx + Passenger on CentOS (tested on v5.5)
# Install git and curl, if not already installed
sudo yum install git
sudo yum install curl
# Create the rvm group and add any users who will be using rvm to the group
sudo su -
groupadd rvm
@akiatoji
akiatoji / Gemfile
Created April 7, 2012 03:34 — forked from simi/Gemfile
Refinery + Twitter Bootstrap WIP
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@akiatoji
akiatoji / ruby19.sh
Created April 9, 2012 22:44
AWS AMI Bootstrap for Ruby1.9.3 + Chef (WIP)
#!/bin/sh
sudo yum erase ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs
sudo yum install openssl-devel zlib-devel \
gcc gcc-c++ make autoconf readline-devel \
curl-devel expat-devel gettext-devel
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
@akiatoji
akiatoji / precompile_assets.textile
Created April 11, 2012 06:42 — forked from kathgironpe/precompile_assets.textile
Rails 3.1: Precompile Assets for Cloudfront/CDN support

Naming files and using asset_path

application.scss.erb
- use <%= asset_path 'background.jpg' %>

on config/environments/production.rb

@akiatoji
akiatoji / vagrant.org
Created June 6, 2012 17:45
CentOS 6.2 Box for Vagrant

Installing CentOS

Download net install iso: CentOS-6.2-x86_64-netinstall.iso

Create a new VirtualBox machine

  • Name: vagrant-centos
  • Operating System: Linux
  • Version: Red Hat
@akiatoji
akiatoji / gist:2949808
Created June 18, 2012 18:20
Set up YARD to view locally installed gem rdocs
gem install yard
gem install redcarpet #needed to show markdown files
gem install github-markup
yard gems --rebuild
yard server -r -g -d
@akiatoji
akiatoji / gist:2990910
Created June 25, 2012 20:04
awesome_print uninitialized constant BSON error fix

Started getting error below with edge mongoid.

aki@rydeen~/Dropbox/RubyProjects/zitta-orders > rails c
Loading development environment (Rails 3.2.6)
ruby-1.9.2-p290 :001 > ap 'wheee'
NameError: uninitialized constant BSON
	from /Users/aki/.rvm/gems/ruby-1.9.2-p290/gems/awesome_print-1.0.2/lib/awesome_print/ext/mongoid.rb:23:in `cast_with_mongoid'
	from /Users/aki/.rvm/gems/ruby-1.9.2-p290/gems/awesome_print-1.0.2/lib/awesome_print/formatter.rb:24:in `format'
@akiatoji
akiatoji / gist:2992948
Created June 26, 2012 02:49
rspec let syntax trickery

Seems variables defined by let(){} is lazily instantiated.

This caused problems like so in specs:

let(:estimate){Fabricate.build(:shipping_estimate)}
...
ShippingEstimate.should_receive(:new).and_return(estimate) 
...
# ends up calling methods on uninstantiated (nil) estimate
@akiatoji
akiatoji / gist:3011794
Created June 28, 2012 14:55
OS X Lion: "yaml.h not found" error when trying to install Python modules (homebrew)

On OS X 10.7.4, you need to install libyaml by hand. Using homewbrew:

brew install libyaml

Then you can happily install python modules

sudo easy_install nltk SOAPpy pyOpenSSL lxml