Skip to content

Instantly share code, notes, and snippets.

View joselo's full-sized avatar

Jose Carrion joselo

View GitHub Profile
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
@joselo
joselo / gist:4074646
Created November 14, 2012 20:40
simple toggle sidebar
(($) ->
$.fn.sidebar = (options) ->
that = this
settings = $.extend(options)
toggle_link = $(settings.toggle_link)
main_content = $(settings.main_content)
width = $(that).css('width')
setup = ->
$(that).hide()
@@ -51,7 +51,7 @@ ActiveRecord::Schema.define(:version => 20120930025410) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "pictures_count", :default => 0
- t.string "plate", :limit => 7
+ t.string "plate", :limit => 8
end
@joselo
joselo / static_map_helper.rb
Created July 16, 2012 02:41 — forked from mcasimir/static_map_helper.rb
Google Maps Static map helper for Ruby on Rails
module StaticMapHelper
def static_map_for(location, options = {})
params = {
:center => [location.lat, location.lng].join(","),
:zoom => 15,
:size => "300x300",
:markers => [location.lat, location.lng].join(","),
:sensor => true
}.merge(options)
@joselo
joselo / database.yml
Created July 2, 2012 23:13
database.yml config file for postgresql
default: &local_defaults
adapter: postgresql
host: localhost
port: 5432
min_messages: warning
encoding: utf8
username: postgres
password:
template: template0
@joselo
joselo / es.sh
Created June 29, 2012 17:30 — forked from kajic/es.sh
Install ElasticSearch on Ubuntu 10.04/11.04
cd ~
sudo apt-get update
sudo apt-get install curl python-software-properties -y
sudo apt-get install openjdk-6-jre-headless
curl -L https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz | tar -xz
sudo mv elasticsearch-* /usr/local/share/elasticsearch
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
@joselo
joselo / application.rb
Created April 13, 2012 17:53 — forked from baphled/application.rb
Jasmine config to compile coffeescript and copy assets files for testing
# Needed if you are not requiring rails/all
require 'sprockets/railtie'
@joselo
joselo / Running watchr.sh
Created April 13, 2012 17:37 — forked from johnbintz/Running watchr.sh
Running RSpec and jasmine-headless-webkit using watchr
# all tests, run all at start
ACCEPTANCE=true watchr test.watchr
# all tests, don't run at start
ACCEPTANCE=true watchr test.watchr -- -f
# skip acceptance (the slow ones)
watchr test.watchr
@joselo
joselo / test_helper.rb
Created April 13, 2012 03:18 — forked from gnepud/test_helper.rb
MiniTest::Spec with Rails 3.2 setup
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
require 'capybara/rails'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
@joselo
joselo / gist:2373301
Created April 13, 2012 03:08 — forked from cfcosta/gist:2124269
integration test helper for rails with minitest
ENV['RAILS_ENV'] = "test"
unless defined?(Bundler)
require 'bundler/setup'
end
require 'minitest/autorun'
require 'factory_girl'
MiniTest::Unit::TestCase.send(:include, FactoryGirl::Syntax::Methods)