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/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
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 'benchmark' | |
require 'pp' | |
require 'active_record' | |
require 'sequel' | |
require 'data_mapper' | |
@start = Date.parse("2012-12-01") | |
@end = Date.parse("2012-12-31") | |
ActiveRecord::Base.establish_connection(adapter: 'mysql2', database: 'escobar_development', cast: false, username: 'root', password: nil, pool: 5, timeout: 5000) |
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
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences. | |
# Instructions: | |
# Go to TextMate > Preferences... | |
# Click Advanced | |
# Select Folder References | |
# Replace the following: | |
# File Pattern |
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
/** | |
Sample Propane caveatPatchor.js file based on tmm1's avatar hack. | |
You'll need at least version 1.1.1 to experiment with this: | |
http://propaneapp.com/appcast/Propane.1.1.1.zip | |
Once I'm sure exposing this hack-injection point doesn't cause problems | |
I'll do an official auto-updating version. | |
As of version 1.1.1, Propane will load and execute the contents of |
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
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs | |
# retry all failed Resque jobs except the ones that have already been retried | |
# This is, for instance, useful if you have already retried some jobs via the web interface. | |
Resque::Failure.count.times do |i| | |
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present? | |
end | |
# retry all :) | |
Resque::Failure.count.times do |i| |
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
upstream unicorn { | |
server unix:/var/www/example/current/tmp/sockets/unicorn.sock; | |
} | |
server { | |
listen 80; | |
server_name example.org www.example.org; | |
access_log /var/log/nginx/example.access.log; | |
location / { | |
root /var/www/example/current/public/; | |
if (-f $request_filename) { |
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' | |
require 'eventmachine' | |
require 'em-websocket' | |
require 'json' | |
class Connection | |
attr_accessor :socket, :user_id | |
def initialize(socket, user_id) | |
@socket = socket |
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
# Taken and Modified from => \ | |
# http://t-a-w.blogspot.com/2010/05/very-simple-parallelization-with-ruby.html | |
require "rubygems" | |
require "active_support" | |
require 'thread' | |
def Exception.ignoring_exceptions | |
begin | |
yield |
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
before "deploy", :start_serenading | |
after "deploy", :stop_serenading | |
desc "Start serenading" | |
task :start_serenading do | |
fork {`afplay '/path/to/rollout.mp3'`} rescue nil | |
end | |
desc "Stop serenading" | |
task :stop_serenading do |
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
# An extension to the Hash class to inspect what it is made of | |
class Hash | |
def whatami | |
keys.inject({}) do |hash, key| | |
hash[key] = case self[key].class.to_s | |
when "Hash" | |
self[key].whatami | |
when "Array" | |
self[key].map do |item| | |
NewerOlder