Skip to content

Instantly share code, notes, and snippets.

View pius's full-sized avatar

Pius Uzamere pius

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pius on github.
  • I am pius (https://keybase.io/pius) on keybase.
  • I have a public key whose fingerprint is 5519 DBEE 75A4 41EF 5A87 6F1E 1AE9 372B E9B1 3E0A

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am pius on github.
  • I am pius (https://keybase.io/pius) on keybase.
  • I have a public key whose fingerprint is 3339 1419 8DA3 F738 F713 CA65 E54E 4DED 9F2C D83D

To claim this, I am signing this object:

SimpleGeo *client = [SimpleGeo clientWithConsumerKey:@"MYKEY" consumerSecret:@"MYSECRET"];
SGStorageQuery *sgquery = [SGStorageQuery queryWithAddress:@"41 Decatur St, San Francisco, CA"
layer:@"MYLAYER"];
SGCallback *callback = [SGCallback callbackWithSuccessBlock:
^(id response) {
NSLog(@"simplegeo responded");
} failureBlock:^(NSError *error) {
NSLog(@"failed to find in SimpleGeo");
@pius
pius / gist:1202596
Created September 8, 2011 04:14
Parse example
// serialize the image and save it on the object
UIImage *small = [UIImage imageWithCGImage:image.CGImage scale:0.1 orientation:UIImageOrientationUp];
NSData *imageData = UIImageJPEGRepresentation(small, .5);
[self.added setObject:imageData forKey:@"image"];
// later ...
[self.added saveInBackground]; //unfortunately, this still blocks the main thread
@pius
pius / gist:798925
Created January 27, 2011 18:13
quick response to "17:05 16:53 16:29 16:13 14:19 14:14 14:09 14:08 14:02 13:39 13:38 13:36 13:28 13:26 13:26 13:25 13:11 13:08 12:57 12:44 12:40 12:37 12:32 12:21 12:11 12:02 11:45 11:28 11:25".split.group_by {|time_string| tim
"17:05
16:53
16:29
16:13
14:19
14:14
14:09
14:08
14:02
13:39
Thu Apr 29 15:56:22 query future-production.$cmd ntoreturn:1 command reslen:64 159769ms
Thu Apr 29 15:56:23 query future-production.$cmd ntoreturn:1 command reslen:64 906ms
Thu Apr 29 15:56:23 end connection 10.249.191.143:42256
Thu Apr 29 15:56:23 end connection 10.249.191.143:42303
Thu Apr 29 15:56:23 query future-production.people ntoreturn:1 idhack reslen:27983 203ms
Thu Apr 29 15:56:27 query future-production.$cmd ntoreturn:1 command reslen:64 938ms
Thu Apr 29 15:56:35 connection accepted from 10.249.191.143:42378 #2550
Thu Apr 29 15:56:35 connection accepted from 10.249.191.143:42379 #255
MONGODB db.system.indexes.insert([{:name=>"slug_1", :ns=>"future-production.quotations", :key=>{"slug"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"tags_1", :ns=>"future-production.quotations", :key=>{"tags"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"users_who_verified_ids_1", :ns=>"future-production.quotations", :key=>{"users_who_verified_ids"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"users_who_disputed_ids_1", :ns=>"future-production.quotations", :key=>{"users_who_disputed_ids"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"graph_1", :ns=>"future-production.quotations", :key=>{"graph"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"noteworthy_1", :ns=>"future-production.quotations", :key=>{"noteworthy"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"group_id_1", :ns=>"future-production.quotations", :key=>{"group_id"=>1}, :unique=>nil}])
MONGODB db.system.indexes.insert([{:name=>"top
Mon Apr 5 11:58:20 connection accepted from 10.245.62.63:49645 #527
Mon Apr 5 11:58:20 end connection 10.245.62.63:49643
Mon Apr 5 11:58:39 connection accepted from 10.195.30.175:33649 #528
Mon Apr 5 11:58:39 connection accepted from 10.195.30.175:33650 #529
Mon Apr 5 11:58:39 end connection 10.195.30.175:33649
Mon Apr 5 12:06:45 query future-production.$cmd ntoreturn:1 command reslen:64 71355ms
Mon Apr 5 12:07:06 query future-production.$cmd ntoreturn:1 command reslen:64 929ms
Mon Apr 5 12:07:29 connection accepted from 10.249.191.143:39649 #530
Mon Apr 5 12:07:29 connection accepted from 10.249.191.143:39650 #531
Mon Apr 5 12:07:29 query future-production.system.namespaces ntoreturn:0 reslen:3365 nscanned:62 {} nreturned:62 112ms
# slbug's temporary fix for Haml issue GH-83
# gisted for convenience
class String
attr_accessor :rails_html_safe alias html_safe? rails_html_safe
def html_safe!
@_rails_html_safe = true
self
end
Ruby console for rebirth.heroku.com
>> c = Choice.find 169
=> #<Choice id: 169, item_id: 169, question_id: 1, position: nil, wins: nil, ratings: nil, losses: nil, created_at: "2009-12-03 21:36:40", updated_at: "2009-12-04 18:50:45", request_id: nil, prompt_id: nil, active: false, tracking: nil, score: 36.3636363636364, local_identifier: nil, prompts_on_the_left_count: 279, prompts_on_the_right_count: 279, votes_count: 4, loss_count: 7, prompts_count: 562>
>> c.wins
=> 4
>> c.losses
=> 7
>> times_competing = c.wins_plus_losses
=> 11
>> c.wins / times_competing