Convenience function for performing a groupBy on a list then a sortBy on the resulting groups using Underscore methods.
sortedGroupBy(list, groupByIterator, sortByIterator)
| $ chmod +x ./proxy_list_fetcher.rb | |
| $ ./proxy_list_fetcher.rb | head | |
| 180.94.88.58 8080 Afghanistan fast HTTPS High +KA | |
| 187.87.155.2 8080 Brazil fast HTTPS High +KA | |
| 120.132.132.119 8080 China medium HTTPS High +KA | |
| 210.211.109.244 8081 Viet Nam fast HTTP Low | |
| 216.244.71.143 3128 United States medium HTTPS High +KA | |
| 190.237.224.22 8080 Peru slow HTTPS High +KA |
Convenience function for performing a groupBy on a list then a sortBy on the resulting groups using Underscore methods.
sortedGroupBy(list, groupByIterator, sortByIterator)
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
contrived is a microgem that depends on another microgem array_range, however gemspecs don't support DVCS dependencies. So how do we solve this without prematurely denting the universe?
Just use bundler.
Add all microgems to your project's Gemfile:
| # | |
| # Initialize the stuff | |
| # | |
| # We build the status bar item menu | |
| def setupMenu | |
| menu = NSMenu.new | |
| menu.initWithTitle 'FooApp' | |
| mi = NSMenuItem.new | |
| mi.title = 'Hellow from MacRuby!' | |
| mi.action = 'sayHello:' |
| module Middleware | |
| class Logger | |
| def initialize(app, logger) | |
| @app = app | |
| @logger = logger | |
| end | |
| def call(env) | |
| headers = env.select {|k,v| k.start_with? 'HTTP_'} |
以下只适合 v3.5.0 即以前的版本。v3.6.0 以后,对选项增加了 shellescape 减少了命令行注入的风险。
ImageMagick 的 composite 命令可以合成图片,但是一次只能合成两张。如果需要合成多张图片,得用 convert 命令和 -composite 选项。MiniMagick 的push方法,可添加选项和参数(就像在命令行操作一样)。下是一个合成多张图片的 CarrierWave 的 process 示例。
def composite_images
manipulate! do |img|
img.combine_options(:convert) do |c|| /** | |
| * DWTFYW License | |
| * Author: Tony Brix, http://tonybrix.info | |
| * | |
| * jquery plugin for showing tooltip on overflow | |
| * | |
| * USAGE: | |
| * | |
| * $("input, select").tooltipOnOverflow(); | |
| * |