Skip to content

Instantly share code, notes, and snippets.

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
access_token = ARGV[0]
derekprior / form_object.rb
Last active Jan 7, 2021
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
# This would give you
# * email, password, zip attrs
derekprior / enable_paste.js
Created Aug 8, 2012
Some websites, such as 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 / _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
= f.label :holidays
= f.simple_fields_for :holidays do |holiday|
= render 'holiday_fields', f: holiday
= link_to_add_association t('actions.add',
:model => Holiday.model_name.human.titleize), f, :holidays
derekprior /
Created Jul 28, 2011
A list of all picks from the Ruby Rogues podcast in one convenient location