Skip to content

Instantly share code, notes, and snippets.

View bliaxiong's full-sized avatar
🎯
Focusing

bxio bliaxiong

🎯
Focusing
View GitHub Profile
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@bliaxiong
bliaxiong / torquebox_app.rb
Created November 1, 2013 15:03
Rails app template - installs torquebox
add_source 'http://torquebox.org/rubygems'
add_source 'http://rubygems.org'
gem 'devise'
gem 'cancan'
gem 'rolify'
gem 'bootstrap-sass'
gem 'kaminari'
gem 'better_errors'
gem 'faker'
@bliaxiong
bliaxiong / my_standard_app.rb
Created November 25, 2013 20:06
standard rails app with goody gems
add_source 'http://rubygems.org'
gem 'devise'
gem 'authority'
gem 'rolify'
gem 'bootstrap-sass'
gem 'kaminari'
gem 'carrierwave'
gem 'cells'
gem "phrasing"
gem 'raphael-rails'

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.

What to expect

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.

@bliaxiong
bliaxiong / install_nginx_torquebox.sh
Last active January 2, 2016 15:28
Installs Nginx and Torquebox on CentOS 6.5
#!/bin/sh
# Nginx
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo yum install nginx
sudo /etc/init.d/nginx start
# Edit this: /etc/nginx/nginx.conf
# located: /etc/jboss-as
JBOSS_USER=torquebox
JBOSS_HOME=/opt/torquebox/current/jboss
JBOSS_PIDFILE=/var/run/torquebox/torquebox.pid
JBOSS_CONSOLE_LOG=/var/log/torquebox/console.log
JBOSS_CONFIG=standalone.xml # For standalone
# JBOSS_CONFIG=standalone-ha.xml # For clustering
@bliaxiong
bliaxiong / gist:66646a2058006503ba10
Created December 9, 2014 15:15
jboss-as-standalone - for opensuse and clusted
#!/bin/sh
#
# JBoss standalone control script
#
# chkconfig: - 80 20
# description: JBoss AS Standalone
# processname: standalone
# pidfile: /var/run/jboss-as/jboss-as-standalone.pid
# config: /etc/jboss-as/jboss-as.conf
export JRUBY_OPTS='--1.9 -Xcext.enabled=true -J-Xmx3120m'
RAILS_ENV=production rake assets:clean --trace
RAILS_ENV=production rake assets:precompile --trace
chmod -R 777 /var/jenkins/*
chmod -R 777 /opt/torquebox/current/jruby/*
chown -R torquebox:torquebox /opt/torquebox/current/jruby/*
@bliaxiong
bliaxiong / check_file_upload.js
Last active August 29, 2015 14:12
Js check upload file size
// This awesome jQuery plugin will check the file size and against the selected upload file and
// determine if its allowable. The size limit will have to be in bytes.
// Parameters:
// evt_type - the javascript event, if non is needed, set to empty string
// limit - the size limit in bytes (default javascript size measurement)
$.fn.fileSizeCheck = function(evt_type, limit) {
var sizeLimit = limit;
if (evt_type == "") {
@bliaxiong
bliaxiong / mysql_sqlx.go
Created December 31, 2014 06:25
Go mysql sqlx example
package main
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"log"
)
type User struct {
Id int