Skip to content

Instantly share code, notes, and snippets.

🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
View GitHub Profile
@itspriddle
itspriddle / keybase.md
Created Aug 28, 2019
Keybase proof for itspriddle (Regenerated 2019-08-28 1:00:00 -4:00)
View keybase.md

Keybase proof

I hereby claim:

  • I am itspriddle on github.
  • I am itspriddle (https://keybase.io/itspriddle) on keybase.
  • I have a public key whose fingerprint is A777 4AFA 7584 8144 6211 272F 9855 8247 A164 48FA

To claim this, I am signing this object:

View Generate Password.rb
#!/usr/bin/env ruby
# Generates a random password using keepass-password-generator
# Imported from https://github.com/johnbintz/keepass-password-generator
require 'securerandom'
require 'set'
View Copy UUID to clipboard.scpt
#!/usr/bin/env osascript
-- Copy a UUID to the clipboard
set the clipboard to do shell script "uuidgen | tr -d '\n'"
View factory_girl_profiler.rb
# Run tests with `PROFILE_FG=1 [rake|rspec]` to profile FactoryGirl
#
# Example output:
#
# **Class** | **create** | **build** | **attributes_for**
# --------- | ---------- | --------- | ------------------
# **Total** | **11** | **0** | **0**
# Post | 5 | 0 | 0
# Author | 3 | 0 | 0
# User | 3 | 0 | 0
@itspriddle
itspriddle / irbrc.rb
Created Jan 14, 2014
Fixes an issue with AwesomePrint and ActiveRecord 3 abstract models (https://github.com/michaeldv/awesome_print/pull/147). Drop it in `~/.irbrc`
View irbrc.rb
# Work around for https://github.com/michaeldv/awesome_print/pull/147
AwesomePrint::ActiveRecord.send :include, Module.new {
def awesome_active_record_class_with_fix(object)
return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class?
super(object)
end
def self.included(base)
base.class_eval do
alias_method :awesome_active_record_class_without_fix, :awesome_active_record_class
View bitmask.rb
class Bitmask
ACTIONS = %W(create read update destroy)
def self.dump(actions)
(actions & ACTIONS).sum { |a| 1 << ACTIONS.index(a) }
end
def self.load(mask)
ACTIONS.reject { |a| ((mask || 0) & 1 << ACTIONS.index(a)).zero? }
end
View test.markdown

Hi

This is a test

class Josh
  def name; :name; end
end
@itspriddle
itspriddle / setup-git-bundler-merge-driver
Last active Aug 13, 2018
This script makes git automatically run `bundle install` when a merge conflict with Gemfile.lock occurs. Run it once per project to setup `.gitattributes` and `.gitconfig`
View setup-git-bundler-merge-driver
#!/usr/bin/env bash
# Usage: setup-git-bundler-merge-driver
# Help: Configures git to use a custom merge driver to resolve Gemfile.lock
# merge conflicts.
if [ ! -f Gemfile ]; then
echo 'No `Gemfile` found! Aborting'
exit 1
fi
@itspriddle
itspriddle / gist:5406628
Created Apr 17, 2013
Installing PHPUnit via PEAR on OS X Mountain Lion
View gist:5406628
wget http://pear.php.net/go-pear.phar
php -d detect_unicode=0 go-pear.phar
export PATH=$HOME/pear/bin
pear config-set auto_discover 1
pear install --alldeps pear.phpunit.de/PHPUnit
pear install phpunit/dbUnit phpunit/PHPUnit_Selenium phpunit/PHPUnit_Story
You can’t perform that action at this time.