Skip to content

Instantly share code, notes, and snippets.

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 / 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 / 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]
@robhurring
robhurring / examples.txt
Last active Feb 5, 2016
shortenpath for zsh/bash
View examples.txt
/u/local: pwd b3bb610
/usr/local
~/P/proccli: pwd master da99d97 2↓ ✽
/Users/rob/Projects/proccli
View example.rb
require 'byebug'
require 'benchmark'
require 'timeout'
module Decorator
def decorate(method, &block)
decorator = Module.new do
define_method(method, &block)
end
View update_content.js
(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 Aug 29, 2015 — forked from cletusw/.eslintrc
ESLint starter RC file (updated ECMA6 rules)
View .eslintrc
{
// 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
View Timer.jsx
class Timer extends React.Component {
constructor(props) {
super(props)
this._interval = null;
this.state = {
ticks: 0
}
}
@robhurring
robhurring / save_tracker.rb
Created Apr 14, 2015
RSpec ActiveRecord model save and creation reporting
View save_tracker.rb
# ./spec/support/save_tracker.rb
module SaveTracker
extend ActiveSupport::Concern
included do
class_attribute :_save_tracker_
self.reset_save_tracker!
end
module ClassMethods
View noidea.js
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>
You can’t perform that action at this time.