Skip to content

Instantly share code, notes, and snippets.

View dob's full-sized avatar

Doug Petkanics dob

View GitHub Profile
def test():
print 'this is a test gist'
- (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;
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 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.
# 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"
# 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'
@dob
dob / gist:995510
Created May 27, 2011 15:41
Meetup RSVP Stream
{
"_id" : ObjectId("4d91585fe31f0d3ae1002876"),
"group" : {
"group_country" : "us",
"group_lat" : 39.78,
"group_city" : "Denver",
"group_name" : "Business Mommies",
"group_lon" : -104.76,
"group_topics" : [
{
@dob
dob / gist:1001054
Created May 31, 2011 18:55
Migrate to MongoDB sample namespaced Mongoid Models
module MongoHP
class HPObject
include Mongoid::Document
include Mongoid::Timestamps
store_in :hp_objects
field :object_type, :type => String
field :tags, :type => Array
...
@dob
dob / gist:1001063
Created May 31, 2011 19:01
Migrate to MongoDB sample migration method for places
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,
{
"perma_link":"http://hyperpublic.com/places/4dd5390de800dd013a000001/profile",
"phone_number":"+1 212 989 0313",
"tags":[
"Food",
"Brewery",
"Nightlife spots",
"Pubs",
"Bars & pubs",
"Bars",