Skip to content

Instantly share code, notes, and snippets.

View iloveitaly's full-sized avatar

Michael Bianco iloveitaly

View GitHub Profile
@iloveitaly
iloveitaly / mysql2graffle.py
Created December 16, 2011 16:36
Visual Representation of MySQL Table in OmniGraffle
#! /usr/bin/pythonw
#
# Modified by Michael Bianco <[email protected]> on June 26, 2009
# Written by Thomas Pan at January 21, 2007
# mysql2graffle for Omnigraffle 5 is based on
# MyDBGraffle for OmniGraffle 4 which is based on Paul Davis' work at http://www.visualdistortion.org
#
# Requires:
#
# OmniGraffle 5
@iloveitaly
iloveitaly / graffle2hash.rb
Created December 16, 2011 18:34
Convert Hierarchical OmniGraffle Document to JSON
#!/usr/bin/env ruby
# rubycocoa
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
class GraffleConverter
def initialize
@graffle = SBApplication.applicationWithBundleIdentifier_("com.omnigroup.OmniGraffle")
//
// NSString+Levenshtein.h
// PyHelp
//
// Modified by Michael Bianco on 12/2/11.
// <http://mabblog.com>
//
// Created by Rick Bourner on Sat Aug 09 2003.
// [email protected]
@iloveitaly
iloveitaly / CPSystemInformation.h
Created January 29, 2012 03:22
CPSystemInformation compatible with Lion + 64Bit
#import <Cocoa/Cocoa.h>
@interface CPSystemInformation : NSObject {}
//all the info at once!
+ (NSDictionary *)miniSystemProfile;
+ (NSString *)machineType;
+ (NSString *)humanMachineType;
+ (NSString *)humanMachineTypeAlternate;
@iloveitaly
iloveitaly / copy-default-directory.bash
Created February 18, 2012 20:44
Some tools for managing polycom phones + asterisk systems
# this assumes you have a default directory defined
find /tftpboot/logs/ | ack 'logs/([^-]+)' --output '$1' | sed '/^$/d' | while read mac
do
cp -f "000000000000-directory.xml" "$mac-directory.xml"
done
@iloveitaly
iloveitaly / app_version.py
Created February 26, 2012 15:30
Some scripts for switching back to 10.6 VNC / ARD
#!/usr/bin/env python
# http://pastebin.com/nwanNPHs
import os, sys
from AppKit import NSMutableDictionary
appPath = sys.argv[1]
projectPlist = NSMutableDictionary.dictionaryWithContentsOfFile_(os.path.join(appPath, 'Contents/Info.plist'))
print projectPlist['CFBundleVersion'].strip(),
@iloveitaly
iloveitaly / readme.md
Created March 1, 2012 13:25
Slider / rotator for MooTools
@iloveitaly
iloveitaly / google-maps.rb
Created April 2, 2012 15:41
Rails Snippets
def google_map_directions(address)
if address.class != String
address = [:address, :address2, :city, :state, :zipcode, :country].map {
|a| (address.respond_to? a) ? address.send(a) : ""
}.join " "
end
q = Rack::Utils::build_query({
:f => "q",
:hl => "en",
@iloveitaly
iloveitaly / calculator_decorator.rb
Created June 24, 2012 02:40
Remove annoying shipping weight messages from spree_active_shipping
# for now, all USPS shipments cannot exceed 70 lbs
# this is also a bit sneaky b/c it relies on a particular load order
# should require_dependency or something
# http://www.uship.com/freight/articles/parcel-weight-restrictions/
# Spree::ShippingMethod.all.map(&:calculator).select { |m| m.class.to_s.start_with? 'Spree::Calculator::Usps' }.each do |calculator|
[
@iloveitaly
iloveitaly / README.md
Created July 18, 2012 13:28 — forked from ryanb/README.md
Print GitHub issues for all your repos – or a specific repo – out on the command line. Filter by label.

First install the required gems:

gem install octokit awesomeprint rainbow

Then run it to extract all of your open GitHub issues into files (with comments).

ruby my-gh-issues.rb