This file contains 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 test(): | |
print 'this is a test gist' |
This file contains 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
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { | |
UITableView *tableView = self.tableView; | |
switch (type) { | |
case NSFetchedResultsChangeInsert: | |
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade]; | |
break; | |
case NSFetchedResultsChangeDelete: | |
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; | |
break; |
This file contains 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
case NSFetchedResultsChangeMove: | |
// Move the row | |
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; | |
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade]; | |
// Delete the section if it's now empty | |
if ([[controller sections] count] == 1){ | |
[self.tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade]; | |
} | |
break; |
This file contains 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
This is a multi-part message in MIME format... | |
------------=_1261499068-19033-0 | |
Content-Type: text/plain; charset=utf-8 | |
We have received an inquiry about Snapm. | |
From: petkanics@gmail.com | |
At: 2009-12-22 11:24:27 -0500 | |
Message: I'm hoping that turning off the subscription management doesn't mess up the newlines. |
This file contains 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
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# To use: | |
# rails project_name -m http://gist.github.com/gists/219223.txt | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" |
This file contains 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
# If you post to a Ruby on Rails REST API endpoint, then you'll get an | |
# InvalidAuthenticityToken exception unless you set a different | |
# content type in the request headers, since any post from a form must | |
# contain an authenticity token. | |
# | |
# This example shows you how to post to a rails endpoint. | |
require 'json' |
This file contains 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
{ | |
"_id" : ObjectId("4d91585fe31f0d3ae1002876"), | |
"group" : { | |
"group_country" : "us", | |
"group_lat" : 39.78, | |
"group_city" : "Denver", | |
"group_name" : "Business Mommies", | |
"group_lon" : -104.76, | |
"group_topics" : [ | |
{ |
This file contains 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
module MongoHP | |
class HPObject | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
store_in :hp_objects | |
field :object_type, :type => String | |
field :tags, :type => Array | |
... |
This file contains 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 CopyPlaceJob | |
@queue = :general | |
def self.perform(id) | |
old_place = ::Place.find(id) | |
mongo_user = MongoHP::User.first(:conditions => {:old_id => old_place.user_id}) | |
if mongo_user | |
place = mongo_user.hp_objects.create(:old_id => old_place.id, | |
:object_type => "Place", | |
:display_name => old_place.name, |
This file contains 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
{ | |
"perma_link":"http://hyperpublic.com/places/4dd5390de800dd013a000001/profile", | |
"phone_number":"+1 212 989 0313", | |
"tags":[ | |
"Food", | |
"Brewery", | |
"Nightlife spots", | |
"Pubs", | |
"Bars & pubs", | |
"Bars", |
OlderNewer