Skip to content

Instantly share code, notes, and snippets.

View atnan's full-sized avatar

Nathan de Vries atnan

View GitHub Profile
//
// UIApplication+TVOut.m
// MediaMotion2
//
// Created by Rob Terrell on 5/15/09
// Copyright 2009 Stinkbot LLC. All rights reserved.
//
#define kFPS 10
#define kUseBackgroundThread YES
# define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
# ifdef DEBUG
# define DLog(fmt, ...) ALog(fmt, ##__VA_ARGS__);
# else
# define DLog(...)
# endif
/*
Copyright (c) 2009 Nathan de Vries
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
>> endpoint
=> #<OpenID::OpenIDServiceEndpoint:0x3f4acc4 @local_id=nil, @display_identifier=nil, @type_uris=["http://specs.openid.net/auth/2.0/server", "http://specs.openid.net/extensions/pape/1.0", "http://openid.net/sreg/1.0", "http://openid.net/extensions/sreg/1.1"], @used_yadis=true, @server_url="https://open.login.yahooapis.com/openid/op/auth", @canonical_id=nil, @claimed_id=nil>
>> endpoint.uses_extension("http://specs.openid.net/auth/2.0/signon")
=> false
require "uri"
require "net/http"
class ShortUrl
def self.expand(url)
uri = URI.parse(url)
response = Net::HTTP.start(uri.host, uri.port) do |request|
request.head(uri.path)
end
response["Location"]
document.observe("dom:loaded", function(loaded) {
$("login_via_facebook_connect").observe("click", function(clicked) {
FB_RequireFeatures(["Connect"], function() {
FB.init("FACEBOOK_API_KEY", "path/to/fb_crossdomain_communications_channel.html", {
ifUserConnected: function(uid) {
// SessionController#create will get the Facebook session from the
// cookie set by Facebook on the Cross Domain Communication Channel
clicked.element().up("form").submit();
}
});
#!/bin/sh
#
# This script was written by Toby White under an unknown license, and published
# on the Git mailing list:
#
# http://kerneltrap.org/mailarchive/git/2007/11/21/435536
#
# Superficial changes were made by Nathan de Vries to allow the script to be
# run under Leopard. Tony's original instructions follow:
#
# Would help dramatically if the function and arguments were appropriately named
def f(ra,n)
ra.inject(0) do |accum, value|
value.include?(n) ? accum + 1 : accum
end
end
sudo gem list --local | grep "^merb-" | cut -d " " -f1 | while read gem; do
sudo gem uninstall -a $gem
done
#import "CommonCrypto/CommonDigest.h"
@interface NSString (NSStringAdditions)
- (id) stringByPerformingMD5Checksum;
- (id) stringByEncodingIllegalURLCharacters
- (id) stringByDecodingIllegalURLCharacters
@end