start new:
tmux
start new with session name:
tmux new -s myname
class Tableless < ActiveRecord::Base | |
def self.column(name, sql_type = nil, default = nil, null = true) | |
columns << ActiveRecord::ConnectionAdapters::Column.new( name.to_s, default, sql_type.to_s, null ) | |
end | |
def self.columns() | |
@columns ||= []; | |
end |
# If you run unicorn on FreeBSD Jail, you might experience the following error | |
# when you send some signals such as HUP, USR2 to master process. | |
# adding listener failed addr=0.0.0.0:8080 (in use) | |
# | |
# This snippet gives you a workaround without specifying IP address. | |
# Returns true if the host is in the Jail. | |
def in_jail? | |
`sysctl security.jail.jailed` =~ /security.jail.jailed: 1/ ? true : false | |
end |
#!/usr/bin/ruby | |
require 'rss' | |
# Usage | |
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/ | |
# episodes.rss | |
# OR | |
# $ ./railscasts.rb | |
p 'Downloading rss index' |
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
RYAML = <<-BASH | |
function ryaml { | |
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@" | |
}; | |
BASH | |
namespace :sync do | |
task :db do | |
isolate do | |
invoke :environment |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
## MAKEFILE FOR C PROJECT | |
MYAPP = application | |
HEADERS = $(MYAPP).h | |
OBJECTS = $(MYAPP).o | |
default: $(MYAPP) | |
%.o: %.c $(HEADERS) | |
gcc -c $< -o $@ |
# Ruby CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-ruby/ for more details | |
defaults: &defaults | |
working_directory: ~/split_app | |
parallelism: 2 | |
docker: | |
- image: circleci/ruby:2.5.0-node-browsers |
based on DigitalOcean guide
Create local project
local$ rails new appname -T -d postgresql
local$ rails g scaffold Story title:string body:text
local$ rails db:migrate