Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Fred Wu
@fredwu
VIP
NO. 188 / 2011-11-23

墨尔本
109 Topics / 836 Replies
156 Followers
0 Following
0 Favorites
https://fredwu.me/
GitHub Public Repos
  • crawler 952

    A high performance web crawler / scraper in Elixir.

  • angel_nest 774

    Project code name: Angel Nest. :)

  • opq 269

    Elixir queue! A simple, in-memory queue with worker pooling and rate limiting in Elixir.

  • stemmer 153

    An English (Porter2) stemming implementation in Elixir.

  • jquery-inline-confirma... 53

    Inline Confirmation plugin for jQuery. One of the less obtrusive ways of implementing confirmatio...

  • dotfiles 18

    My dotfiles

  • README-xplor 10

    Fred @ Xplor - how to work with me.

  • yield.rb 5

    Aggregated token amounts and values. Supports ApeBoard, YieldWatch, Binance, CoinGecko and more.

  • advent_of_code_2018 4

    https://adventofcode.com/2018/about

  • fredwu.me-v3 3

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 各位码 code 累了都喜欢干嘛? at April 01, 2012

    看台湾综艺,美剧,摄影,写 blog……

  • 看大家在哪里购买域名做玉米虫 at April 01, 2012

    我直接用 name.com 的 DNS,完全没有问题。

  • 按一定的概率随机给出键,怎么实现好 at April 01, 2012

    如果是一个很大的 hash,比如:

    hash_elements = 10000
    big_hash = {}
    hash_elements.times { |n| big_hash[n] = 1.0/hash_elements }
    
    

    Benchmark 只执行一次的话——

                               user     system      total        real
    fredwu's traditional   0.010000   0.000000   0.010000 (  0.010952)
    fredwu's one liner     0.010000   0.000000   0.010000 (  0.011436)
    fredwu's enumerator    0.000000   0.000000   0.000000 (  0.005906)
    hayeah's               0.010000   0.000000   0.010000 (  0.007418)
    doitian's              0.010000   0.000000   0.010000 (  0.010415)
    
    
  • 按一定的概率随机给出键,怎么实现好 at April 01, 2012

    #22 楼 @doitian 整个执行。hash.to_a_sort_by这里用了很多执行时间——其实我觉得不用 sort 啊。

  • linux/osx 大家都用什么比较工具啊。 at April 01, 2012

    命令行里直接 diff。不然的话就是用 Textmate 里的 diff。

  • 看大家在哪里购买域名做玉米虫 at April 01, 2012

    GoDaddy 的唯一优势就是价格,除了价格一无是处。

    我推荐 name.com - 我几乎所有的域名都在 name.com 上。价格比 GoDaddy 稍微贵一点点(.com 的一般$9左右)。

  • 大家看 pdf 用神马电纸书啊? at April 01, 2012

    虽然有 Kindle4,但我还是用 iPad 看。高分辨率啊~ ^__^

  • 怎样带领好一个 Rails 团队? at April 01, 2012

    另外,我在 blog 上写过两篇有点关联的文章——

    如何招募程序员:http://fredwu.me/post/16510145575/on-hiring-how-not-to-annoy-developers Agile 不只是个幌子:http://fredwu.me/post/20058808238/agile-is-not-a-sham

  • 怎样带领好一个 Rails 团队? at April 01, 2012

    我觉得最好的方法是 reflection——

    我现在在带队,很多时候都是回想以前我的 TL 做的哪些事情我觉得是好的,或是不好的——从而纠正自己做事的方式和态度。

  • 按一定的概率随机给出键,怎么实现好 at April 01, 2012

    @doitian 执行速度还是没有之前两个快哦。;)

                               user     system      total        real
    fredwu's traditional   1.790000   0.010000   1.800000 (  1.832200)
    fredwu's one liner     1.840000   0.020000   1.860000 (  1.864844)
    fredwu's enumerator    0.180000   0.000000   0.180000 (  0.182008)
    hayeah's               0.480000   0.000000   0.480000 (  0.478611)
    doitian's              0.780000   0.000000   0.780000 (  0.785653)
    
    
  • 按一定的概率随机给出键,怎么实现好 at March 31, 2012

    测试了一下目前为止的几种算法的性能(各执行 100000 次)。算法包括我的三个,加上@hayeah的一个。

                               user     system      total        real
    fredwu's traditional   1.610000   0.010000   1.620000 (  1.622086)
    fredwu's one liner     1.920000   0.020000   1.940000 (  1.946811)
    fredwu's enumerator    0.180000   0.000000   0.180000 (  0.180438)
    hayeah's               0.480000   0.000000   0.480000 (  0.480785)
    
    
  • 按一定的概率随机给出键,怎么实现好 at March 31, 2012

    如果说是要高性能,处理大数据量的话,可以:

    hash = { :a => 0.5, :b => 0.15, :c => 0.2, :d => 0.15 }
    marker = rand
    
    p hash.inject{ |s, n| s[1] > marker ? s : [n[0], s[1]+n[1]] }[0]
    
    

    这个算法有个小小的弊病——严格意义上来算,由于 float 的精确度问题,结果是会有偏差的,比如:

    0.5+0.15+0.2
    # => 0.8500000000000001
    
    
    
  • 按一定的概率随机给出键,怎么实现好 at March 31, 2012

    再来个单行的;)

    hash = { :a => 0.5, :b => 0.15, :c => 0.2, :d => 0.15 }
    
    p hash.to_a.map { |el| Array.new(el[1]*100, el[0]) }.flatten.sample
    
    
  • 谁推荐本 ruby 的书啊 at March 31, 2012

    The Well Grounded Rubyist - David Black

    http://www.amazon.com/The-Well-Grounded-Rubyist-David-Black/dp/1933988657

  • 按一定的概率随机给出键,怎么实现好 at March 31, 2012
    hash = { :a => 0.5, :b => 0.15, :c => 0.2, :d => 0.15 }
    keys = []
    
    hash.each do |k, v|
      (v*100).to_i.times { keys << k }
    end
    
    p keys.sample
    
    
  • 大家外语能力如何? at March 30, 2012

    好想学日文啊~ 下载了好多日文的教材,一直没时间没精力学。T__T

  • [求推荐] 写 open api 的工具 at March 29, 2012

    http://swagger.wordnik.com/

  • 用 Capstrano 部署的一点疑惑 at March 23, 2012

    不需要 rails。 需要 git(或其他)。

  • 一直想写一个论坛程序。。。 at March 23, 2012

    #7 楼 @hunter 开发新的产品领域和完善现有系统是两码事。:)

  • 一直想写一个论坛程序。。。 at March 23, 2012

    #3 楼 @gaicitadie iPhone 诞生以前,手机也是满大街的……

    #4 楼 @suffering 嘿嘿,不错啊~ ^_^

  • 觉得 ruby 元编程里的当前类这个名词不是很科学啊。 at March 23, 2012

    #1 楼 @fleuria 这个我之前在另一个帖子里提到过。

    我给同事的解释是——

    Evaluating on the class level provides access to all instances - hence "instance_eval", and evaluating on the instance level provides access to just that class instance - hence "class_eval".

  • pythoner 砸场子来了 at March 22, 2012

    #55 楼 @jhjguxin #56 楼 @skandhas

    你们这是在胡闹么 =。=

    require 'json'
    wtf = "{'a':'va','b':'vb','c':'vc'}".gsub("'",'"')
    JSON.parse wtf
    # => {"a"=>"va", "b"=>"vb", "c"=>"vc"}
    
    
  • 一个小 Bug 引发 github 安全问题泄露。Shit! at March 22, 2012

    那时候我在 Twitter 上说这个应该 gem 化,dhh 还说直接用 Array.slice! 就好了。结果还是 gem 化了。。。嘿嘿嘿~

  • mac 上有其他 office 好用吗,m$ 的处理 csv 有问题 at March 22, 2012

    不过,导入 csv 的时候不是都可以选 csv 的 delimit 方式的么。

  • mac 上有其他 office 好用吗,m$ 的处理 csv 有问题 at March 22, 2012

    除了 Office for Mac,iWork 的 Numbers,还有 LibreOffice(OOo 的变种)外,貌似就没了吧。

  • rails 能不能在 model 中使用 link_to 方法 at March 20, 2012

    SHOCKING HORRRRROR!!! o_O

  • 如何把握 DRY 的度? at March 20, 2012

    routes 是个 manifest,没法 DRY 的。controller 的话,如果大部分功能类似,你可以继承,如果只是小部分功能类似,可以用 mixin。

    Controller 的 composition 例子我手上没有,但 model 的例子可以看这个: https://github.com/fredwu/angel_nest/blob/master/app/models/startup.rb https://github.com/fredwu/angel_nest/tree/master/app/models/concerns

  • 我对 大卫托马斯 有几分崇拜了! at March 20, 2012

    国外这类大牛还是不少的,Uncle Bob, Jim Weirich, Martin Fowler... ^__^

  • Prev
  • 1
  • 2
  • …
  • 19
  • 20
  • 21
  • 22
  • 23
  • …
  • 27
  • 28
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English