Skip to content

Instantly share code, notes, and snippets.

def interests_text
interests = []
interests << 'Design' if 'design'
interests << 'Web Development' if 'web'
interests << 'Mobile Development' if 'mobile'
interests << 'Strategy' if 'strategy'
interests << 'Products' if 'products'
interests << 'Other' if 'other'
interests
end
Beautiful code is the balanced application of Proportion, Integrity, and Clarity.
Proportion
/\
/ \ [ each are necessary ]
/ \ [ none are sufficient ]
/______\
Integrity Clarity
Proportion: The smallest size needed to do the job. Economy of size and the ratio of pairs.

1. Achievement

Definition: A virtual or physical representation of having accomplished something. These are often viewed as rewards in and of themselves.

Example: a badge, a level, a reward, points, really anything defined as a reward can be a reward.

2. Appointment Dynamic

Definition: A dynamic in which to succeed, one must return at a predefined time to take some action. Appointment dynamics are often deeply related to interval based reward schedules or avoidance dyanmics.

def balance
return 0 if transactions.empty?
transactions.realized.reverse.last.balance
end
@adambair
adambair / gist:1299611
Created October 19, 2011 20:46
pry is awesome.
# use instead of rails console
pry -r ./config/environment.rb
# for debugging in code put this anywhere:
binding.pry
# then check your console (rails server window) and type:
help
# win
@adambair
adambair / Global Search and Replace in Vim
Created October 19, 2011 21:18
Global Search and Replace in Vim
# populate the arglist
:args app/*/*
# then use argdo <cmd>
:argdo %s/:notice/:success/gec
# the % is for the entire file
# the g is for global line substitution
# the e is to ignore errors
# the c is to confirm each substitution
def fake_select(parameter, collection, description="", preposition="")
html = "<div class='fake_select'>"
unless params[parameter].blank?
html << "<a class='first_option'>#{preposition} #{params[parameter]} #{description}</a>"
else
html << "<a class='first_option'>#{preposition} #{collection.first} #{description}</a>"
end
html << "<ul class='fake_list'>"
collection.each do |item|
html << content_tag(:li) do
# Yourinal; Your Terminal
#
# A collection tools and utilities for your terminal needs
#
# Name credit goes to Jim Albano (@JimDAlbano).
# I was going to call it Coctane; Console Octane.
# Yourinal; Your Terminal - is far better.
#
# Backup name via Flip Sasser (@flipsasser): PimpMyConsole
#
@adambair
adambair / gist:1319793
Created October 27, 2011 15:00
Learning Rails
# Rails Core
-Text, Reference
http://guides.rubyonrails.org/
http://api.rubyonrails.org/
# Rails for Zombies
- Paid, Interactive, Videos
http://www.codeschool.com/courses/rails-for-zombies
<div id="primary_nav" class="clearfix">
<ul class="clearfix">
<li class="first"><a href="http://intridea.com/services">Services</a></li>
<li class=""><a href="http://intridea.com/products">Products</a></li>
<li class=""><a href="http://intridea.com/portfolio">Portfolio</a></li>
<li class=""><a href="http://intridea.com/blog">Blog</a></li>
<li class="last"><a href="http://intridea.com/about">About</a></li>
</ul>
</div> <!-- / #primary_nav -->