Note: This formula is outdated.
To install [Meteor][1] with the [Homebrew][2] formula [below][3], run:
brew install https://raw.github.com/gist/3072321/meteor.rb
This Homebrew Meteor Formula is based on https://install.meteor.com.
$ ruby unique-unordered-pairing-function.rb | |
Cantor Pairing Function | |
----------------------- | |
<x, y> = (x + y) * (x + y + 1) / 2 + y | |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 | |
+ ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + | |
0 | 0 | 1 | 3 | 6 | 10 | 15 | 21 | 28 | 36 | 45 | 55 | 66 | 78 | 91 | |
# This Ruby script (regardless of where it's located on the file system) recur- | |
# sively lists all duplicate files in the direcotry in which it's executed. | |
require 'digest/md5' | |
hash = {} | |
Dir.glob('**/*', File::FNM_DOTMATCH).each do |f| | |
next if File.directory?(f) | |
key = Digest::MD5.hexdigest(IO.read(f)).to_sym |
[user] | |
name = Matt Di Pasquale | |
email = my@fake-email.com | |
[alias] | |
ad = add -A | |
br = branch | |
cr = clone --recursive | |
ci = commit -av | |
cm = commit -am | |
co = checkout |
# How to Install RVM, Ruby, and Gems without Xcode Command Line Tools | |
# =================================================================== | |
# | |
# Mac OS X 10.8.2 (12C60) (Mountain Lion) | |
# Xcode 4.5 (4G182) | |
# | |
# While attempting to `rvm pkg install openssl`, I had encountered the error: | |
# > cryptlib.h:62:20: error: stdlib.h: No such file or directory | |
# But, the commands & ouput below show how I worked around the issue. | |
# |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
module USPS | |
SERVER = "http://production.shippingapis.com/ShippingAPITest.dll" | |
USERNAME = 'username-here' # username from http://www.usps.com/webtools/ | |
class Address | |
# requres ruby-1.9, which keeps hashes ordered |
// Photoshop Script to Create iPhone Icons from iTunesArtwork | |
// | |
// WARNING!!! In the rare case that there are name collisions, this script will | |
// overwrite (delete perminently) files in the same folder in which the selected | |
// iTunesArtwork file is located. Therefore, to be safe, before running the | |
// script, it's best to make sure the selected iTuensArtwork file is the only | |
// file in its containing folder. | |
// | |
// Copyright (c) 2010 Matt Di Pasquale | |
// |
class App | |
def call(env) | |
[200, {'Content-Type' => 'text/plain'}, "Hello, World!"] | |
end | |
end |
require 'rspec' | |
class String | |
if method_defined? :reverse_words | |
raise "String#reverse_words is already defined" | |
end | |
def reverse_words | |
split(' ').reverse!.join(' ') | |
end |
Note: This formula is outdated.
To install [Meteor][1] with the [Homebrew][2] formula [below][3], run:
brew install https://raw.github.com/gist/3072321/meteor.rb
This Homebrew Meteor Formula is based on https://install.meteor.com.
# Census Birthdate Calculator | |
# http://sean.famthings.com/2009/03/04/the-census-birth-date-calculator/ | |
# http://genealogy.eshea.us/anchestor_birthdate_calculator.html | |
# Calculate birthdate range from dates & ages. | |
# Usage: ruby census_birthdate_calculator.rb 2000-04-14 16 2013-03-21 28 | |
require 'date' |