View notifier.js
1 2 3 4 5 6 7 8 9 10
var Hoptoad = {
VERSION : '0.1.0',
NOTICE_XML : '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"><api-key></api-key><notifier><name>hoptoad_notifier_js</name><version>0.1.0</version><url>http://hoptoadapp.com</url></notifier><error><class>EXCEPTION_CLASS</class><message>EXCEPTION_MESSAGE</message><backtrace>BACKTRACE_LINES</backtrace></error><request><url>REQUEST_URL</url><component>REQUEST_COMPONENT</component><action>REQUEST_ACTION</action></request><server-environment><project-root>PROJECT_ROOT</project-root><environment-name>production</environment-name></server-environment></notice>',
ROOT : window.location.protocol + '//' + window.location.host,
BACKTRACE_MATCHER : /^(.*)\@(.*)\:(\d+)$/,
backtrace_filters : [/notifier\.js/],
 
notify: function(error) {
var xml = escape(Hoptoad.generateXML(error));
var host = Hoptoad.host || 'hoptoadapp.com';
View fizz-buzz.rb
1 2 3 4 5 6 7 8 9 10
# Usage: ruby fizz-buzz.rb max_num
# create a constant for the default
# if no command-line argument is specified
DEFAULT_MAX = 100
 
# max number is either our default,
# or the command-line argument.
# ARGV is an array that holds your cmd-line args.
# so if you typed ruby fizz-buzz.rb 13 monkey dawg
# puts ARGV[0] <---- prints 13
View gist:1206664
1 2 3 4 5 6 7 8 9 10
class ImportLegacyDevices < ActiveRecord::Migration
def self.up
return unless Rails.env.production?
 
legacy_devices.each do |device_id, issue|
if device = Device.find_by_hardware_id(device_id)
unless InclusiveIssue.exists?(:issue_id => issue.id, :device_id => device.id)
InclusiveIssue.create!(
:issue => issue,
:device => device,
View jquery-innershiv-extend.js
1 2 3 4 5 6 7 8 9 10
(function($){
var _oldHtml = $.fn.html;
$.fn.html = function(value) {
if ($.browser.msie && typeof value === 'string') {
return _oldHtml.call(this, innerShiv(value, false));
} else {
return _oldHtml.apply(this, arguments);
}
};
View gist:1162318
1 2 3 4 5 6 7 8
# env.rb
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
 
Download chromedriver from http://code.google.com/p/selenium/downloads/list
 
mv chromedriver to /usr/local/bin so it's in your path.
View gist:488352
1 2 3 4 5 6 7 8 9 10
require 'RMagick'
 
class WatermarkMe
def initialize(app, args)
@app = app
@watermark_text, @mime_types = *args
@mime_types ||= %w[image/jpeg image/png image/gif]
end
def call(env)
View only-for-me.rb
1 2 3 4 5
This application is only for me. Or can you tell the secret?
<form method="post" action="<%= current_action %>">
<input id="<%= param_name%>" name="<%= param_name%>" type="password" />
<button class="submitButton" type="submit" name="commit">Here I am!</button>
</form>
View iPhone games worth playing
1 2 3 4 5 6 7 8 9 10
Bejewled 2
Rock Band
Police Radio
Cartoon Wars
Tetris
Need For Speed
Civilization
Pocket God
Flight Control
Zombieville USA
View iPhone apps
1 2 3 4 5 6 7 8 9
Insomnia - keep your Wireless connection running when the phone is locked (that way the screen doesn't have to be on 24/7)
 
SBSettings - access iphone settings from anywhere by swiping the top of the screen
 
5 icon dock
5 column springboard
 
Pirni - native network sniffer
pirni-derv - view packets sniffed with Pirni in real-time on the iPhone
View gist:262595
1 2 3 4 5 6 7 8 9
# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "git@github.com:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current
 
set(:latest_release) { fetch(:current_path) }
set(:release_path) { fetch(:current_path) }
set(:current_release) { fetch(:current_path) }
Something went wrong with that request. Please try again.