Skip to content

Instantly share code, notes, and snippets.

@jraines
jraines / MacVim-Janus.md
Created May 1, 2011 20:03
Macvim & Janus

##Intro

Janus is a "basic distribution of vim plugins and tools intended to be run on top of the latest MacVIM snapshot." It is maintained by Yehuda Katz and Carl Lerche.

I recently whinged on Twitter that all I really want is vim with TextMate's Command-T go-to-file functionality and some efficient visual tab/buffer navigation. Turns out MacVim + Janus, with just a few tweaks, is all that and more.

Installing Janus

Follow the installation instructions on the git page

@jraines
jraines / cucumber.md
Created May 1, 2011 21:07
Cucumber intro

##Scope and intro

I will be focusing on Rails 3 since this will be most applicable for greenfield development, and because there are Rails 2 bugs. To get started add the following to the Gemfile:

group :test do
  gem 'cucumber'
  gem 'cucumber-rails'
  gem 'capybara'
 gem 'database_cleaner'
@jraines
jraines / as_dependencies_patch.rb
Created May 11, 2011 20:54 — forked from cowboycoded/as_dependencies_patch.rb
patch ActiveSupport::Dependencies to allow loading of same-name models, controllers, etc. from base Rails app and attached engines
#This goes in application.rb
require 'active_support/dependencies'
module ActiveSupport::Dependencies
alias_method :require_or_load_without_multiple, :require_or_load
def require_or_load(file_name, const_path = nil)
if file_name.starts_with?(Rails.root.to_s + '/app')
relative_name = file_name.gsub(Rails.root.to_s, '')
@engine_paths ||= Rails::Application::Railties.engines.collect{|engine| engine.config.root.to_s }
@engine_paths.each do |path|
@jraines
jraines / persistence.md
Created May 17, 2011 18:30
Notes on Adam Keys' presentation "Mixing a persistence cocktail"
  • Marshaling AR objects: dangerous if internal structure of AR object changes with Rails change

Relaxing consistency requirements

  • Is it ok for users to see slightly older data?

Configuring

  • Initializer that loads yaml file that loads different connections per Rails environtment
@jraines
jraines / confident-code.md
Created May 17, 2011 19:05
Notes on Avdi Grimm's "Confident Code"

Confident Code

timid code

  • Randomly mixes input gathering, error handling, and business logic
  • imposes cognitive load on the reader

confident code

  • no digressions
@jraines
jraines / deployment.md
Created May 17, 2011 21:06
21 Deployment Tips in 50 minutes

Vagrant

gem install vagrant

vagrant up

vagrant halt

  • Ruby DSL for provisioning VirtualBox VMs
  • creates a user named vagrant, with password 'vagrant'
@jraines
jraines / SASS-notes.md
Created May 18, 2011 15:18
Notes on SASS presentation - RailsConf 2011

Use this format to assign variables:

$error-red: #911

Transformations:

background-color: lighten(red, 10%)

Functions:

@jraines
jraines / searchbox.md
Created May 18, 2011 15:48
Notes on "Enhanching the Search Box" - RailsConf 2011

###Autocomplete

  • the big lebowski
  • Prefix search
  • rails-3-jquery-autocomplete Gem
    • rails g autocomplete
    • javascript_include_tag "autocomplete-rails.js"
    • autocomplete :resource, :title #, :full => true
    • autocomplete_field_tag
  • Not really flexible over multiple models
@jraines
jraines / eventmachine.md
Created May 18, 2011 18:52
EventMachine Railsconf notes

Implementation of the Reactor pattern

  • Most web apps are I/O bound, not CPU bound
  • Instead of waiting on a response from the network, use that time to process other requests
  • Handle 5-10k concurrent connections with a single Ruby process
EM.run do 
  EM.start_server '0.0.0.0', 2202, EchoServer
end
@jraines
jraines / bundler-deploy.md
Created May 18, 2011 19:19
Deploying with bundler - RailsConf 11 notes

####Scope your gems to your app:

bundle install --path vendor/bundle

####Ensure that bundle install has been run locally

(ie, there are no gems in Gemfile that do not match the lockfile

bundle install --frozen