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 / break_out.rb
Created June 23, 2012 05:03
Break out of an iFrame from a controller in Rails and redirect to a relative path
render :text => "<html><body><script type='text/javascript' charset='utf-8'>parent.location.href = '/somewhere';</script></body></html>"
@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 / README.md
Last active December 14, 2023 06:39
jondkinney's console vim setup

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Installation

Install by running the following command in your terminal:

exec 3<&1;bash <&3 <(curl https://gist.githubusercontent.com/jondkinney/2040114/raw/vim.sh 2> /dev/null)
@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/