Skip to content

Instantly share code, notes, and snippets.

View stevenheidel's full-sized avatar

Steven Heidel stevenheidel

View GitHub Profile
@stevenheidel
stevenheidel / aronson.rb
Created November 3, 2010 23:45
Calculate the aronson numbers
# Works from 1 - 999
# Recursively convert to cardinal numbers
def cardinal(num)
case num
when 0 then return ""
when 1 then return "one"
when 2 then return "two"
when 3 then return "three"
when 4 then return "four"
when 5 then return "five"
def show
render :json => {:taken => username_taken(params[:username])}
end
def username_taken(username)
user = User.where("username = ?", username).first
if user.present?
return true
@stevenheidel
stevenheidel / Steven's Redcar Output
Created November 16, 2010 07:11
Rake output from github.com/redcar/redcar
steven@steven-laptop ~/code/redcar $ jruby -S rake
(in /home/steven/code/redcar)
/home/steven/code/redcar/Rakefile:145 warning: already initialized constant Spec
jruby -S spec -c plugins/edit_view/spec/edit_view/document_spec.rb plugins/todo_list/spec/todo_list/file_parser_spec.rb plugins/declarations/spec/declarations/file_spec.rb plugins/runnables/spec/runnables/output_processor_spec.rb plugins/application/spec/application/treebook_spec.rb plugins/application/spec/application/application_spec.rb plugins/application/spec/application/menu_spec.rb plugins/application/spec/application/command_spec.rb plugins/application/spec/application/notebook_spec.rb plugins/application/spec/application/clipboard_spec.rb plugins/application/spec/application/speedbar_spec.rb plugins/application/spec/application/sensitive_spec.rb plugins/application/spec/application/window_spec.rb plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb plugins/repl/spec/repl/groovy_mirror_spec.rb plugins/repl/spec/repl/ruby_mirror_spec.
@stevenheidel
stevenheidel / objectstorows.rb
Created November 16, 2010 21:04
11 Objects to Rows or something for Hubble
objects = [A, B, C, D, E, F, G, H, I...] # your objects
table = []
(objects.length - 1).times do |i|
table << objects[i, 2]
end
@stevenheidel
stevenheidel / Discussion about Base
Created December 21, 2010 19:07
Core team's discussion about base/
Amanda I'm slightly confused by Refinery having both base and core
Philip THAT IS STEVEN
:P
http://github.com/resolve/refinerycms/wiki…
I use caps when I don't mean to yell
Amanda also, I can never find the code that happens when you generate a new app, but that's probably because I'm forgetful
Steven Heidel: I see you are the source of my pain
Philip bin/refinerycms
core/lib/generators/
Steven Heidel: I bet you hear that from all the girls
@stevenheidel
stevenheidel / RefineryCMS 0.9.9.1 Cucumber Output
Created February 14, 2011 04:38
RefineryCMS 0.9.9.1 Cucumber Output
/home/steven/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -S bundle exec rspec /home/steven/.rvm/gems/ruby-1.9.2-p136/gems/refinerycms-settings-0.9.9.1/spec/models/refinery_setting_spec.rb /home/steven/.rvm/gems/ruby-1.9.2-p136/gems/refinerycms-core-0.9.9.1/spec/lib/refinery/plugins_spec.rb /home/steven/.rvm/gems/ruby-1.9.2-p136/gems/refinerycms-authentication-0.9.9.1/spec/models/user_spec.rb /home/steven/.rvm/gems/ruby-1.9.2-p136/gems/refinerycms-images-0.9.9.1/spec/models/image_spec.rb /home/steven/.rvm/gems/ruby-1.9.2-p136/gems/refinerycms-pages-0.9.9.1/spec/models/page_spec.rb /home/steven/.rvm/gems/ruby-1.9.2-p136/gems/refinerycms-resources-0.9.9.1/spec/models/resource_spec.rb
...........................FF.................................................
Failures:
1) User validations requires username
Failure/Error: User.new(@attr.merge(:username => "")).should_not be_valid
Psych::SyntaxError:
couldn't parse YAML at line 23 column 15
# /home/steven/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1
@stevenheidel
stevenheidel / gist:5379948
Created April 13, 2013 20:27
Nick and Mike Instructions
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew update
brew install git
git config --global user.name "{Your full name, ie. Steven Heidel}"
git config --global user.email "{Email you used to sign up for Github}"
git config --global credential.helper osxkeychain
require 'spec_helper'
describe 'foo' do
let(:concert) { FactoryGirl.create :concert } # Creates a concert with name 'default'
before do
Foo.bar(concert.id)
end
describe '.bar' do
@stevenheidel
stevenheidel / pyenv.sh
Last active March 3, 2020 03:47
Using pyenv
# INSTALLATION
# Step 1: Install pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# This will output some instructions to add a few lines to
# your ~/.bash_profile file. Once you've done that
# then open a new terminal window to continue.
# Step 2: Install some versions of Python
# This will take a few minutes
List<String> getSearchResults(...) {
try {
List<String> results = // make REST call to search service
return results;
} catch (RemoteInvocationException e) {
return Collections.emptyList();
}
}