Don't forget -T -d postgresql. One day create a template and builder
- rails new AppName -T -d postgresql
- rails generate rspec:install In application.rb:
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” | |
# Shamelessly copied from https://github.com/gf3/dotfiles | |
# Screenshot: http://i.imgur.com/s0Blh.png | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi |
require 'google/cloud/datastore' | |
module Ruba | |
# This use the Google Datastore as a key value storage. | |
# One could argue that Memcache would be more appropriate. | |
# usage: | |
# | |
## class DoSomething | |
## include GoogleKeyVal | |
## |
module DelayedJobScopes | |
extend ActiveSupport::Concern | |
included do | |
scope :error, -> (error) { failed.where('last_error ILIKE (?)', "%#{error.strip}%") } | |
scope :failed, -> { where('last_error IS NOT NULL') } | |
scope :queues, -> (queues) { where(queue: queues) } | |
end | |
def id_in_args |
/* get service from the console */ | |
var service = angular.element('[ng-app]').injector().get('MyService'); |
# credits goes to SKORKS | |
# http://www.skorks.com/2009/09/ruby-exceptions-and-exception-handling/ | |
# raise an exception | |
raise TypeError, 'You must give me truth' if value == false | |
# raise RuntimeError | |
raise "Hello" | |
# basic block |
%w(1 2 3) => [1,2,3] | |
%Q{ my super long | |
string on several lines | |
} | |
<<-SQL | |
/* lets write some SQL */ | |
select users.* from users; |
Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'dj.log')) | |
Delayed::Worker.logger.info "Debugging job" |