Skip to content

Instantly share code, notes, and snippets.

CURRENT_RUBY = 'ree-1.8.7-2010.02'
RUBY_PATH = "/home/rails/.rvm/rubies/#{CURRENT_RUBY}"
GEM_HOME = "/home/rails/.rvm/gems/#{CURRENT_RUBY}"
ssh_options[:paranoid] = false
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :stages, %w(staging production)
@andresgutgon
andresgutgon / Selector de Idioma con Rails 2.3.8
Created August 18, 2010 18:31
Desplegar los idiomas que estan disponibles en tu App y setear el valor para cada usuario
#Selector de idioma
#dependencias:
# 1 - Rack locale del paquete Rack-contrib [1]
# USO: Se usa para detectar el idioma definido por el usuario en su browser ['HTTP_ACCEPT_LANGUAGE']
# Esplicado aquí http://guides.rubyonrails.org/i18n.html#using-accept-language
# [1] http://github.com/rack/rack-contrib
# 2 - Routing-filter [1]
# USO: Establecer el locale en las URLs ej.: www.mysite.com/es/foo/bar
# NOTA: Si tambien quieres traducir las URL's usa la gema de Raul Murciano Translate_routes [2] (De momento sin cobertura para Rails3)
# Rails developers have long had bad experiences with fixtures for
# several reasons, including misuse.
#
# Misuse of fixtures is characterized by having a huge number of them,
# requiring the developer to maintain a lot of data and creating dependencies
# between tests. In my experience working (and rescuing) many applications, 80%
# of fixtures are only used by 20% of tests.
#
# An example of such tests is one assuring that a given SQL query with
# GROUP BY and ORDER BY conditions returns the correct result set. As expected,
@haschek
haschek / _contrast.scss
Last active August 14, 2019 14:20
SCSS/SASS Accessibility Color Methods
/*
SCSS Color Methods for Accessibility
================================================================================
Adjust given colors to ensure that those color combination provide sufficient
contrast.
@version 0.1
@link http://eye48.com/go/scsscontrast
@bjeanes
bjeanes / README.md
Created November 23, 2011 22:24
Easily fold everything not relevant to your current spec

Easily fold everything not relevant to your current spec

Usage / Example

Just hit <Leader>rf (rspec focus) to fold all example groups in the entire file except the full hierarchy to your spec that your cursor is inside. The current example is automatically centered on your screen, when possible.

This lets you easily see all the context/describe blocks that apply just to the current spec. See:

example

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
differ = RSpec::Expectations::Differ.new
puts differ.diff_as_object "Lorem Ipsum is simply dummy text of the printing\n and typeseting industry",
"Lorem Ipsum is simply dummy text of the printing\n and typesetting industry"
Lorem Ipsum is simply dummy text of the printing
- and typesetting industry
+ and typeseting industry
@seanlilmateus
seanlilmateus / gist:4134454
Last active January 12, 2018 16:11
Rubymotion GCD Future; with lazy evaluation
#!/usr/bin/env macruby -wKU
framework 'Foundation'
module Dispatch
module Futuristic
def proxy
Class.new(BasicObject) do
def initialize(obj)
@obj = obj
end
@svs
svs / QuotationsIndexParams.rb
Created December 16, 2012 20:54
QuotationsIndexParams
class QuotationsIndexParams
include Virtus
include DataMapper::Validations
attribute :scope, String, :default => 'pending'
attribute :sort, String, :default => 'poolability'
attribute :quotation, Hash, :default => {}
attribute :date, Date
validates_within :scope, :set => [nil,'all','pending','to_call','to_pool', 'cabbed']