Skip to content

Instantly share code, notes, and snippets.

View aledalgrande's full-sized avatar

Alessandro Dal Grande aledalgrande

View GitHub Profile
@aledalgrande
aledalgrande / gist:1481291
Created December 15, 2011 14:34
Culerity with RVM wrapper problem
$ cucumber --tags @current
@current @javascript
Scenario: test # features/f01.feature:8
env: bash: No such file or directory
@aledalgrande
aledalgrande / gist:1481341
Created December 15, 2011 14:47
My culerity conf
# env.rb
require 'bbc-cucumber-steps'
require 'capybara/cucumber'
require 'culerity'
require 'capybara/culerity'
require 'ruby-debug'
Culerity.jruby_invocation = File.expand_path("~/.rvm/bin/celerity_jruby")
Capybara.register_driver :culerity do |app|
@aledalgrande
aledalgrande / gist:1845935
Created February 16, 2012 15:58
Capistrano configuration for RVM, bundler, Sinatra and Unicorn
require "bundler/capistrano"
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2@sinatroxy'
set :rvm_type, :system
set :bundle_flags, "--deployment"
set :application, "sinatroxy"
set :repository, "xxx@yyy:sinatroxy"
@aledalgrande
aledalgrande / date.rb
Created March 28, 2012 13:28
How to convert DateTime to Time reliably (monkey patching)
class Date
def to_gm_time
to_real_time(new_offset, :gm)
end
def to_local_time
to_real_time(new_offset(DateTime.now.offset-offset), :local)
end
def to_real_time(dest=new_offset, method=:utc) # don't use to_time because it could be overridden by ActiveSupport if it's required after this file
@aledalgrande
aledalgrande / Gene Runner user stories
Created May 20, 2012 13:23
Gene Runner user stories created at #openlabs for challenge 2
MIT license
MOBILE APP
Feature: First play
As a first time user
I want to learn about the game
So that I can start playing
Scenario: Load/home screen
@aledalgrande
aledalgrande / gist:3202454
Created July 29, 2012 23:09
iPad iOS 5 user agent string
Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3
@aledalgrande
aledalgrande / mongod
Created September 17, 2012 09:38
Suse mongod startup script
#!/bin/sh
### BEGIN INIT INFO
# mongod - Startup script for mongod
# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf
# pidfile: /var/run/mongo/mongod.pid
### END INIT INFO
# ps ax | grep 3306
28723 pts/1 Sl 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/mysqld.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
28930 pts/1 Sl 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
29096 pts/1 R+ 0:00 grep 3306
# ls /var/lib/mysql/mysql.sock
ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory
# service mysql stop
Shutting down service MySQL done
# ps ax | grep 3306
@aledalgrande
aledalgrande / Gemfile
Created August 9, 2014 00:17
Redis example
# Gemfile
gem 'redis', '~> 3.0.1'
gem 'hiredis', '~> 0.4.5'
@aledalgrande
aledalgrande / Gemfile
Last active August 29, 2015 14:05
Sidekiq video upload
# Gemfile
gem 'sidekiq'