Skip to content

Instantly share code, notes, and snippets.

View lodestone's full-sized avatar
:octocat:
🤘Grokking Out 🤘

Matt Petty lodestone

:octocat:
🤘Grokking Out 🤘
View GitHub Profile
def advisor
@license = 'LTAM663SPJLO.945CWK-2XOI1X0-7L'
advisor = Advisor.find(params[:id])
category = params[:category]
case category
when 'fixed'
chart_years = advisor.fixed_product_years.find_all_by_year(@year_num)
when 'combined'
chart_years = advisor.categorical_years.find_all_by_year(@year_num)
else
## Rails development best practices
# An #RMM alternative, open and collaborative set of development practices we can adhere to.
* Distributed Version Control over relying on the File System
* Business Logic in the Models over being spread throughout the MVC layers
* RESTful Architecture over overloaded controllers
* KISS - Short methods with descriptive names
* Tests/Specs covering each layer of MVC and the whole stack
* Document the setup procedure (freeze dependancies where possible)
#!/bin/bash
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost
yum install -y l gcc-c++ zlib-devel openssl-devel
yum install -y mysql-server mysql-devel
/etc/init.d/mysqld start
yum install -y ruby rdoc ruby-devel
RUBYGEMS="rubygems-1.3.1"
wget http://rubyforge.org/frs/download.php/45905/$RUBYGEMS.tgz
@lodestone
lodestone / gist:103144
Created April 28, 2009 13:21 — forked from c3mediagroup/gist:103143
broken.html.haml
- if RAILS_ENV == "production"
%script{ :type => "text/javascript" }
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
%script{ :type => "text/javascript" }
var pageTracker = _gat._getTracker("UA-3794127-4");
pageTracker._trackPageview();
module ShouldaContextExtensions
def self.included(base)
base.class_eval do
alias_method_chain :build, :fast_context
alias_method_chain :am_subcontext?, :fast_context
end
end
def fast_context(name, &blk)
@fast_subcontexts ||= []
set-window-option -g mode-keys emacs
set-window-option -g window-status-current-bg red
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-attr 'bold'
set-window-option -g window-status-current-attr 'bold'
set-window-option -g window-status-fg black
set-window-option -g window-status-bg white
set-window-option -g automatic-rename on
set-window-option -g utf8 on
(function(j,q,u,e,r,y,r,o,x){try{o=jQuery;if(o&&(!r||(r&&o.fn.jquery==r))){x=true}}catch(r){}if(!x||(r&&o.fn.jquery!=r)){(q=j.createElement(q)).type='text/javascript';if(r){q.async=true}q.src='//ajax.googleapis.com/ajax/libs/jquery/'+(r||1)+'/jquery.min.js';u=j.getElementsByTagName(u)[0];q.onload=q.onreadystatechange=(function(){if(!e&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){e=true;x=jQuery;jQuery.noConflict(true)(function(){y(x)});q.onload=q.onreadystatechange=null;u.removeChild(q)}});u.appendChild(q)}else{y(o)}})(document,'script','head',false,false,(function($){$(function(){
/* code goes here */
console.log($.fn.jquery);
})}));
// readable:
(function (j, q, u, e, r, y, r, o, x ) {
// IE8 undefined crash fix
try {
#!/usr/bin/ruby
require 'sqlite3'
cite_part = ARGV[0]
db_name = "/Users/nernst/Library/Application\ Support/Mendeley\ Desktop/neil\@neilernst.net\@www.mendeley.com.sqlite"
db = SQLite3::Database.new( db_name )
db.results_as_hash = true
query = "select citationkey, title, year from Documents where citationkey like '%#{cite_part}%'"#MATCH '#{cite_part}'"#{}like '%#{cite_part}%'"
db.execute( query ) do |row|
print row['citationKey'] + '|'
@lodestone
lodestone / .bashrc
Created May 19, 2011 19:20 — forked from jyurek/.bashrc
A bash prompt with useful information, including popping up a growl notification when commands are done.
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo '✏ '
}
function parse_git_branch {
git branch --no-color 2> /dev/null | grep \* | awk '{print $2}'
}
function parse_hg_branch {
hg branch 2>/dev/null
@lodestone
lodestone / TechDecisions.md
Created November 28, 2011 11:54
Choices to make in a new Rails project. Would love to see this forked with other's opinions.

Team Support

Source Code Control

git (private server)
Alternative: github

Time Tracking

Cashboard