08 2017 档案
如何调用npm已经安装在全局位置的模块
摘要:参考链接 https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders npm install xxx -g通常安装在全局目录 在你的bashrc或者zashrc中导出全局目录 在你的package.json中 阅读全文
posted @ 2017-08-31 22:10 c3tc3tc3t 阅读(2081) 评论(0) 推荐(0)
ruby **option作为函数参数,map的key必须是符号
摘要:# NEW UNNAMED KEYWORD ARGUMENTSdef new_way(**options)return options[:foo]end# => :new_waynew_way(foo: "bar")# => "bar"new_way# => nil 这里传递给new_way方法的m 阅读全文
posted @ 2017-08-27 11:03 c3tc3tc3t 阅读(625) 评论(0) 推荐(0)
计算2..n的素数
摘要:def check(2) , do: true def check(n) when n >2 do b = for x 2 do for x 2" IO.inspect(span2(40)) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] 阅读全文
posted @ 2017-08-22 09:52 c3tc3tc3t 阅读(151) 评论(0) 推荐(0)
elixir二进制模式匹配
摘要:for << << b1::size(2), b2::size(3), b3::size(3) >> <- "hello" >>, ...> do: "0#{b1}#{b2}#{b3}" ["0150", "0145", "0154", "0154", "0157"] 1) 字母h的 ascii码的 阅读全文
posted @ 2017-08-21 20:58 c3tc3tc3t 阅读(601) 评论(0) 推荐(0)