Skip to content

Instantly share code, notes, and snippets.

@endoze
endoze / example.rb
Created July 30, 2012 11:52 — forked from erikeldridge/example.rb
A utility for signing an url using OAuth in a way that's convenient for debugging
require 'oauth_util.rb'
require 'net/http'
o = OauthUtil.new
o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--';
o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977';
url = 'http://query.yahooapis.com/v1/yql?q=select%20*%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=true';
@endoze
endoze / Example.h
Created July 30, 2012 15:45
GCD convenience method for a long running task and a callback when it's done
#import <UIKit/UIKit.h>
@interface Example : NSObject
- (void)performLongRunningTask:(SEL)taskMethod withCallback:(SEL)callbackMethod;
@end
@endoze
endoze / example.js
Created September 25, 2012 03:29
Twitter Ajax Query
$.ajax({
dataType: 'jsonp',
jsonp: 'callback',
url: 'http://search.twitter.com/search.json?q=fwgangnamstyle',
success: function(obj) {
for (var i = 0; i <= obj['results'].length - 1; ++i) {
var user = obj['results'][i]['from_user'];
var tweet_text = obj['results'][i]['text'];
var html = "<li><a href=https://twitter.com/" + user + ">@" + user + "</a> said " + tweet_text + "</li>";
console.log(obj['results'][i]);
@endoze
endoze / waitForCompletion.m
Created November 5, 2012 20:11
Async Unit Testing Helper Method
# found at http://www.infinite-loop.dk/blog/2011/04/unittesting-asynchronous-network-access/
- (BOOL)waitForCompletion:(NSTimeInterval)timeoutSecs {
NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:timeoutSecs];
do {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeoutDate];
if([timeoutDate timeIntervalSinceNow] < 0.0)
break;
} while (!done);
@endoze
endoze / open_link.rb
Created January 29, 2013 19:38
Tie this into failing Rspec tests. Will help you write better tests through brutal exposure to terrible singing.

Keybase proof

I hereby claim:

  • I am endoze on github.
  • I am endoze (https://keybase.io/endoze) on keybase.
  • I have a public key whose fingerprint is C6B9 EBB1 F177 66B1 0C81 163A D11E 5E0A F722 4EE1

To claim this, I am signing this object: