Skip to content

Instantly share code, notes, and snippets.

View bkenny's full-sized avatar
💭
Shipping Products

Brian Kenny bkenny

💭
Shipping Products
View GitHub Profile
@bkenny
bkenny / simple-url.html
Created August 5, 2011 10:12
Simple URL'ing
<div id="info-content">
<div id="info-bubble">
<%= auto_link(simple_format(@event.info)) %>
</div>
</div>
@bkenny
bkenny / gist:1446749
Created December 8, 2011 11:20
Blacknight
<script>
var intercomSettings = {
app_id: '4f13azhy',
email: 'user_email',
created_at: unixtimestamp_of_when_user_signed_up
};
(function() {
function async_load() {
var s = document.createElement('script');
s.type = 'text/javascript'; s.async = true;
@bkenny
bkenny / gist:1501349
Created December 20, 2011 12:00
UILocalNotification
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Date Formatter to dd/MM/yyyy
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd/MM/yy"];
NSDateFormatter *dateFormatterWithTime = [[NSDateFormatter alloc] init];
[dateFormatterWithTime setDateFormat:@"dd/MM/yy HH:mm"];
// Instantiate some dates, fool.
@bkenny
bkenny / gist:1585343
Created January 9, 2012 22:30
Twitter iOS Native
// Don't forget to include Twitter/Twitter.h into your implementation for this to work!
// Both amountSavedString and numDaysString are simple strings containing... well what they say.
NSString *tweet = [NSString stringWithFormat:@"I've saved %@ by not smoking for %@ with @getkickit", amountSavedString, numDaysString];
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter setInitialText:tweet];
if([TWTweetComposeViewController canSendTweet])
def results
@venues = Hashie::Mash.new(client.search_venues(:ll => coords, :query => @venue))
# Checking the imagery
@venues.groups.first.items.each do |check|
@threads = []
@threads << image_check(check.id)
end
end
# Working progress.
@bkenny
bkenny / controller.rb
Created March 14, 2012 18:18
Threading API Calls
#
# Short example on threaded API calls
#
# This code snippet is from spots.io and how it threads API calls to lookup whether a foursqaure location has
# Instagram photos or not.
#
# Create an sexual empty array
location_threads = []
@bkenny
bkenny / hack.sh
Created April 4, 2012 13:28 — forked from davidjrice/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@bkenny
bkenny / cro.rb
Created April 29, 2012 15:39
CRO API Services
# CRO API Access by @bkenny
#
# Example, to search for a company use: CRO.new(email_address, api_key).companies("Starbucks")
# To search for a companies submissions: CRO.new(email_address, api_key).submissions("315499", "c")
require 'rubygems'
require 'httparty'
require 'hashie'
class CRO
@bkenny
bkenny / mongoimport.rb
Created May 14, 2012 14:48
Import MiniCorp Blog into Mongo DB
require 'rubygems'
require 'mongo'
require 'net/http'
require 'active_support/core_ext'
require 'crack'
require 'uri'
require 'hashie'
def convert(feed)
db = Mongo::Connection.new.db("blogs")
@bkenny
bkenny / messing.rb
Created July 9, 2012 11:41
Foursquare API
require 'json'
require 'httparty'
require 'geocoder'
require 'foursquare2'
require 'hashie'
@@client = Foursquare2::Client.new(:client_id => 'PQPTTYWDIXOYHUYJMO0UX30W1VI0Q3IHXC314QSA50VMZDNB', :client_secret => 'AIUV3COEJRQOMDUQXEFXN0X5LPRSEP1P43TLNMN00RQ30U4H')
def show_subcategories