Skip to content

Instantly share code, notes, and snippets.

@bruschill
bruschill / vim_presentation.rb
Created September 18, 2012 15:21
irb text editor brawl
# n: Brandon Ruschill
# c: github.com/bruschill
# t: @bruschill
# BASICS (command mode)
# never ever use the arrow keys. ever
#
# k
# h l
# j
def vim_gist
1
end
#regenerate conf
bundle exec rake ts:conf
#rebuild indexes
bundle exec rake ts:rebuild
factory :user_with_tasks, :parent => :base_user do |user|
user.after(:create) do |u|
u.tasks = FactoryGirl.create(:task, :user => u)
end
end
<a class="tf_upfront_badge" href="http://www.thefind.com/store/about-goodsmiths" title="TheFind Upfront" style="text-decoration:none;"><b>Goodsmiths</b> is <u>Upfront</u></a>
<script type="text/javascript">
(function() {
var upfront = document.createElement('SCRIPT'); upfront.type = "text/javascript"; upfront.async = true;
upfront.src = document.location.protocol + "//upfront.thefind.com/scripts/main/utils-init-ajaxlib/upfront-badgeinit.js";
upfront.text = "thefind.upfront.init('tf_upfront_badge', '089a0f679a709de734d408d2bb3073b6')";
document.getElementsByTagName('HEAD')[0].appendChild(upfront);
})();
</script>
# Load DSL and Setup Up Stages
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/bundler'
require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
@bruschill
bruschill / app.js
Created February 19, 2014 01:15
Angular todo app with list management
'use strict';
var rpgtd = angular.module('rpgtd', []);
@bruschill
bruschill / dwolla_pin.rb
Last active September 15, 2015 06:33
Dwolla pin encryption in Ruby
module Dwolla
class Pin
def self.decrypt(pin, iv)
return nil unless pin.present? && iv.present?
decipher = OpenSSL::Cipher::AES256.new(:CBC)
decipher.decrypt
decipher.key = Rails.application.secrets.secret_key_base
# convert iv from utf-8 back to ascii-8bit
@bruschill
bruschill / testing_scenarios.rb
Last active August 29, 2015 14:15
Testing Scenarios
#### TESTING SCENARIOS
### GENERAL
# When it comes to testing you'll want to write tests
# for every outcome of anything (method call, object instantiation,
# redirect, etc.) to verify that what you expect to happen actually happens,
# regardless of how rarely you think it may happen.
#
# Ultimately what this boils down to is testing:
# - every condition of a conditional (if/else, case, etc.)
# - method
#!/usr/bin/env ruby
puts ((Dir.glob(File.join('/', '**', '*')).select{|file| File.file?(file)}.count) % 5) + 1