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 / 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 / fb-token-refresh
Created June 15, 2016 17:45
long lived facebook access token
#!/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 / 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 / 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 / example.rb
Created September 25, 2015 22:00
Ruby decorators
require 'byebug'
require 'benchmark'
require 'timeout'
module Decorator
def decorate(method, &block)
decorator = Module.new do
define_method(method, &block)
end
@robhurring
robhurring / update_content.js
Created July 7, 2015 13:59
AJAX content replace
(function($) {
// scan our ajax response for replaceable content blocks then update the HTML
var updateContent = function(content) {
var $contentKeyElements = $(content).filter('[data-content-key]');
$contentKeyElements.each(function() {
var node = $(this);
var key = node.attr('data-content-key');
$('[data-content-key=' + key + ']').replaceWith(node);
});
@robhurring
robhurring / .eslintrc
Last active August 29, 2015 14:21 — forked from cletusw/.eslintrc
ESLint starter RC file (updated ECMA6 rules)
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"arrowFunctions": false, // enable arrow functions
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"classes": false, // enable classes
"defaultParams": false, // enable default function parameters
"destructuring": false, // enable destructuring
@robhurring
robhurring / Timer.jsx
Last active August 29, 2015 14:21
Timer
class Timer extends React.Component {
constructor(props) {
super(props)
this._interval = null;
this.state = {
ticks: 0
}
}
@robhurring
robhurring / save_tracker.rb
Created April 14, 2015 21:32
RSpec ActiveRecord model save and creation reporting
# ./spec/support/save_tracker.rb
module SaveTracker
extend ActiveSupport::Concern
included do
class_attribute :_save_tracker_
self.reset_save_tracker!
end
module ClassMethods
@robhurring
robhurring / noidea.js
Last active August 29, 2015 14:16
forMatt
var UserSelect = React.createClass({
_changed: function(event) {
var value = this.refs.box.getDOMNode().value;
this.props.onSelect(value);
},
render: function() {
var items = this.props.items.map(function(item) {
return (
<option value={item}>{item}</option>