Skip to content

Instantly share code, notes, and snippets.

View robhurring's full-sized avatar
🍻
cheers

Rob Hurring robhurring

🍻
cheers
View GitHub Profile
@robhurring
robhurring / events_dispatcher.coffee
Created October 22, 2012 20:48
Simple bind/trigger mixin for javascript object
# 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 July 12, 2016 08:12
Lightweight actors in ruby
require 'thread'
module Actor
class << self
def included(base)
base.extend(ClassMethods)
end
def current
Thread.current[:actor]
@robhurring
robhurring / keybase.md
Created July 8, 2016 14:12
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 March 3, 2016 11:58
Angular geolocation wrapper service
@robhurring
robhurring / examples.txt
Last active February 5, 2016 15:14
shortenpath for zsh/bash
/u/local: pwd b3bb610
/usr/local
~/P/proccli: pwd master da99d97 2↓ ✽
/Users/rob/Projects/proccli
@robhurring
robhurring / feature_helpers.rb
Last active January 21, 2016 23:40
Capybara + Angular.js wait_for_ajax
require 'selenium-webdriver'
module FeatureHelpers
DEFAULT_WAIT_TIME = 30
Capybara.register_driver :poltergeist_debug do |app|
Capybara::Poltergeist::Driver.new(app,
inspector: true,
js_errors: true,
timeout: DEFAULT_WAIT_TIME
@robhurring
robhurring / README.md
Last active December 20, 2015 04:49
Angular weather service using openweathermap.org -- not fully tested. (uses gist: https://gist.github.com/robhurring/6074128)
@robhurring
robhurring / .slate
Last active December 15, 2015 16:09
Bootstrap-like grid "framework" for slate window manager.
# add this to your ~/.slate file
# source our grid
source ~/.slate.grid if_exists
# use the grid to position windows
alias left-half move 0;0 ${span-6};${row-12}
alias right-half move ${push-6};0 ${span-6};${row-12}
alias top-left-quarter move 0;0 ${span-6};${row-6}
alias top-right-quarter move ${push-6};0 ${span-6};${row-6}
@robhurring
robhurring / custom_field_names.rb
Created January 2, 2013 17:28
small concern that allows you to override the field names for validation messages
# small concern that allows you to override the field names for validation messages
#
# Example:
#
# # without concern
# class User < ActiveRecord::Base
# validates :name, presence: true
# end
# # => "Name can't be blank"
#
@robhurring
robhurring / fuzzy_date.php
Created February 11, 2010 15:01
PHP fuzzy date function
<?php
function fuzzy_date($timestamp)
{
$myDays = array("Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat");
if( preg_match("/[-\/:]/", $timestamp) )
$timestamp = strtotime($timestamp);
if($timestamp > time())
// All future dates