Skip to content

Instantly share code, notes, and snippets.

@nelsonenzo
nelsonenzo / Ruby Dev Enironment Setup
Created February 13, 2011 08:14
trials and tribulations of setting up a new ruby/rails env
xcode (~4gb, 2+ hour download, 20 minute install )
macports - http://www.macports.org/install.php
imagemagick - using install statement from rmagick: http://rmagick.rubyforge.org/install-osx.html
sudo port install tiff -macosx imagemagick +q8 +gs +wmf
can take over 2 hours to install !!!!
git - http://code.google.com/p/git-osx-installer/downloads/list?can=3 (selected *x86_64-leopard.dmg)
You can pass local variables to sub templates by using a hash with the variable names as keys and the objects as values:
<%= render "shared/header", { :headline => "Welcome", :person => person } %>
These can now be accessed in shared/header with:
Headline: <%= headline %>
First name: <%= person.first_name %>
If you need to find out whether a certain local variable has been assigned a value in a particular render call, you need to use the following pattern:
@nelsonenzo
nelsonenzo / abcss.rb
Created April 29, 2011 02:40
abCSS Framework Generator
styles = [
{:namespace => "mt", :attribute => "margin-top", :suffix => "px", :max => 500, :min => 0, :step => 1},
{:namespace => "mb", :attribute => "margin-bottom", :suffix => "px", :max => 500, :min => 0, :step => 1},
{:namespace => "ml", :attribute => "margin-left", :suffix => "px" , :max => 500, :min => 0, :step => 1},
{:namespace => "mr", :attribute => "margin-right", :suffix => "px" , :max => 500, :min => 0, :step => 1},
{:namespace => "w", :attribute => "width", :suffix => "px", :max => 1200, :min => 0, :step => 1},
{:namespace => "wp", :attribute => "width", :suffix => "%", :max => 100, :min => 0, :step => 1},
{:namespace => "h", :attribute => "height", :suffix => "px", :max => 500, :min => 0, :step => 1},
{:namespace => "fs", :attribute => "font-size", :suffix => "px", :max => 48, :min => 0, :step => 1},
{:namespace => "p", :attribute => "padding", :suffix =>"px", :max => 40, :min => 0, :step => 1},
@nelsonenzo
nelsonenzo / rvm_notes.txt
Created April 29, 2011 06:20
RVM Notes (Ruby Version Manager)
RVM Notes
Install a new version of ruby:
$ rvm install 1.9.2
use that version:
$ rvm use 1.9.2
check the version of ruby being used
$ ruby -v
@nelsonenzo
nelsonenzo / Git Version Control Notes
Created May 22, 2011 20:52
Git Version Control Notes
For SSH issues, check here for help:
http://help.github.com/troubleshooting-ssh/
test definition can be written as such
test "that a new user has a valid name" do
#some test stuff
end
You would use ActiveSupport::TestCase as the parent class of any of your Rails tests.
Inside a Test, you are generally trying to do 4 things:
1) Set up the data.
2) Perform the action that triggers the behavior being tested (i.e. - call to a controller method or call to a model method).
@nelsonenzo
nelsonenzo / bundles
Created June 17, 2011 18:22
TextMate
#Go To File Bundle. You might need to create the /Bundles directory before you can cd into it.
cd ~/Library/Application\ Support/TextMate/Bundles/
git clone git://github.com/amiel/gotofile.tmbundle.git GoToFile.tmbundle
#after that, you will want to add some file types that ack wont search by default
#source: https://github.com/protocool/ack-tmbundle/wiki/recognizing-files
#in terminal, create ~/.ackrc
--type-add=ruby=.haml,.rake,.rsel
#or, alternately, specify to search all files
@nelsonenzo
nelsonenzo / python stuff
Created August 25, 2011 23:19
python stuff
navigate to a directory in terminal and type
python -m SimpleHTTPServer
that will start a simple server on 0.0.0.0:8000
(or what I named in my /etc/hosts file, dev.python.com:8000 )
$ rails generate refinery_engine singular_model_name attribute:type [attribute:type ...]
note: to see all the options supported by the refinery_engine generator just run rails g refinery_engine
field type description
text a multiline visual editor
resource a link which pops open a dialog which allows the user to select an existing file or upload a new one
image a link which pops open a dialog which allows the user to select an existing image or upload a new one
string and integer a standard single line text input
@nelsonenzo
nelsonenzo / jqueryTools_fix.html
Created October 1, 2011 23:47
JQuery Tools Fix
First include JQuery tools:
<script src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js"></script>
Then rename all it's functions
<script>
$.fn.jqt_tabs = $.fn.tabs;
$.fn.jqt_scrollable = $.fn.scrollable;
$.fn.jqt_tooltip = $.fn.tooltip;
$.fn.jqt_overlay = $.fn.overlay;