Skip to content

Instantly share code, notes, and snippets.

@pxr
pxr / articlelist.html
Created March 2, 2013 15:53
Middleman list of articles
<% page_articles.find_all{|x| !x.data.archive}.each_with_index do |article, i| %>
<li>
<time datetime="<%= article.date.strftime("%Y-%m-%d") %>">
<%= article.date.strftime("%Y-%m-%d") %> &raquo;
</time>
<a href="<%= article.url %>" rel="prefetch related"><%= article.title %></a>
</li>
@pxr
pxr / .gitignore
Created February 10, 2013 16:17
Objective-C .gitignore
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
@pxr
pxr / rubytips.md
Created August 15, 2012 02:39
Living with Ruby

Setup to Install Gems Locally Only

You should never have to use 'sudo gem install', but the trick to doing that is to add the following to your .bash_profile:

https://gist.github.com/217895

export GEM_PATH="$HOME/.gem/ruby/1.8"
export GEM_HOME="$HOME/.gem/ruby/1.8"
export PATH="$HOME/.gem/ruby/1.8/bin:$PATH"
@pxr
pxr / gist:3335561
Created August 12, 2012 23:58
Quick AFNetworking Test Code
NSURL *url = [NSURL URLWithString:@"http://api.domaintools.com/v1/domaintools.com/whois/"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"response.registration: %@ response.whois: %@", [JSON valueForKeyPath:@"response.registration"], [JSON valueForKeyPath:@"response.whois"]);
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id something) { NSLog(@"ERROR: %@", error); } ];
[operation start];
@pxr
pxr / gist:3331736
Created August 12, 2012 13:02
Output curl results in prettified JSON
curl blah blah | python -mjson.tool
gem: -n/usr/local/bin