Opinions are like assholes, every one has got one.
This one is mine.
Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.
| ; Stumbling towards Y | |
| ; | |
| ; The applicative-order Y combinator is a function that allows one | |
| ; to create a recursive function without using define. | |
| ; This may seem strange. Usually a recursive function has to call | |
| ; itself, and thus relies on itself having been defined. | |
| ; | |
| ; Regardless, here we will stumble towards the implementation of the | |
| ; Y combinator (in Scheme). |
| require 'net/http' | |
| require 'uri' | |
| require 'nokogiri' | |
| url = URI.parse('http://webapps.cityofchicago.org/healthinspection/inspectionresultrow.jsp') | |
| request = Net::HTTP::Post.new(url.path) | |
| request.set_form_data({"REST"=>" ", "STR_NBR"=>"", "STR_NBR2"=>"", "STR_DIRECTION"=>"", "STR_NM"=>"", "ZIP"=>""}) |
| import os | |
| from PIL import Image | |
| def extractFrames(inGif, outFolder): | |
| frame = Image.open(inGif) | |
| nframes = 0 | |
| while frame: | |
| frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF') | |
| nframes += 1 |
| /* | |
| * 频率控制 返回函数连续调用时,action 执行频率限定为 次 / delay | |
| * @param delay {number} 延迟时间,单位毫秒 | |
| * @param action {function} 请求关联函数,实际应用需要调用的函数 | |
| * @param tail? {bool} 是否在尾部用定时器补齐调用 | |
| * @return {function} 返回客户调用函数 | |
| */ | |
| var throttle = function(delay,action,tail,debounce) { | |
| var now = Date.now, last_call = 0, last_exec = 0, timer = null, curr, diff, | |
| ctx, args, exec = function() { |
| >> IF = -> b { b } | |
| => #<Proc:0x007fb4e4049cc8 (lambda)> | |
| >> LEFT = -> p { p[-> x { -> y { x } } ] } | |
| => #<Proc:0x007fb4e403d680 (lambda)> | |
| >> RIGHT = -> p { p[-> x { -> y { y } } ] } | |
| => #<Proc:0x007fb4e4028ff0 (lambda)> | |
| >> IS_EMPTY = LEFT |
| function RGBToHSL(r, g, b) { | |
| var | |
| min = Math.min(r, g, b), | |
| max = Math.max(r, g, b), | |
| diff = max - min, | |
| h = 0, s = 0, l = (min + max) / 2; | |
| if (diff != 0) { | |
| s = l < 0.5 ? diff / (max + min) : diff / (2 - max - min); |
| #!/bin/bash | |
| # load resources | |
| xrdb -merge .Xresources | |
| #xsetroot -solid '#222'& | |
| # map caps lock as extra escape | |
| xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'& | |
| # start clipboard manager | |
| parcellite& |
| (function() { | |
| /* == GLOBAL DECLERATIONS == */ | |
| TouchMouseEvent = { | |
| DOWN: "touchmousedown", | |
| UP: "touchmouseup", | |
| MOVE: "touchmousemove" | |
| } | |
| /* == EVENT LISTENERS == */ |
| # | |
| # $> ruby load.rb http://data.githubarchive.org/2012-04-01-15.json.gz | |
| # | |
| require 'yajl' | |
| require 'zlib' | |
| require 'sqlite3' | |
| require 'open-uri' | |
| input = ARGV.shift |