Skip to content

Instantly share code, notes, and snippets.

View mostlyobvious's full-sized avatar

Paweł Pacana mostlyobvious

View GitHub Profile
#!/bin/sh
curl -L http://mongrel2.org/static/downloads/mongrel2-1.7.5.tar.bz2 -o - |tar -jxvf -
cd mongrel2-1.7.5
make PREFIX=/opt/mongrel2-1.7.5
sudo make install PREFIX=/opt/mongrel2-1.7.5
cd ..
mkdir mongrel2-1.8.0
curl -L https://github.com/zedshaw/mongrel2/tarball/v1.8.0 -o - |tar --strip-components=1 -C mongrel2-1.8.0 -zxvf -
cd mongrel2-1.8.0
@mostlyobvious
mostlyobvious / osx_rails_env_setup_in_all_steps.md
Created October 1, 2012 23:29 — forked from solnic/osx_rails_env_setup_in_6_steps.md
Steps to get up'n'running with Rails on OS X and Ubuntu

Steps to set up a Rails development environment on OS X:

  • install Apple Command Line Tools
  • install homebrew[1]: ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
  • install rvm: curl -L https://get.rvm.io | bash -s stable
  • source $HOME/.rvm/scripts/rvm
  • rvm install --disable-binary 1.9.3
  • rvm use --default 1.9.3
require 'bundler/setup'
Bundler.require
use Rack::CommonLogger, $stderr
use Rack::ShowExceptions
run Nanoc::Extra::AutoCompiler.new('.')
grep -RP "[^\x00-\x7f]" app/ | cut -d":" -f 1 | sort | uniq | grep "\.rb$" | xargs sed -i -e "1i# encoding: UTF-8"
>> require 'ffi-locale'
=> true
>> FFI
=> FFI
>> FFILocale::setlocale FFILocale::LC_COLLATE, 'pl_PL.UTF8'
=> nil
>> FFILocale::strcoll "łyk", "myk"
=> 88
>> "łyk" <=> "myk"
=> 1
class InitializerStruct
def self.new(*args)
Class.new do
define_method(:initialize) do |*initializer_args|
arity_error = ArgumentError.new("wrong number of arguments (#{initializer_args.size} for #{args.size})")
raise arity_error unless initializer_args.size == args.size
args.each do |arg|
instance_variable_set("@#{arg}", initializer_args.shift)
end
require 'bogus/rspec'
class Model
def initialize(argument)
end
def self.from_argument(argument)
self.new(argument)
end
end
require 'bogus/rspec'
class Foo
def bar(baz, default = nil)
end
end
describe 'default arguments' do
fake(:foo)
require 'bogus/rspec'
class Foo
def bar(baz, ene = nil, due = nil)
end
end
describe 'default arguments' do
fake(:foo)
require 'bogus/rspec'
class Foo
def bar(baz, ene = nil, due = nil)
end
end
describe 'default arguments' do
fake(:foo)