Skip to content

Instantly share code, notes, and snippets.

View matthewhudson's full-sized avatar

Matthew Hudson matthewhudson

View GitHub Profile
@matthewhudson
matthewhudson / deploy.sh
Created February 8, 2012 20:10
Deploy Node.js to Heroku
# Create the app on the Cedar stack using a custom buildpack:
heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-nodejs.git
# Creating sharp-rain-871... done, stack is cedar
# http://sharp-rain-871.herokuapp.com/ | [email protected]:sharp-rain-871.git
# Git remote heroku added
# Rename the application.
heroku rename newname
git push heroku master
@matthewhudson
matthewhudson / .osx
Created March 8, 2012 05:00 — forked from dennmart/.osx
Sensible defaults for Mac OS X Lion
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Automatically open a new Finder window when a volume is mounted
@matthewhudson
matthewhudson / ExampleClass.m
Created March 17, 2012 03:31 — forked from lukeredpath/ExampleClass.m
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
@matthewhudson
matthewhudson / gist:2130572
Created March 20, 2012 03:00
Create folder if doesn't exist
// Documents directory
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask, YES)
objectAtIndex:0];
NSString *dataPath = [documentsPath stringByAppendingPathComponent:@"folderName"];
// Create folder if does not exist.
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath]) {
@matthewhudson
matthewhudson / gist:2162865
Created March 22, 2012 19:53
Cocoa NSLog() Frame & Bounds
// The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
NSLog(@"bounds.origin.x: %f", thing.bounds.origin.x);
NSLog(@"bounds.origin.y: %f", thing.bounds.origin.y);
NSLog(@"bounds.size.width: %f", thing.bounds.size.width);
NSLog(@"bounds.size.height: %f", thing.bounds.size.height);
// The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
NSLog(@"frame.origin.x: %f", thing.frame.origin.x);
NSLog(@"frame.origin.y: %f", thing.frame.origin.y);
NSLog(@"frame.size.width: %f", thing.frame.size.width);
@matthewhudson
matthewhudson / README.markdown
Created June 11, 2012 02:42
Application Icon Formats

App Icon Generator

Quickly generate web, mobile and social icons.

Introduction

Your new project needs icons. Different platforms have different icon guidelines. This project seeks to condense those requirements into a single script that handles all the technical guidelines.

Provide the script a single image and it will generate everything you need.

@matthewhudson
matthewhudson / environ.sh
Created July 3, 2012 14:25
osx environment
# Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
# Install rvm
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
rvm install 1.9.2
rvm install jruby
rvm use 1.9.2 --default
@matthewhudson
matthewhudson / metatags.html
Created July 5, 2012 18:27
"Reset" css for UIWebView
<!-- Disable auto-linking of phone numbers. -->
<meta name="format-detection" content="telephone=no">
<!-- Enables the web application runs in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Sets the style of the status bar for a web application. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Sets the initial scale and turns off user scaling. -->
@matthewhudson
matthewhudson / functions.php
Created September 4, 2012 13:41 — forked from abecoffman/functions.php
Adds Facebook Graph meta tags to Wordpress blog pages and thumbnail support to your Wordpress theme
<?php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
function the_facebook_graph_data() {
// setup the default site attributes
$graph;
$graph["site_name"] = "YOUR_SITE_NAME";