Skip to content

Instantly share code, notes, and snippets.

Avatar

Noah Hendrix noahhendrix

View GitHub Profile
View filterable.rb
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 Dec 26, 2015
Alternative to RubyTapas #144
View bulk.rb
require 'securerandom'
codes = Array.new(200) { SecureRandom.hex(8) } # => ["de988ab34e9ac058", "423198812a0152ad", … ]
View README.md

Apps

  1. Dropbox
  2. 1Password
  3. Alfred
View 2014-oscar-predictions.md

✗ 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 Dec 13, 2012
Just playing around with call (from RubyTapas #35)
View call.rb
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 Oct 25, 2012
How to Sync RubyTapas with Podcasts
View recipe.md
  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)

View octokit.rb
Octokit.configure do |c|
c.api_endpoint = 'https://github.company.com/api/v3'
c.web_endpoint = 'https://github.company.com/'
end
@noahhendrix
noahhendrix / Gemfile
Created Mar 25, 2012 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
View Gemfile
source :rubygems
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'coffee-script'
@noahhendrix
noahhendrix / date.js
Created Mar 12, 2012
Sensible additions to the JS date object
View date.js
Date.prototype.get12Hours = function() {
return this.getHours() % 12 || 12;
};
Date.prototype.getMeridanIndicator = function() {
return this.getHours() >= 12 ? 'PM' : 'AM';
};