Skip to content

Instantly share code, notes, and snippets.

require 'RMagick'
require 'capybara'
require 'launchy'
module Capybara::Recording
def start_recording
system "rm -f tmp/*"
end
def save_recording
@pietia
pietia / gist:5144689
Created March 12, 2013 16:56
deleted system ruby? no problem ...
pietia@a /System/Library/Frameworks/Ruby.framework $ tree .
.
├── Headers -> /Users/pietia/.rbenv/sources/1.8.7-p371/ruby-1.8.7-p371
└── Versions
└── 1.8
└── usr -> /Users/pietia/.rbenv/versions/1.8.7-p371
@pietia
pietia / gist:5141937
Last active December 14, 2015 20:09
OSX keeps track of your downloads. Add this to ie. ~/.zshrc
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
karol@brenta:~/projects/personal/rubinius (master) $ ruby-head --version
ruby 2.0.0dev (2013-02-18) [x86_64-darwin12.2.1]
karol@brenta:~/projects/personal/rubinius (master) $ ./bin/benchmark -t ./bin/rbx -t ^ruby-head benchmark/core/float/
Found rvm-managed ruby: ruby-head
=== ./bin/rbx ===
Float + Float => Float
39644327.2 (±1.9%) i/s - 197996600 in 4.996082s (cycle=147100)
Float + Fixnum => Float
39234682.7 (±1.3%) i/s - 196176456 in 5.000912s (cycle=199976)
Float + Bignum => Float
@heikki
heikki / gist:4030954
Last active November 19, 2015 12:29
Notes for VirtualBox IE setup
https://www.virtualbox.org/wiki/Downloads
https://github.com/xdissent/ievms
For each installed VM:
- Enable copy&paste (Settings -> General -> Advanced -> Shared Clipboard -> Host To Guest)
- Add more video memory (Settings -> Display -> Video -> Video Memory -> 128 MB ?)
- Add Finnish keyboard layout as default and remove others
- Set IE homepage to about:blank
- Disable Windows key http://support.microsoft.com/kb/216893#FixItForMeAlways
- Take snapshot
@polarblau
polarblau / gist:3865638
Created October 10, 2012 13:25
Copy&paste highlighted code into e.g. Keynote
# I came across this snippet http://gistflow.com/posts/422-highlight-code-for-keynote-presentation
# but it didn’t work until @pietia was so nice to point out that there’s no need for the output file.
# 1. Install highlight
brew install highlight
# 2. Add this to e.g. .bash_profile and reload it
function hl() {
 format=${1-rb};
 pbpaste | highlight --syntax=$format -O rtf | pbcopy;
@jonsullivan
jonsullivan / cors-middleware-express-with-proxy.js
Created July 17, 2012 01:22
node.js CORS http-proxy / express middleware
// node.js proxy server example for adding CORS headers to any existing http services.
// yes, i know this is super basic, that's why it's here. use this to help understand how http-proxy works with express if you need future routing capabilities
var httpProxy = require('http-proxy'),
express = require('express');
var proxy = new httpProxy.RoutingProxy();
var proxyOptions = {
host: '192.168.3.11',
@mdespuits
mdespuits / chef-solo-ubuntu-12-04
Created June 29, 2012 05:52
Chef Solo Setup for Ubuntu 12.04
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
@ryanb
ryanb / chef_solo_bootstrap.sh
Created April 5, 2012 04:35
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
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
make
make install
@finack
finack / application.rb
Created March 17, 2012 06:18
Example Chef Deploy Revision for Rails 3+
app = node[:rails][:app]
rails_base app[:name] do
ruby_ver app[:ruby_ver]
gemset app[:gemset]
end
%w{config log pids cached-copy bundle system}.each do |dir|
directory "#{app[:app_root]}/shared/#{dir}" do
owner app[:deploy_user]