Skip to content

Instantly share code, notes, and snippets.

View yetanothernguyen's full-sized avatar

Nguyen Vu Nguyen yetanothernguyen

View GitHub Profile
@yetanothernguyen
yetanothernguyen / bootstrap.sh
Last active October 11, 2015 05:07
Pivotal Workstation
pushd `pwd`
if rvm --version 2>/dev/null; then
gem install soloist
else
sudo gem install soloist
fi
mkdir -p ~/cookbooks; cd ~/cookbooks
cat > soloistrc <<EOF
cookbook_paths:
@yetanothernguyen
yetanothernguyen / mountain-lion-brew-setup.markdown
Created July 26, 2012 09:06 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

id: 11507056
priority: 0
attempts: 10
handler: --- !ruby/struct:SubscribeMailchimpJob
user_id: 337912
subscribe: true
last_error: {Wrong type NilClass. Not allowed!
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/xmlrpc/create.rb:205:in `conv2value'
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/xmlrpc/create.rb:228:in `block in conv2value'
@yetanothernguyen
yetanothernguyen / date.js
Created February 13, 2012 10:19
js get date diff
function showRemaining(){
function nextDay(day){
var d = new Date;
(day = (Math.abs(+day || 0) % 7) - d.getDay()) < 0 && (day += 7);
return day && d.setDate(d.getDate() + day), d;
}
var end = nextDay(5);
end.setHours(18); end.setMinutes(0); end.setSeconds(0); end.setMilliseconds(0);
@yetanothernguyen
yetanothernguyen / pages_controller_spec.rb
Created February 5, 2012 09:47
Pages Controller Spec
require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "returns http success" do
get 'home'
response.should be_success
end
rspec ./spec/controllers/admin/users_controller_spec.rb:21 # Admin::UsersController POST 'suspend' should suspend the user
rspec ./spec/controllers/admin/users_controller_spec.rb:51 # Admin::UsersController GET 'show' should show the admin user view
rspec ./spec/controllers/supportabilities_controller_spec.rb:14 # SupportabilitiesController create should create a new supportability
rspec ./spec/integration/admin_contest_spec.rb:27 # AdminContest when there is no existing draw should be able to request generating winner
rspec ./spec/integration/admin_contest_spec.rb:61 # AdminContest when there is an existing draw with winner chosen should be able to confirm and publish
rspec ./spec/integration/admin_contest_spec.rb:82 # AdminContest when there is an existing draw with winner chosen should be able to delete
rspec ./spec/integration/admin_contest_spec.rb:96 # AdminContest when there is an existing draw with winner chosen should be able to redraw all
rspec ./spec/integration/admin_contest_spec.rb:112 # AdminCont
@yetanothernguyen
yetanothernguyen / From
Created November 10, 2011 05:06
Transactions table for test
create_table "transactions", :id => false, :force => true do |t|
t.integer "id", :null => false
t.integer "user_id"
t.float "amount"
t.string "transactable_type"
t.integer "transactable_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "prize"
t.integer "contribution_point"
rake, version 0.9.2.2
Loading development environment (Rails 3.1.1)
:001 > user = User.create(:name => "user1")
(0.5ms) BEGIN
SQL (9.7ms) INSERT INTO `users` (`created_at`, `name`, `updated_at`) VALUES ('2011-11-01 05:35:51', 'user1', '2011-11-01 05:35:51')
(0.5ms) COMMIT
=> #<User id: 2, name: "user1", created_at: "2011-11-01 05:35:51", updated_at: "2011-11-01 05:35:51">
:002 > story1 = Story.create(:title => "title1")
=> #<Story _id: BSON::ObjectId('4eaf85562ab0f56c6e000001'), title: "title1">
:003 > story2 = Story.create(:title => "title2", :featured => true)
=> #<Story _id: BSON::ObjectId('4eaf85762ab0f56c6e000003'), featured: true, title: "title2">
@yetanothernguyen
yetanothernguyen / config.bluepill
Created October 7, 2011 09:35
bluepill config for delayed_job
Bluepill.application("says", :log_file => "/var/www/says-dot-com-staging/current/log/bluepill.log") do |app|
app.process("delayed_job") do |process|
process.working_dir = "/var/www/says-dot-com-staging/current"
process.stdout = process.stderr = "/var/www/says-dot-com-staging/current/log/delayed_job.log"
process.start_grace_time = 60.seconds
process.stop_grace_time = 60.seconds
process.restart_grace_time = 60.seconds
process.start_command = "/usr/bin/env RAILS_ENV=staging bundle exec script/delayed_job start --db=us --pid-dir=/var/www/says-dot-com-staging/shared/pids --prefix staging"