Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
@lgs
lgs / capybara cheat sheet
Created March 6, 2012 23:38 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@lgs
lgs / Gemfile
Created March 18, 2012 19:49 — forked from igrigorik/Gemfile
deploying Goliath on Heroku's cedar stack
source :gemcutter
gem 'goliath', :git => 'git://github.com/postrank-labs/goliath.git'
gem 'em-http-request', :git => 'git://github.com/igrigorik/em-http-request.git'
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git'
gem 'yajl-ruby'
lsoave@ubuntu:~/rails/github/gitwatcher$ rails c
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
MONGODB (0ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
Loading development environment (Rails 3.2.3)
1.9.2p290 :001 > class Category
1.9.2p290 :002?> category = ["ruby", "web", "framework"]
1.9.2p290 :003?> def self.find_competitors(category)
1.9.2p290 :004?> #Competitor = Struct.new(:html_url, :description, :user)
@lgs
lgs / autosuggest.html
Created April 19, 2012 08:27 — forked from courtenay/autosuggest.html
Tender: Sample jsonp autosuggest implementation.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Test JSONP search api</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
</head>
@lgs
lgs / custom.js
Created April 22, 2012 12:37 — forked from drewjoh/custom.js
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.0)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
if (href.indexOf('#') == 0) {
$(href).modal('open');
} else {
<div class="accordion-group">
<div class="accordion-heading">
</div>
<div class="accordion-body in collapse" id="collapse_id-1">
<div class="accordion-body in collapse" id="collapse_id-2">
<div class="accordion-body in collapse" id="collapse_id-3">
...
<div class="accordion-group">
<div class="accordion-heading">
@lgs
lgs / flash_messages.rb
Created May 24, 2012 22:34 — forked from nacengineer/application_helper.rb
Flash Messages with Bootstrap 2 and Rails 3.2.3
# in application_helper
def flash_class(level)
case level
when :notice then "alert alert-info"
when :success then "alert alert-success"
when :error then "alert alert-error"
when :alert then "alert alert-error"
end
end
@lgs
lgs / es.sh
Created May 30, 2012 22:01
Install ElasticSearch on Ubuntu 12.04
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.0.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@lgs
lgs / tire import on heroku
Created June 3, 2012 20:16
heroku run:detached rake environment tire:import CLASS=Event FORCE=true
lsoave@ubuntu:~/rails/github/gitwatcher$ heroku run:detached rake environment tire:import CLASS=Event FORCE=true
Running rake environment tire:import CLASS=Event FORCE=true... up, run.2
Use 'heroku logs -p run.2' to view the log output.
lsoave@ubuntu:~/rails/github/gitwatcher$
2012-06-03T20:13:08+00:00 heroku[run.2]: State changed from created to starting
2012-06-03T20:13:13+00:00 heroku[run.2]: Starting process with command `bundle exec rake environment tire:import CLASS=Event FORCE=true`
@lgs
lgs / gist:2867221
Created June 4, 2012 08:24
Heroku log for failing ElasticSearch query (500 Internal Server Error)
500 Internal Server Error after ElasticSearch query, which logs the following on Heroku:
2012-06-03T21:56:37+00:00 heroku[router]: GET gitwatcher.com/categories dyno=web.1 queue=0 wait=0ms service=10295ms status=200 bytes=61422
2012-06-03T21:56:37+00:00 heroku[nginx]: 93.34.112.205 - - [03/Jun/2012:21:56:37 +0000] "GET /categories HTTP/1.1" 200 12068 "http://gitwatcher.com/" "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0" gitwatcher.com
2012-06-03T21:56:37+00:00 heroku[router]: GET gitwatcher.com/assets/application-02cfedf8524ef0a3da8856f66a3c61df.css dyno=web.1 queue=0 wait=0ms service=127ms status=200 bytes=178764
2012-06-03T21:56:37+00:00 heroku[router]: GET gitwatcher.com/assets/application-4083955e163027c3e232b6edc9cf4dd1.js dyno=web.1 queue=0 wait=0ms service=88ms status=200 bytes=204559
2012-06-03T21:56:37+00:00 heroku[nginx]: 93.34.112.205 - - [03/Jun/2012:21:56:37 +0000] "GET /assets/application-02cfedf8524ef0a3da8856f66a3c61df.css HTTP/1.1" 200 21098 "http://gitwatcher.