Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# Made by Pieter de Bie <frimmirf@gmail.com>
# Based on a "Pastie" task by someone
require "tempfile"
GIST_URL = 'http://gist.github.com/gists'
GIST_LOGIN_URL = 'https://gist.github.com/session'
USERNAME = "pieter"
TOKEN = "SweetTokenPower"
@henrik
henrik / hash_deep_diff.rb
Created July 14, 2009 08:38
Recursively diff two Ruby hashes.
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {
1. Download: http://files.getdropbox.com/u/559047/cocoa.tgz
2. sudo mv /Library/Frameworks/RubyCocoa.framework -> /Library/Frameworks/RubyCocoa.framework-bad
3. upack cocoa.tgz into /Library/Frameworks/
4. sudo mv /Library/Frameworks/RubyCocoa.framework-good -> /Library/Frameworks/RubyCocoa.framework
hope it helps
@simonjefford
simonjefford / firebug_logger.rb
Created October 14, 2009 13:20
My CodeRack competition entry
# See also http://github.com/simonjefford/rack_firebug_logger
# for this middleware + tests + a rails plugin
class FirebugLogger
def initialize(app, options = {})
@app = app
@options = options
end
def call(env)
dup._call(env)
# selenium-webclient does not clean up cookies unless your currently on that page.
module CookieRemover
def self.delete_all(path)
Capybara.current_session.driver.visit(path)
Capybara.reset_sessions!
end
end
After("@external-site") do
CookieRemover.delete_all("http://www.external-site.com")
@nruth
nruth / cookie_steps.rb
Created July 21, 2010 17:16
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)
@cowboy
cowboy / is-this-partial-application.js
Created September 16, 2010 20:26
Is this partial application? Currying? Something else? Vindaloo maybe?
// See my blog post:
// http://benalman.com/news/2010/09/partial-application-in-javascript/
// In the following code sample, invoking the curried function will always
// return a function until all arguments are satisfied, at which point the
// original function is invoked, returning its result. This means that all
// function arguments are required, which also allows the function to be
// called either like foo( 1, 2, 3 ) or foo( 1 )( 2 )( 3 ). This also means
// that if any argument is omitted, the original function is never invoked.
@happyboredom
happyboredom / ZbarPhoneGap.h
Created December 13, 2010 19:42
Use Zbar barcode reader with PhoneGap on iPhone
//
// ZbarPlug.h
// Phun
//
// Created by Jeff Lee on 12/12/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
/*
* Customize Footnotify on your site by adding custom css.
*
* This file is NOT loaded by the script and must be
* implemented on the site in order to apply.
*
* More info: https://gist.github.com/1046538
*
*/