Skip to content

Instantly share code, notes, and snippets.

View cmd
$ chmod +x ./proxy_list_fetcher.rb
$ ./proxy_list_fetcher.rb | head 8080 Afghanistan fast HTTPS High +KA 8080 Brazil fast HTTPS High +KA 8080 China medium HTTPS High +KA 8081 Viet Nam fast HTTP Low 3128 United States medium HTTPS High +KA 8080 Peru slow HTTPS High +KA


jsFiddle Example

Convenience function for performing a groupBy on a list then a sortBy on the resulting groups using Underscore methods.

sortedGroupBy(list, groupByIterator, sortByIterator)
debbbbie / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Contrived example demonstrating microgem dependencies

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:

View mr_status_bar_app.rb
# Initialize the stuff
# We build the status bar item menu
def setupMenu
menu =
menu.initWithTitle 'FooApp'
mi =
mi.title = 'Hellow from MacRuby!'
mi.action = 'sayHello:'
debbbbie / logger_middleware.rb
Created Oct 11, 2015 — forked from skwp/logger_middleware.rb
A request/response logger Rack middleware.
View logger_middleware.rb
module Middleware
class Logger
def initialize(app, logger)
@app = app
@logger = logger
def call(env)
headers = {|k,v| k.start_with? 'HTTP_'}
debbbbie / gist:9a2968ff17f0c78526a0
Created Oct 14, 2015 — forked from zhangyuan/gist:5932220
使用 CarrierWave 和 MiniMagick 合成多张图片、写文字
View gist:9a2968ff17f0c78526a0


以下只适合 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|
debbbbie / jquery.tooltiponoverflow.js
Created Oct 22, 2015 — forked from UziTech/jquery.tooltiponoverflow.js
jquery plugin for showing tooltip on overflow
View jquery.tooltiponoverflow.js
* DWTFYW License
* Author: Tony Brix,
* jquery plugin for showing tooltip on overflow
* $("input, select").tooltipOnOverflow();
debbbbie / gist:7656037
Last active Dec 29, 2015
Add a test: every redis commands should be realized in redis-namespace
View gist:7656037
it "every redis commands should be realized in redis-namespace" do
# Use{|m|m.to_sym} for backward compatible till ruby1.8
r_methods = (Redis.public_instance_methods(false) - MonitorMixin.public_instance_methods).map{|m|m.to_sym} -
[:client, :synchronize, :with_reconnect, :without_reconnect, :connected?, :id, :method_missing, :inspect, :_bpop, :_eval, :_scan ]
rns_methods = (Redis::Namespace::COMMANDS.keys + Redis::Namespace.public_instance_methods(false)).map{|m|m.to_sym}
do_not_needs = [:slowlog, :sync, :time, :migrate, :subscribed?, :unwatch, :script]
(r_methods - rns_methods - do_not_needs).should eq([])