Skip to content

Instantly share code, notes, and snippets.

Rob Hurring robhurring

Block or report user

Report or block robhurring

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View search_terms.rb
# Search term parser from https://gist.github.com/1477730
# Modified to allow periods (and other non-letter chars) in unquoted field values
# and field names.
#
# Helper class to help parse out more advanced saerch terms
# from a form query
#
# Note: all hash keys are downcased, so ID:10 == {'id' => 10}
# you can also access all keys with methods e.g.: terms.id = terms['id'] = 10
# this doesn't work with query as thats reserved for the left-over pieces
@robhurring
robhurring / geolookup.js
Created Oct 8, 2014
Geolocation zip code lookup using google maps and angular. (Demo: http://jsfiddle.net/robhurring/kL50yeek/)
View geolookup.js
(function(angular) {
'use strict';
var app = angular.module('MyApp', []);
app.factory('GeolocationSvc', [
'$q', '$window',
function($q, $window) {
return function() {
var deferred = $q.defer();
@robhurring
robhurring / shBrushRuby.js
Created Jul 17, 2009
GitHub style syntax highlighter theme
View shBrushRuby.js
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
*
* @version
* 2.0.320 (May 03 2009)
*
@robhurring
robhurring / Rakefile
Created Dec 7, 2010
Delayed Job with Sinatra -- without sinatra specific gems, etc.
View Rakefile
task :environment do
require './dj-sinatra'
end
namespace :jobs do
desc "Clear the delayed_job queue."
task :clear => :environment do
Delayed::Job.delete_all
end
@robhurring
robhurring / fb-token-refresh
Created Jun 15, 2016
long lived facebook access token
View fb-token-refresh
#!/usr/bin/env sh
# Turn a short-lived access token into a long(er) lived access token.
# To use this you must first generate a short-lived access token using the
# graph API (https://developers.facebook.com/tools/explorer/)
#
# NOTE: make sure you select your app under the "Application" dropdown. if you
# don't you will see an error from this saying something about your app and
# not having permission/access
#
@robhurring
robhurring / app.rb
Created Nov 23, 2010
ActiveRecord query caching with Sinatra
View app.rb
# ActiveRecord refuses to enable query caching _unless_ you have the following setup
# 1) you _must_ use ActiveRecord::Base.configurations to store your auth details
# 2) you _must_ include the ActiveRecord::QueryCache middleware
# 3) you _must_ inherit from the _Base_ connection -- abstract models don't
# cache without a bit of hacking, it only query caches anything from AR::Base
require 'sinatra'
require 'active_record'
# query caching requires that you use AR::Base.configurations to store your
@robhurring
robhurring / events_dispatcher.coffee
Created Oct 22, 2012
Simple bind/trigger mixin for javascript object
View events_dispatcher.coffee
# this: https://gist.github.com/464257 in coffeescript, without the global stuff...
class EventsDispatcher
callbacks: {}
bind: (event_name, callback) ->
@callbacks[event_name] ||= []
@callbacks[event_name].push callback
@
trigger: (event_name, data) ->
@robhurring
robhurring / main.rb
Last active Jul 12, 2016
Lightweight actors in ruby
View main.rb
require 'thread'
module Actor
class << self
def included(base)
base.extend(ClassMethods)
end
def current
Thread.current[:actor]
View keybase.md

Keybase proof

I hereby claim:

  • I am robhurring on github.
  • I am robh (https://keybase.io/robh) on keybase.
  • I have a public key whose fingerprint is 433D 3918 FF86 850F 4293 9BB4 9957 F49F 5C33 DE2A

To claim this, I am signing this object:

@robhurring
robhurring / README.md
Last active Mar 3, 2016
Angular geolocation wrapper service
View README.md
You can’t perform that action at this time.