Skip to content

Instantly share code, notes, and snippets.

class InvestmentCreationService
def initialize(investment, current_user)
@investment = investment
@current_user = current_user
end
def save
if @investment.save
log_activity

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@jondkinney
jondkinney / pivotal_tracker_git_flow.rake
Created May 3, 2012 07:04
Allows listing pivotal tracker stories and selecting one to start a new git flow feature or hotfix
require "rubygems"
require "pivotal-tracker"
namespace :pt do
desc "list avail pivotal tracker tix from which to create a git fea branch"
task :list do
def truncate_words(text, length = 5)
return if text == nil
words = text.split()
words = words - %w(feature scenario for in on a an the of so that they be able to are it its with) #remove non critical words (experiment with this)
@jondkinney
jondkinney / settings.txt
Created February 15, 2012 23:26
Compressor 4 settings, used when exporting from Final Cut Pro X
Name: Demo
Description: H.264
File Extension: mp4
Estimated size: 225.23 MB/hour of source
Audio Encoder
Sample Rate: 32.000kHz
Channels: 2
Bits Per Sample: 16
AAC encoder quality: high
Data rate: 64 Kbps
# Capistrano Multistage Support
# Uncomment the following lines if you'd like Multistage Capistrano support.
set :default_stage, "staging"
set :stages, %w(production staging alpha)
require 'capistrano/ext/multistage'
require 'capistrano/gitflow' # needs to come after multistage
# Include Bundler Extensions
# Comment out the following line if you're not using Bundler.
require "bundler/capistrano"
set shell=/bin/sh "Need to start from a shell so that RVM is read in properly when using zsh as your shell.
nmap <leader>v :tabedit ~/.gvimrc.local<CR>
set macmeta "Need this to enable M and D
"Color Scheme
color jonkrails
"color AutumnLeaf
Lesson 2 SUMMARY
1. To delete from the cursor up to the next word type: dw
2. To delete from the cursor to the end of a line type: d$
3. To delete a whole line type: dd
4. To repeat a motion prepend it with a number: 2w
5. The format for a change command is:
operator [number] motion
Links:
* How to play with Rails 3.1 and coffeescript now - http://www.rubyinside.com/how-to-rails-3-1-coffeescript-howto-4695.html
* Ordering of asset pipeline - http://stackoverflow.com/questions/6149961/rails-3-1-asset-pipeline-and-manually-ordered-javascript-requires
* Coffeescript TM Bundle - https://github.com/jashkenas/coffee-script-tmbundle
* Remember to run: `osascript -e 'tell app "TextMate" to reload bundles'`
* Use Coffeescript in a Rails 2.3.x application - https://github.com/Sutto/barista
* Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and SimpleForm - https://gist.github.com/989132
* What is autoloading - http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/662abfd1df9b2612?hl=en&pli=1
* Getting started with Factory Girl - https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md
* Rails3 tutorial (best follow along / learning tool period) - http://ruby.railstutorial.org/
---
:update_sources: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc
@jondkinney
jondkinney / setup_textmate_rails_dev.md
Created June 16, 2011 08:16
Setup Textmate for Rails Dev on OS X

##Setup Textmate for Rails Dev on OS X

This guide was written by Jon Kinney for the Green Bay Ruby User Group. Jon works at Intridea and they graciously sponsor the Green Bay RUG meetings.

These guides were also partially completed using time from Intridea's SparkTime initiative which aims to give employees "outside projects" to work on during their normal work week.

If you find any issues with these suggestions please let me know. I've amassed these tips/tricks over several years of full time Rails development using Textmate but just because it works on my system doesn't always mean it will be problem free universally. Thanks to all the blog authors whose articles helped me learn Textmate over the years but whose links/posts I've lost or forgotten over time. If you have a cool Textmate tip or trick please post it in the comments!