Skip to content

Instantly share code, notes, and snippets.

View mostlyobvious's full-sized avatar

Paweł Pacana mostlyobvious

View GitHub Profile
>> require 'ffi-locale'
=> true
>> FFI
=> FFI
>> FFILocale::setlocale FFILocale::LC_COLLATE, 'pl_PL.UTF8'
=> nil
>> FFILocale::strcoll "łyk", "myk"
=> 88
>> "łyk" <=> "myk"
=> 1
grep -RP "[^\x00-\x7f]" app/ | cut -d":" -f 1 | sort | uniq | grep "\.rb$" | xargs sed -i -e "1i# encoding: UTF-8"
require 'bundler/setup'
Bundler.require
use Rack::CommonLogger, $stderr
use Rack::ShowExceptions
run Nanoc::Extra::AutoCompiler.new('.')
@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
#!/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
Format: 1.0
Source: mongrel2
Binary: mongrel2
Architecture: any
Version: 1.7.5-1
Maintainer: Paweł Pacana <pawel.pacana@gmail.com>
Homepage: http://mongrel2.org
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 8.0.0), sqlite3, libsqlite3-dev, libzmq-dev
Depends: libzmq1, sqlite3
# Make sure Udev doesn't block our network
# http://6.ptmc.org/?p=164
echo "cleaning up udev rules"
rm /etc/udev/rules.d/70-persistent-net.rules
mkdir /etc/udev/rules.d/70-persistent-net.rules
rm -rf /dev/.udev/
rm /lib/udev/rules.d/75-persistent-net-generator.rules
${1:-hostname}
sudo virsh -c lxc:/// start template
ssh -i template.key squeeze@template.local $1
sudo virsh -c lxc:/// destroy template
#!/bin/sh
# Mostly deboostrap, but also changes hostname and configures networking
# for guest. Intended to use with lxc and bridged networks with dnsmasq.
PACKAGES=avahi-daemon,openssh-server
USER_NAME=squeeze
DISTRIBUTION=precise
VM_PATH=${1-template}
VM_NAME=$(basename $VM_PATH)
require 'test/unit'
class AssertMatchTest < Test::Unit::TestCase
def test_assertion_count
assert_match /abc/, 'abc'
end
end
# 1.9.3
#