- Update your VirtualBox
- Download ubuntu LTS server (64 bit)
- name “garmz-dev”
- Run default installation from the downloaded iso in new VM
- hostname “garmz-dev”
- Don’t encrypt home
- No automatic updates
- Pick OpenSSH server and PostgreSQL server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "\$(type -t __git_ps1)" ]; then | |
PS1="\$(__git_ps1 '[%s]')$PS1" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
c = commit -m | |
a = add | |
di = diff | |
dic = diff --cached | |
pl = pull | |
ps = push | |
plre = pull --rebase | |
st = status | |
out = log origin..HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environment.rb | |
# setting default timezone for your app when firing up Rails | |
config.time_zone = 'UTC' | |
# app/controllers/application_controller.rb | |
# changing timezone to one selected by user if logged in | |
before_filter :set_time_zone | |
def set_time_zone | |
Time.zone = current_user.time_zone if logged_in? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/user.rb | |
class User | |
include Mongoid::Document | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, :lockable and :timeoutable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# features/support/configuration.rb | |
Before do | |
Neo4j::Transaction.run do | |
Neo4j._all_nodes.each { |n| n.del unless n.neo_id == 0 } | |
end | |
end | |
# spec/support/configuration.rb | |
def delete_all | |
Neo4j::Transaction.run do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Resque | |
class Job | |
alias_method :original_perform, :perform | |
def perform | |
original_perform | |
rescue ActiveRecord::StatementInvalid => e | |
if e.message =~ /server has gone away/i | |
ActiveRecord::Base.verify_active_connections! | |
retry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Inspector | |
def self.analyze(data) | |
registered_plugins.each do |name, block| | |
puts "Report: #{name}" | |
block.call(data) | |
end | |
end | |
def self.registered_plugins | |
@registered_plugins ||= {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/macros/authentication_macros.rb | |
module AuthenticationMacros | |
def sign_in_user | |
let(:current_user) { Factory.stub(:user) } | |
before do | |
sign_in current_user | |
warden.stub(:authenticate => current_user) | |
warden.stub(:authenticate! => current_user) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'chronic' | |
class PassengerProcess | |
attr_accessor :pid, :uptime | |
def initialize(passenger_status_line) | |
values = passenger_status_line.match(/PID:\s(\d*).*Uptime:\s*(.*)$/) | |
@pid = values[1].to_i | |
@uptime = values[2] | |
end |
OlderNewer