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 / gmaps_autocomplete.html
Created December 18, 2012 14:03
Google Maps V3 Autocomplete Field
<!DOCTYPE html>
<html>
<head>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<script>
function initialize() {
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input);
}
google.maps.event.addDomListener(window, 'load', initialize);
Processing by ViewsController#image as */*
Processing by ViewsController#image as HTML
@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
@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 / 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 / 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 / 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 = []
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 / 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])
@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.