Skip to content

Instantly share code, notes, and snippets.

@debbbbie
debbbbie / jquery.tooltiponoverflow.js
Created October 22, 2015 03:47 — forked from UziTech/jquery.tooltiponoverflow.js
jquery plugin for showing tooltip on overflow
/**
* DWTFYW License
* Author: Tony Brix, http://tonybrix.info
*
* jquery plugin for showing tooltip on overflow
*
* USAGE:
*
* $("input, select").tooltipOnOverflow();
*
@debbbbie
debbbbie / gist:9a2968ff17f0c78526a0
Created October 14, 2015 11:59 — forked from zhangyuan/gist:5932220
使用 CarrierWave 和 MiniMagick 合成多张图片、写文字

合成多张图片

以下只适合 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
debbbbie / logger_middleware.rb
Created October 11, 2015 02:04 — forked from skwp/logger_middleware.rb
A request/response logger Rack middleware.
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_'}
#
# 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:'

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.

Usage

Add all microgems to your project's Gemfile:

@debbbbie
debbbbie / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@debbbbie
debbbbie / README.md
Last active August 29, 2015 14:21 — forked from bruth/README.md

sortedGroupBy

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
debbbbie / cmd
Created March 24, 2014 07:26 — forked from pifleo/cmd
$ 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