Skip to content

Instantly share code, notes, and snippets.

View noahhendrix's full-sized avatar

Noah Hendrix noahhendrix

View GitHub Profile
module Filterable
extend ActiveSupport::Concern
module ClassMethods
def filter(filtering_params)
filtering_params.reduce(self) do |relation, (scope_name, value)|
relation.public_send(scope_name, value) if value.present?
end
end
end
@noahhendrix
noahhendrix / bulk.rb
Last active December 26, 2015 08:29
Alternative to RubyTapas #144
require 'securerandom'
codes = Array.new(200) { SecureRandom.hex(8) } # => ["de988ab34e9ac058", "423198812a0152ad", … ]
@noahhendrix
noahhendrix / README.md
Created August 22, 2013 01:18
New Computer

Apps

  1. Dropbox
  2. 1Password
  3. Alfred
@noahhendrix
noahhendrix / 2014-oscar-predictions.md
Last active December 14, 2015 03:59
Oscar Predictions

✗ Best Picture

Lincoln

✓ Best Actor in a Leading Role

Daniel Day-Lewis (Lincoln)

✗ Best Actress in a Leading Role

Quvenzhané Wallis (Beasts of the Southern Wild)

✓ Best Director

@noahhendrix
noahhendrix / call.rb
Created December 13, 2012 18:44
Just playing around with call (from RubyTapas #35)
class Content
def initialize(options={})
@notifier = options.fetch(:notifier) {
->(user) { puts "#{user.name}, you won!" }
}
end
def choose_winner
winner = User.new
@notifier.call(winner)
@noahhendrix
noahhendrix / recipe.md
Created October 25, 2012 18:12
How to Sync RubyTapas with Podcasts
  1. Open the iTunes subscription (itpc://rubytapas.dpdcart.com/feed)
  2. Authenticate with your Ruby Tapas username and password
  3. Plug in your device and select it from the Devices menu
  4. Open the Podcasts tab
  5. Enable "Sync Podcasts"
  6. Ensure that RubyTapas is included in the sync list
  7. Press Apply
  8. Enable Wi-Fi syncing to get the episodes without plugging into your computer (optional)

Note: iTunes Syncing only works with the Podcasts app (https://itunes.apple.com/us/app/podcasts/id525463029?mt=8)

Octokit.configure do |c|
c.api_endpoint = 'https://github.company.com/api/v3'
c.web_endpoint = 'https://github.company.com/'
end
@noahhendrix
noahhendrix / .agignore
Last active February 28, 2017 21:59
dotfiles
log
tags
tmp
@noahhendrix
noahhendrix / Gemfile
Created March 25, 2012 02:24 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source :rubygems
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'coffee-script'
@noahhendrix
noahhendrix / date.js
Created March 12, 2012 05:06
Sensible additions to the JS date object
Date.prototype.get12Hours = function() {
return this.getHours() % 12 || 12;
};
Date.prototype.getMeridanIndicator = function() {
return this.getHours() >= 12 ? 'PM' : 'AM';
};