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
robhurring / datepicker.js
Last active Aug 29, 2015
angular pikaday
View datepicker.js
/* global angular, Ladda */
(function(module, $) {
'use strict';
module.directive('datepicker', function() {
return {
link: function postLink(scope, element, attrs) {
var today = new Date();
var minYear = 1900;
var maxYear = today.getFullYear();
robhurring / application.html.erb
Last active Aug 29, 2015
Capybara + Angular.js wait_for_ajax
View application.html.erb
<!DOCTYPE html>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<%= stylesheet_link_tag "application", media: "all" %>
<%= csrf_meta_tags %>
<body class="container">
robhurring / feature_helpers.rb
Last active Jan 21, 2016
Capybara + Angular.js wait_for_ajax
View feature_helpers.rb
require 'selenium-webdriver'
module FeatureHelpers
Capybara.register_driver :poltergeist_debug do |app|,
inspector: true,
js_errors: true,
set -e # works without this
set -x # debug
source "$HOME/.rvm/scripts/rvm" #so 'cd' will change gemset when dotfiles present
rm -rf ~/tmp/dir_with_gemfile
mkdir -p ~/tmp/dir_with_gemfile
robhurring / usage.html
Created Oct 9, 2014
Custom form validators with angular
View usage.html
<form name="form">
<small class="error" ng-show="form.password.$invalid">
View battery-status.rb
#!/usr/bin/env ruby
require 'optparse'
class Battery
def self.status
_, percent, status, remaining, _ = %x{pmset -g batt|grep InternalBattery}.split(/\t|;/).map(&:strip)
percent.gsub!(/%/, '')
remaining.gsub!(/[\(\)]/, '')
View .zshrc
# set the finddir lookup PATH
export DEFAULT_SEARCH_PATHS="~/Sites/apps:~/Sites/gems:~/Projects"
# use `finddir` to fuzzy lookup directories
function cds {
local search=$1;
local found=$(noglob finddir $search)
if [ $? -eq 0 ]; then
cd $found
robhurring / git-fuzzy-checkout
Created Oct 8, 2014
Fuzzy git checkout. With super awesome branch selection!
View git-fuzzy-checkout
#!/usr/bin/env ruby
require 'optparse'
module CLI
black: "\e[30;1m",
red: "\e[31m",
green: "\e[32m",
blue: "\e[34m",
white: "\e[37m",
robhurring / geolookup.js
Created Oct 8, 2014
Geolocation zip code lookup using google maps and angular. (Demo:
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 / app.js
Last active Aug 29, 2015
Rails status symbols in javascript (for angular)
View app.js
/* global angular */
(function(module) {
'use strict';['$rootScope', '$state', 'Rails',
function($rootScope, $state, Rails) {
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
switch(error.status) {
// or Rails.status.not_found.code (if using the version with descriptions)
case Rails.status.not_found.:
You can’t perform that action at this time.