Skip to content

Instantly share code, notes, and snippets.

// hotfix sass sourcemaps
var appSassFiles = pickFiles('app', {
srcDir: '/styles',
destDir: '/assets/styles'
});
var bootstrapSassFiles = pickFiles('bower_components/bootstrap-sass-official/assets/stylesheets', {
srcDir: 'bootstrap',
destDir: '/assets/styles/bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap'
@dkubb
dkubb / gist:1130086
Created August 7, 2011 05:21 — forked from flazz/gist:838163
case with predicates
require 'rubygems'
require 'backports' # aliases Proc#=== to Proc#call
rs = (0..10000).to_a.sample(30)
rs.each do |r|
case r
when lambda { |n| n.zero? } then puts "#{r} is zero"
when lambda { |n| (n % 5).zero? } then puts "#{r} is fiven"
when lambda { |n| (n % 4).zero? } then puts "#{r} is fourven"
@mattetti
mattetti / yield_vs_call
Created September 5, 2011 18:58
confirm that using &block does an extra allocation making it almost 7X slower than using yield.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
$ time ruby -e "def foo(&block); block.call; end; 2_000_000.times{ foo{1+1} };"
real 0m1.556s
user 0m1.482s
sys 0m0.075s
$ time ruby -e "def foo; yield; end; 2_000_000.times{ foo{1+1} };"
@joewest
joewest / didRequestRange.js
Created January 13, 2012 20:14
Ember.PaginationSupport
App.collectionController = Em.ArrayProxy.create(Ember.PaginationSupport, {
content: [],
fullContent: App.store.findAll(App.Job),
totalBinding: 'fullContent.length',
didRequestRange: function(rangeStart, rangeStop) {
var content = this.get('fullContent').slice(rangeStart, rangeStop);
this.replace(0, this.get('length'), content);
}
});
@coffeeaddict
coffeeaddict / unspec.sh
Created February 22, 2012 11:41
Run uncommited specs
#!/bin/sh
bundle exec rspec -f d `git status | grep _spec | awk '{ print $NF }'`
@pbrisbin
pbrisbin / remote-test.rb
Created December 12, 2012 17:02
Remote test runner
#!/usr/bin/env ruby
#
# Vagrant users are constantly switching between a local editor and a
# terminal into their VM to work on code then run the tests.
#
# This script (when used as a server) listens on a TCP port inside the
# VM for test commands to execute. The script (when used as a client)
# also handles sending the appropriate "run this test" command to that
# same port on the VM.
#
@headius
headius / gist:4156388
Created November 27, 2012 19:20
Drip experiments in JRuby
# BASELINE STARTUP TIMES WITHOUT DRIP
system ~/projects/jruby $ jruby -v
jruby 1.7.1.dev (1.9.3p327) 2012-11-26 810defe on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [darwin-x86_64]
system ~/projects/jruby $ time jruby -e 1
real 0m1.238s
user 0m1.985s
sys 0m0.091s
@rwjblue
rwjblue / 01_README.md
Last active December 1, 2015 15:57
Canary Base
class TestConnection
def repeat_test
while true do
if packet_loss > 0
`say 'link down'`
end
end
end
def packet_loss
@Burgestrand
Burgestrand / Gemfile
Created August 10, 2012 09:38
Threaded scraping with Capybara, Webkit and Celluloid
source :rubygems
gem 'pry'
gem 'capybara'
gem 'capybara-webkit'
gem 'celluloid'