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
Factory.define :application do |factory| | |
factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
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
require 'watir' | |
require 'watir/container' | |
require 'watir/element' | |
require 'watir/input_elements' | |
require 'watir/link' | |
def support_wait_to_methods | |
timeout_in_seconds = 30 | |
original_method_missing = self.instance_method(:method_missing) |
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 dashes = ""; var num = 20; while(--num) dashes += "-"; setInterval(function() { window.history.pushState("", "", '/sticky-history?' + dashes.slice(0, num % 20) + "foo" + dashes.slice(num % 20)); num++;}, 100); |
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
## /config/initializers/dynamic_job.rb | |
require 'heroku' | |
# base class for all jobs that you wish to automatically scale and go down in Heroku | |
class DynamicJob | |
#set a cap on maximum number of users ever - just in case. | |
MAX_CONCURRENT_WORKERS = 100 | |
def initialize |
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 "watir-webdriver" | |
class BrowserContainer | |
def initialize(browser) | |
@browser = browser | |
end | |
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
#!/bin/env python | |
# | |
# Demo tool to generate the rtmpdump(1) command for streaming a song from Rdio. | |
import httplib | |
from optparse import OptionParser | |
from os.path import basename | |
from pprint import pprint | |
from pyamf.remoting.client import RemotingService | |
from rdioapi import Rdio |
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
for i in `hg branches |grep -v 'default' |grep -v 'develop' |grep inactive |awk 'NF>1{print $(NF-1)}'`; do hg update -r "$i" && hg commit -m "Closed branch" --close-branch; done |
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
class Time | |
# See http://msdn.microsoft.com/en-us/library/system.datetime.ticks.aspx | |
# https://gist.github.com/chancancode/2830878 | |
TICKS_SINCE_EPOCH = -(Time.utc(0001, 01, 01).to_i * 10000000) | |
def to_ticks | |
utc.to_i * 10000000 + TICKS_SINCE_EPOCH # ruby 1.8.7 doesn't support nano seconds so we're ok without it | |
# to_i * 10000000 + nsec / 100 - TICKS_SINCE_EPOCH | |
# <seconds from 1970-01-01 multiplied by 10 000 000> result is ticks + <self nsec which by default would be skipped>/100 result is ticks + ticks from 0001-01-01 | |
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
(function() { | |
// Notes from http://news.ycombinator.com/item?id=1952531 | |
var notes = { | |
"suspended cymbal":"zk", | |
"snare":"bschk", | |
"brush":"pv", | |
"bass":"bk", | |
"flam1":"tk", | |
"roll tap":"vk", | |
"flam2":"kt", |
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 'action_controller/test_process' | |
# Paperclip attachments in factories, made easy based on technicalpickles | |
Factory.class_eval do | |
def attach(name, path, content_type = nil) | |
if content_type | |
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}", content_type) | |
else | |
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}") | |
end |
OlderNewer