Skip to content

Instantly share code, notes, and snippets.

FooViewController *fooVC = [self.storyboard instantiateViewControllerWithIdentifier:@"fooView"];
[self.navigationController pushViewController:fooVC animated:YES];
- (void)addMarkerAt:(CLLocationCoordinate2D)position forHotspot:(Hotspot *)hotspot
{
UIImage *pinImage = unvisitedPin;
if ([hotspot.visited boolValue]) {
pinImage = visitedPin;
}
CLLocationCoordinate2D annotationCoord;
annotationCoord.latitude = [hotspot.latitude doubleValue];
@rknLA
rknLA / gist:3139778
Created July 18, 2012 23:53
is this an ActiveSupport::TimeZone bug?
[68] pry(#<Api::MeasurementsController>)> params[:since]
=> "2012-07-18 23:17:44 UTC"
[69] pry(#<Api::MeasurementsController>)> @result.first.updated_at
=> Wed, 18 Jul 2012 23:17:44 UTC +00:00
[70] pry(#<Api::MeasurementsController>)> cutoff = ActiveSupport::TimeZone['UTC'].parse(params[:since])
=> Wed, 18 Jul 2012 23:17:44 UTC +00:00
[72] pry(#<Api::MeasurementsController>)> cutoff.to_i
=> 1342653464
[73] pry(#<Api::MeasurementsController>)> @result.first.updated_at.to_i
=> 1342653464
@rknLA
rknLA / friends_spec.rb
Created August 21, 2012 19:20
api acceptance test for users' friendships.
# this is the second revision, and rspec/capybara don't complain about the nested `feature` directives.
# but the before() blocks have repetition that i'm not a fan of. would love to figure out how to DRY it up.
# see previous revision for what i was trying to do.
require 'spec_helper'
feature 'friend requests' do
before(:each) do
@me = User.create(:email => '[email protected]', :password => 'foobar')
@you = User.create(:email => '[email protected]', :password => 'bazqux')
@rknLA
rknLA / gist:3818100
Created October 2, 2012 10:36
curl example - creating an air sensor, device, and measurement.
~/Sandbox/Safecast/teamdata
☺ curl -v http://ec2-54-245-97-87.us-west-2.compute.amazonaws.com/api/sensors.json -d 'api_key=VH8kYwKrQAywyopKYxm2' -X GET ruby-1.9.3-p0 kevin fdc5900
* About to connect() to ec2-54-245-97-87.us-west-2.compute.amazonaws.com port 80 (#0)
* Trying 54.245.97.87... connected
* Connected to ec2-54-245-97-87.us-west-2.compute.amazonaws.com (54.245.97.87) port 80 (#0)
> GET /api/sensors.json HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: ec2-54-245-97-87.us-west-2.compute.amazonaws.com
> Accept: */*
> Content-Length: 28
@rknLA
rknLA / gist:3824309
Created October 3, 2012 01:08
multiple sensors
curl -v http://localhost:3000/api/devices.json -d 'api_key=pWUgEvvPer5szyZAfq3D' -X POST -d 'device[manufacturer]=Safecast' -d 'device[model]=epic' -d 'device[sensor_ids][]=2' -d 'device[sensor_ids][]=3'
* About to connect() to localhost port 3000 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 3000 (#0)
> POST /api/devices.json HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:3000
> Accept: */*
> Content-Length: 123
> Content-Type: application/x-www-form-urlencoded
@rknLA
rknLA / gist:4120541
Created November 20, 2012 19:45
Rdio isUnlimited iOS Example
NSString *userKey = [[AppDelegate rdioInstance].user objectForKey:@"key"];
RDAPIRequest *userRequest = [[AppDelegate rdioInstance] callAPIMethod:@"get"
withParameters:@{ @"keys": userKey,
@"extras": @"isUnlimited,isSubscriber" }
delegate:self];
@rknLA
rknLA / gist:4370778
Created December 24, 2012 21:44
Top 50 Albums of 2003
I published this on January 1, 2004. Hard to believe how much more on top of shit I was then than I am now.
---
50) US Maple - “Purple On Time.” (Drag City - Nov 4)
49) The Kings of Leon - “Holy Roller Novocaine” (RCA - Feb 18)
48) The Rapture - “Echoes” (Universal/DFA - September 30)
47) The New Pornographers - “Electric Version” (Matador - May 6)
46) M. Ward - “The Transfiguration of Vincent” (Merge - March 18)
45) The Microphones - “Mount Eerie” (K - Jan 21)
@rknLA
rknLA / Gemfile
Last active December 11, 2015 00:18
guard fail outside of rails.
source :rubygems
gem 'guard-sass'

steps to reproduce:

curl 'http://thequeue.org/cr?id=https%3A%2F%2Faaronsw.jottit.com%2Fhowtoget&title=Aaron%20Swartz:%20howtoget' > how-to-get.html
html2text.py how-to-get.html > how-to-get.md
gist < how-to-get.md

Aaron Swartz: howtoget