Skip to content

Instantly share code, notes, and snippets.

View indirect's full-sized avatar

André Arko indirect

View GitHub Profile
#!/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
@dgoodlad
dgoodlad / Gemfile
Created October 21, 2014 22:38
Boxen script/sync
group :development do
# Replace the old aws gem with this one (or newer):
gem "aws-sdk-core", "2.0.0.rc15"
end
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;';
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
@eventualbuddha
eventualbuddha / seed_file.rb
Created July 9, 2010 01:51
SeedFile, a helper for doing database setup in a Rails 3 app
# 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)
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
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)
@indirect
indirect / better_logger.rb
Created July 19, 2011 07:00
Rails 3 logs with severity and PIDs
# 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
@mitchellh
mitchellh / gist:1171262
Created August 25, 2011 17:44
They see me wiresharkin'... they hatin'...
#!/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.
"""
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')