Skip to content

Instantly share code, notes, and snippets.

Derek Prior derekprior

Block or report user

Report or block derekprior

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
@derekprior
derekprior / zeroxer.rb
Last active Aug 29, 2015
Remove tenxer repository hooks from your organization's repositories. Requires octokit gem.
View zeroxer.rb
#!/usr/bin/env ruby
require "octokit"
if (ARGV.length < 1)
puts "You must supply a GitHub access token"
exit 1
end
access_token = ARGV[0]
@derekprior
derekprior / form_object.rb
Last active Aug 29, 2015
An idea for a a basic form object that is for aggregating data on several models
View form_object.rb
class Registration < AggregateForm
component :user, :email, :password
component :profile, :zip
validate_components :promote_errors
validate # whatever else you want
end
# This would give you
# * email, password, zip attrs
@derekprior
derekprior / enable_paste.js
Created Aug 8, 2012
Some websites, such as appleid.apple.com think its a good idea to disallow pasting into password fields. If you use a password manager, this can cause a giant pane. Run the following JavaScript in the inspector to disable this silliness.
View enable_paste.js
var inputs = document.getElementsByTagName('input');
for (var i=0; i < inputs.length; i++) {
if (inputs[i].getAttribute('type').toLowerCase() === 'password') {
inputs[i].setAttribute('onpaste', '');
}
}
@derekprior
derekprior / _form.html.haml
Created Feb 11, 2012
Multiple Inline Inputs with Simple Form
View _form.html.haml
= simple_form_for [:admin, @holiday_schedule] do |f|
= render 'error_messages', target: @holiday_schedule, f: f if @holiday_schedule.errors.any?
= f.input :name
.control-group
= f.label :holidays
= f.simple_fields_for :holidays do |holiday|
= render 'holiday_fields', f: holiday
.nested-fields-link
= link_to_add_association t('actions.add',
:model => Holiday.model_name.human.titleize), f, :holidays
@derekprior
derekprior / ruby_rogues_picks.md
Created Jul 28, 2011
A list of all picks from the Ruby Rogues podcast in one convenient location
You can’t perform that action at this time.