Skip to content

Instantly share code, notes, and snippets.

View yangchenyun's full-sized avatar

Steven Yang yangchenyun

View GitHub Profile
-- dbext:type=PGSQL:user=yangchenyun:dbname=huali_development:host=localhost:port=5432
select source, count(id)
from orders
group by source
;
select name_zh, sum(quantity)
from products, line_items
where products.id = line_items.product_id
[1, 2, 3].each do |n1|
if n1 == 1
[1, 2, 3].each do |n2|
if n2 == 2
[1, 2, 3].each do |n3|
if n3 == 3
[1, 2, 3].each do |n4|
if n4 == 4
print n1, n2, n3, n4
end
################
# Properties
################
#
# color
# red, green, ivory, blue. yellow
# nationality
# englishman, spaniard, ukrainian, norwegian, japanese
@yangchenyun
yangchenyun / config.sh
Created May 18, 2013 11:46
Hibernate mode configuration on mac OS X
# mode 0: old style sleep / 3: new (save to disk style)
# show the hibernatemode
pmset -g | grep hibernatemode
# change the hibernate mode
sudo pmset -a hibernatemode 0
# check the sleepimage size
ls -lh /private/var/vm/sleepimage
{
:method => :post,
:body => {
"success" => true
},
:url => #<URI::HTTPS:0x007f9331a165f0 URL:https://api.segment.io/v1/import>,
:request_headers => {
"Accept" => "application/json",
"Content-Type" => "application/json"
},
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by GNU Smalltalk configure 3.2.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/gnu-smalltalk/3.2.5 --disable-gtk --with-readline=/usr/local/Cellar/readline/6.2.4/lib --without-tcl --without-tk --without-x
## --------- ##
## Platform. ##
@yangchenyun
yangchenyun / sidekiq.log
Created June 24, 2013 12:58
Sidekiq crash logs
2013-06-21T03:56:38Z 15961 TID-1104yk Sidekiq::Extensions::DelayedClass JID-64cafe9d2209c90b8563b3dc DEBUG: Failure! Retry 0 in 36 seconds
2013-06-21T03:56:38Z 15961 TID-1104yk Sidekiq::Extensions::DelayedClass JID-64cafe9d2209c90b8563b3dc INFO: fail: 4.292 sec
2013-06-21T03:56:38Z 15961 TID-1104yk WARN: {"retry"=>true, "queue"=>"default", "class"=>"Sidekiq::Extensions::DelayedClass", "args"=>["---\n- !ruby/class 'AnalyticWorker'\n- :complete_order\n- - 1317\n"], "jid"=>"64cafe9d2209c90b8563b3dc", "enqueued_at"=>1371786994.4752176, "error_message"=>"-1: Connection error: execution expired", "error_class"=>"RuntimeError", "failed_at"=>2013-06-21 03:56:38 UTC, "retry_count"=>0}
2013-06-21T03:56:38Z 15961 TID-1104yk WARN: -1: Connection error: execution expired
2013-06-21T03:56:38Z 15961 TID-1104yk WARN: /home/deployer/repositories/huali-production/releases/20130620044646/app/workers/analytic_worker.rb:209:in `send_request'
/home/deployer/repositories/huali-production/releases/20130620044646/app/workers/analytic
startup, version: 2217 osx x64 channel: stable
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
working dir: /
packages path: /Users/yangchenyun/Library/Application Support/Sublime Text 2/Packages
settings path: /Users/yangchenyun/Library/Application Support/Sublime Text 2/Settings
PackageSetup not required
catalogue loaded
found 29 files for base name Default.sublime-keymap
found 3 files for base name Default.sublime-mousemap
found 45 files for base name Main.sublime-menu
str = 'raise StandardError'
l = -> { raise StandardError }
def eval_call(str)
eval(str)
end
def lambda_call(l)
l.call
end
require 'active_model'
class Person
# Required dependency for ActiveModel::Errors
extend ActiveModel::Naming
def initialize
@errors = ActiveModel::Errors.new(self)
end