This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
bundle install --standalone | |
digest=$(md5 -q Gemfile) | |
cmd="raise \"Gemfile changed\" if %x[md5 -q Gemfile].chomp != \"${digest}\"" | |
echo $cmd > bundle/bundler/setup.rb.new | |
cat bundle/bundler/setup.rb >> bundle/bundler/setup.rb.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :development do | |
# Replace the old aws gem with this one (or newer): | |
gem "aws-sdk-core", "2.0.0.rc15" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setTextMeasure = function (contentElement, targetMeasure, maxSize, minSize) { | |
if (!contentElement) contentElement = document.createElement('p'); | |
if (!targetMeasure) targetMeasure = 66; | |
if (!maxSize) maxSize = 16; | |
if (!minSize) minSize = 9; | |
var sizer = contentElement.cloneNode(); | |
sizer.style.cssText = 'margin: 0; padding: 0; color: transparent; background-color: transparent; position: absolute;'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) | |
describe Admin::ForumsController do | |
describe 'routing' do | |
# controller only implements #index, #show and #update | |
specify { get('/admin/forums').should have_routing('admin/forums#index') } | |
specify { get('/admin/forums/foo').should have_routing('admin/forums#show', :id => 'foo') } | |
specify { put('/admin/forums/foo').should have_routing('admin/forums#update', :id => 'foo') } | |
# the remaining RESTful actions aren't recognized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Helper class for importing files with records to the database. | |
class SeedFile | |
def self.import(path) | |
new(path).import | |
end | |
attr_reader :path | |
def initialize(path) | |
@path = Pathname(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'v8' | |
class HandlebarsTemplateHandler | |
def self.js | |
Thread.current[:v8_context] ||= begin | |
V8::Context.new do |js| | |
js.load(File.join(Rails.root, 'vendor', 'javascripts', 'handlebars.js')) | |
js.eval("Templates = {}") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test | |
module Unit | |
TestCase = RSpec::Core::ExampleGroup | |
end | |
end | |
class Test::Unit::TestCase | |
def self.inherited(host) | |
host.set_it_up host.name.gsub(/(Spec|Test)/,'') | |
def host.method_added(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You must require this file in application.rb, above the Application | |
# definition, for this to work. For example: | |
# | |
# # Syslog-like Rails logs | |
# if Rails.env.production? | |
# require File.expand_path('../../lib/better_logger', __FILE__) | |
# end | |
# | |
# module MyApp | |
# class Application < Rails::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
This Python scripts listens for all HTTP requests to the | |
Turntable CDNs and downloads the file requested into the | |
current directory. | |
Disclaimer: This is a proof of concept. The author of this | |
script is not responsible for how this is used. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' unless defined?(Gem) | |
# load a gem/lib into irb in a way that is durable to bundler LOAD_PATH | |
# hackery | |
# | |
# inspired by | |
# https://github.com/aniero/dotfiles/blob/master/irbrc#L4-35 | |
# | |
# IRB.gem('irbcp') | |
# IRB.gem('awesome_print', :lib => 'ap') |
OlderNewer