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"
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)
@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>
def hash_to_ostruct(object)
return case object
when Hash
object = object.clone
object.each do |key, value|
object[key] = hash_to_ostruct(value)
end
OpenStruct.new(object)
when Array
object = object.clone
@niw
niw / import_instapaper_to_redability.rb
Created March 7, 2012 11:58
A tiny script to import items from Instapaper to Readability
#!/usr/bin/env ruby
require 'csv'
require 'net/smtp'
require 'resolv'
# We need a specific version of eventmachine due to apply a patch.
gem 'eventmachine', '0.12.10'
require 'eventmachine'
@mrichie
mrichie / 0-readme.md
Created March 24, 2012 09:38 — forked from burke/0-readme.md
ruby-1.9.3-p125 cumulative performance patch.

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@jwarchol
jwarchol / README.md
Created July 28, 2012 21:06
Breathing LED on a Raspberry Pi

Raspberry Pi Breathing LED

This is a demonstration of using Ruby and the WiringPi Gem to pulse an LED connected to a GPIO pin in a manner similar to the sleep indicator on a MacBook.

A video of the effect can be found here: http://www.youtube.com/watch?v=NCUMXK7qf-c

@richardjpope
richardjpope / gist:4452689
Last active December 10, 2015 15:09
Oyster Card backup script for ScraperWiki.com Vault
# This is a very basic script to backup oyster card data to a scraperwiki vault
# Notes:
# 1) You need an oyster card that has been registered on tfl.gov.uk
# 2) This script requires you to enter your username and password (this about what that means before progressing, and do so at your own risk)
# 3) This script should be run in a PRIVATE SCRAPERWIKI VAULT ONLY https://scraperwiki.com/pricing/ not a public scraper, or the world will know your password
import scraperwiki
import mechanize
import lxml.html
from lxml.etree import tostring