This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Finding the H.264 format of a Vimeo video: | |
1. Fetch the clip XML metadata (e.g. "http://vimeo.com/moogaloop/load/clip:5531123") | |
2. Grab the value of "request_signature" and "request_signature_expires" from the XML | |
3. Use the URL "http://vimeo.com/moogaloop/play/clip:5531123/REQUEST_SIG/REQUEST_SIG_EXPIRES/?q=hd" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UIView (Debugging) | |
-(void)inspectWithDepth:(int)depth path:(NSString *)path; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Checking out | |
git svn init <svn url> <checkout directory> | |
git svn fetch | |
git repack -d | |
# Working | |
git checkout -b some-feature | |
git commit -a -m "Some feature" | |
# Commiting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpkg --get-selections > packages.txt | |
dpkg --set-selections < packages.txt | |
apt-get dselect-upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def measure_time task_description | |
beginning = Time.now | |
yield | |
puts "Time to #{task_description}: #{Time.now - beginning} seconds" | |
end | |
def add a, i | |
a << i | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Job < ActiveRecord::Base | |
STATUS_READY, STATUS_IN_PROGRESS, STATUS_DONE = 1, 2, 3 | |
def self.fetch(pid) | |
update_all( | |
{ :status => STATUS_IN_PROGRESS, | |
:pid => pid }, | |
{ :status => STATUS_READY }, | |
{ :limit => 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define HEXCOLOR(c) [UIColor colorWithRed:((c>>24)&0xFF)/255.0 \ | |
green:((c>>16)&0xFF)/255.0 \ | |
blue:((c>>8)&0xFF)/255.0 \ | |
alpha:((c)&0xFF)/255.0]; | |
UIColor* myColor = HEXCOLOR(0xff0000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface CameraTestAppDelegate : NSObject <UIApplicationDelegate> { | |
UIWindow *window; | |
} | |
@property (nonatomic, retain) IBOutlet UIWindow *window; | |
- (void) cameraControllerReadyStateChanged:(NSNotification*)aNotification; | |
- (void) cameraController:(id)sender tookPicture:(UIImage*)picture withPreview:(UIImage*)preview jpegData:(NSData*)rawData imageProperties:(struct __CFDictionary*) imageProperties; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SynthesizeSingleton.h | |
// CocoaWithLove | |
// | |
// Created by Matt Gallagher on 20/10/08. | |
// Copyright 2009 Matt Gallagher. All rights reserved. | |
// | |
// Permission is given to use this source code file without charge in any | |
// project, commercial or otherwise, entirely at your risk, with the condition | |
// that any redistribution (in part or whole) of source code must retain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def rake_silent_tasks | |
dotcache = "#{File.join(File.expand_path('~'), ".raketabs-#{Dir.pwd.hash}")}" | |
if File.exists?(dotcache) | |
Marshal.load(File.read(dotcache)) | |
else | |
require 'rubygems' | |
require 'rake' | |
load 'Rakefile' |