Skip to content

Instantly share code, notes, and snippets.

Bill Transue billy-ran-away

Block or report user

Report or block billy-ran-away

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
View test.rb
# Before - NoteTextStorage is
# tightly coupled
class NotePresenter
def initialize
@note_storage = NoteTextStorage.new
end
def pending_notes
notes = @note_storage.get_all
notes.select { |n| n.pending? }
end
View node_install.md

Installing Node Version Manager, Node and Yarn

Before you begin you will want to uninstall node and yarn if you already have it

brew uninstall yarn brew uninstall node

and manually remove yarn with

rm -f /usr/local/bin/yarn

View fold.scala
package main.scala
import org.mongodb.scala.bson._
import org.mongodb.scala.bson.collection.mutable.Document
object RecordTransform {
def foldToDocument(results: Document, row: org.apache.spark.sql.Row): Document = {
var month_results = results.get[BsonDocument](row.getInt(0).toString)
var results_doc = month_results match {
case Some(doc) => doc
View readme.md

BACK-END WEB DEVELOPMENT

GeneralAssemb.ly

Install Git, Ruby, and Heroku

Mac Users

View gist:1de4b19af20660f1213b

Generate a new key pair, then add the public key to your ~/.ssh/authorized_keys but with command="/usr/local/bin/tmux a -t pair" before it like below

command="/usr/local/bin/tmux a -t pair" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDMRp0PGmJoycjFN7mJOQx0NcQD76xQrBBAAE6P60tK+3Zvf/gIu/5zvChP05tPT5ecMajxhOKsmtriL5ZRyyzxRja+W3+egZrEPoOAIDxVidX2T1nJpskVAWxqq7G0yueu8n8LrNe8fDUEvOswUzHVnkLp5ybZnQqJkBbZkS/KnQ==

Then you can give the private key to a friend and they'll only be allowed to connect when you have started a new tmux session with: tmux new-session -s pair

View gist:5687587
LeadGeneration::Lead.stub(:scrape_contact_from) do |email, attributes={}|
FactoryGirl.build :contact, attributes
end
View collect_if.rb
module Enumerable
def collect_if
collect { |e| yield e }.reject &:nil
end
end
View processor_job_spec.rb
shared_examples_for 'a contact' do |options={}|
it { should be_a(Contact) }
its(:first_name) { should ==(first_name) }
its(:last_name) { should ==(last_name) }
its(:email) { should ==(email) }
unless options[:except_a_phone_number]
it "should scrape the phone number" do
subject.extended_contact_data_attributes[:phone_numbers].first[:value].should ==(phone_number)
end
@billy-ran-away
billy-ran-away / .bash_profile
Created Feb 15, 2013
.bash_profile to override read-only TMOUT variable
View .bash_profile
if [ ! -z "$TMOUT" ]; then
env -i bash --init-file ~/.bash_profile
fi
# .bash_profile
export SHELL='/bin/bash'
export HOME='/home/bill.transue'
# git bash prompt
export PS1='\u@\h:\W$(__git_ps1 " (\[\033[32m\]%s\[\033[m\])")$ '
View a_break.rb
def collect_options_for_select(collection, selected=nil, &block)
options_for_select collection.collect { |member| block.call member }, selected
end
def elevations_for_sub_component_select(sub_component)
collect_options_for_select sub_component.component.send(sub_component.class.name.underscore.pluralize).find_all_by_model_id(sub_component.model_id), url_for do |sub_component|
if sub_component.is_a? SubComponentTemplate
[ sub_component.location, edit_admin_component_sub_component_path(sub_component.component, sub_component) ]
else
[ sub_component.location, edit_component_sub_component_path(sub_component.component, sub_component) ]
You can’t perform that action at this time.