Skip to content

Instantly share code, notes, and snippets.

View sco's full-sized avatar

Scott Raymond sco

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sco on github.
  • I am sco (https://keybase.io/sco) on keybase.
  • I have a public key whose fingerprint is CE48 F2FE C915 5969 54AF 683D 3D11 FC7E E1D8 B758

To claim this, I am signing this object:

I am +sco on OneName. #verifymyonename
- (void)importVideo
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"m4v"];
UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
}
- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
if (error != nil) {
NSLog(@"Error: %@", error);
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>test</h1>
</body>
</html>
@sco
sco / gist:832499
Created February 17, 2011 19:48
Using XAuth to exchange username/password credentials for a OAuth access token
// UITextFieldDelegate method, called when the "Return" key is pressed.
// Either advance the cursor to the next empty field, or submit the form.
//
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if([usernameField.text length] == 0) {
[usernameField becomeFirstResponder];
} else if ([passwordField.text length] == 0) {
[passwordField becomeFirstResponder];
} else {
@sco
sco / gist:832414
Created February 17, 2011 19:13
Simple chronologic example
# Get an instance of the Chronologic client
chronologic = Chronologic::Client.new
# Cache metadata for users, spots, etc.
chronologic.object(:user_1, {:name => 'Scott Raymond'})
chronologic.object(:user_2, {:name => 'Josh Williams'})
chronologic.object(:spot_1, {:name => 'Gowalla HQ'})
# Create subscriptions when one user follows another, etc.
chronologic.subscribe(:user_2_friends, :user_1)
"Beer To Beer Networking"
class VisitorStats
def initialize
@redis = Redis.new
end
# every time there's a hit, increment a counter for the
# day and week, and add the session id to a set of unique
# vistitors for the day/week
def hit(session_id)
today = Date.today
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0">
<id>tag:gowalla.com,2009:/visits/all</id>
<title>Gowalla Checkins</title>
<updated>2010-02-02T09:59:14+00:00</updated>
<link rel="self" href="http://gowalla.com/visits/all.atom"/>
<link rel="alternate" href="http://gowalla.com/visits/all"/>
<author>
<name>Gowalla</name>
</author>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0">
<id>tag:gowalla.com,2009:/visits/all</id>
<title>Gowalla Checkins</title>
<updated>2010-02-02T09:59:14+00:00</updated>
<link rel="self" href="http://gowalla.com/visits/all.atom"/>
<link rel="alternate" href="http://gowalla.com/visits/all"/>
<author>
<name>Gowalla</name>
</author>