Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View derekprior's full-sized avatar

Derek Prior derekprior

View GitHub Profile
@derekprior
derekprior / zeroxer.rb
Last active August 29, 2015 14:08
Remove tenxer repository hooks from your organization's repositories. Requires octokit gem.
#!/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 / enable_paste.js
Created August 8, 2012 14:31
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.
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 / ruby_rogues_picks.md
Created July 28, 2011 20:56
A list of all picks from the Ruby Rogues podcast in one convenient location
@derekprior
derekprior / _form.html.haml
Created February 11, 2012 20:54
Multiple Inline Inputs with Simple Form
= 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 / form_object.rb
Last active January 7, 2021 00:31
An idea for a a basic form object that is for aggregating data on several models
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