Skip to content

Instantly share code, notes, and snippets.

@jodosha
jodosha / class_loading_benchmark.rb
Last active August 29, 2015 14:04
Lotus::Utils vs ActiveSupport benchmarks
#!/usr/bin/env ruby
require 'benchmark'
require 'rubygems'
require 'active_support/core_ext/string/inflections' # v4.1.4
require 'lotus/utils/class' # v0.2.0
TIMES = (ENV['TIMES'] || 1_000_000).to_i
class Foo
end
@ngauthier
ngauthier / jslint_test.rb
Created August 29, 2012 17:42
jslint via capybara-webkit
require 'test_helper'
class JslintTest < ActionDispatch::IntegrationTest
include ActionView::Helpers::JavaScriptHelper
['file1', 'file2', 'file3'].each do |path|
path.gsub!(/^app\/assets\/javascripts\//, "")
path += '.js'
test "JSLINT #{path}" do
assert_jslint(path)
@Thermionix
Thermionix / auth-basic.conf
Last active November 4, 2021 00:56
nginx reverse proxy for sickbeard, couchpotato etc.
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
@johanb
johanb / video_santafy.rb
Created April 23, 2012 11:49 — forked from alskipp/video_santafy.rb
macruby video Santa-fy (with support for multiple Santas)
framework 'Cocoa'
framework 'avfoundation'
class Santa
t_url = NSURL.URLWithString("http://dl.dropbox.com/u/349788/mustache.png")
t_source = CGImageSourceCreateWithURL t_url, nil
@@tache = CGImageSourceCreateImageAtIndex t_source, 0, nil
g_url = NSURL.URLWithString("http://dl.dropbox.com/u/349788/glasses.png")
g_source = CGImageSourceCreateWithURL g_url, nil
@panicsteve
panicsteve / gist:1641705
Created January 19, 2012 18:26
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@alskipp
alskipp / video_santafy.rb
Created December 20, 2011 14:38 — forked from pvinis/video_mustachify
macruby video Santa-fy (with support for multiple Santas)
framework 'Cocoa'
framework 'avfoundation'
class Santa
t_url = NSURL.URLWithString("http://dl.dropbox.com/u/349788/mustache.png")
t_source = CGImageSourceCreateWithURL t_url, nil
@@tache = CGImageSourceCreateImageAtIndex t_source, 0, nil
g_url = NSURL.URLWithString("http://dl.dropbox.com/u/349788/glasses.png")
g_source = CGImageSourceCreateWithURL g_url, nil
@madrobby
madrobby / i18n.coffee
Created November 14, 2011 15:45
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
@ryanb
ryanb / spec_helper.rb
Created September 12, 2011 21:37
Use RSpec tags to add behavior around specs.
# Add this to your spec_helper.rb
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.around(:each, :vcr) do |example|
name = example.metadata[:full_description].downcase.gsub(/\W+/, "_").split("_", 2).join("/")
VCR.use_cassette(name, :record => :new_episodes) do
example.call
end
end
end
@ryanb
ryanb / spec_helper.rb
Created September 12, 2011 21:29
Focus on specific specs in RSpec
# add this to your spec helper
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
# and then use the :focus tag in your specs
it "does something awesome", :focus do
@kmamykin
kmamykin / Gemfile
Created August 4, 2011 08:28
Rails 3.1.0.rc5 setup for heroku with assets pipeline working
gem 'rails', '3.1.0.rc5'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass', '3.1.5' # <= downgraded due to a weird interaction b/w compass blueprint and latest Sass
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-rails', "~> 3.1.0.rc"
gem 'uglifier'
gem 'compass', :git => 'https://github.com/chriseppstein/compass.git', :branch => 'rails31'