Skip to content

Instantly share code, notes, and snippets.

View wildjcrt's full-sized avatar
🦀
have a nice day!

Jerry Lee wildjcrt

🦀
have a nice day!
View GitHub Profile
x = ['男性', '男人', '兒子', '男孩', '父親', '爺爺', '叔叔', '丈夫', '女兒', '婦女', '女性', '奶奶', '女孩', '阿姨', '妻子', '母親'].shuffle
y = ['音樂', '人類學', '哲學', '英語', '歷史', '文學', '藝術', '數學', '工程學', '物理學', '地質學', '化學', '天文學', '生物學'].shuffle
result = []
y.each_with_index do |ey, i|
result << "#{x[i]}#{ey}"
end
result
require 'benchmark/ips'
require 'date'
Benchmark.ips do |x|
x.time = 100
x.report('Time') do
Time.now.year
end

Keybase proof

I hereby claim:

  • I am wildjcrt on github.
  • I am wildjcrt (https://keybase.io/wildjcrt) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

@wildjcrt
wildjcrt / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Akira
https://speakerdeck.com/a_matsuda/render-it-a-deep-dive-into-actionview-and-template-engines
Prem
https://speakerdeck.com/sikachu/zero-downtime-payment-platforms-1
Shibata
https://speakerdeck.com/hsbt/crafting-rails-culture
葉叮叮
>> a = [1, 2, 3, 4, 5, 1, 2]
=> [1, 2, 3, 4, 5, 1, 2]
>> a.compact.size
=> 5
>> a.compact!.size
NoMethodError: undefined method `size' for nil:NilClass
from (irb):14
from /Users/wildjcrt/.rvm/rubies/ruby-2.1.3/bin/irb:11:in `<main>'
@wildjcrt
wildjcrt / gist:33155bada4eb6817625a
Last active August 29, 2015 14:03
railsbridge 隨身碟內容
@wildjcrt
wildjcrt / test.rb
Created June 25, 2014 01:16 — forked from tka/test.rb
sql = "select *, (select count(books.id) from books where books.authorsid=authors.id) as books_count from authors "
authors = Author.find_by_sql(sql)
authors.first.books_count
desc "Pings PING_URL to keep a heroku dyno alive"
task :dyno_ping do
require "net/http"
if ENV['PING_URL']
uri = URI(ENV['PING_URL'])
Net::HTTP.get_response(uri)
end
end
hash = {
:carol => 'cancer',
:jaince => 'taurus',
:ting => 'twines',
:jerry => 'cancer'
}
ratings = Hash.new(0)
hash.values.each {|rate| ratings[rate] += 1}