Skip to content

Instantly share code, notes, and snippets.

#
# 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 / memcached_status_check
Last active August 29, 2015 14:21
status_check_shell
prog_stats memcached
@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
@debbbbie
debbbbie / 64进制互转
Created January 16, 2014 06:30
64进制互转
#coding=gbk
digit64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/'
def int_to_str64( x ):
try:
x=int(x)
except:
x=0
if x<0:
x=-x
if x==0:
@debbbbie
debbbbie / 16-62进制互转
Last active August 26, 2022 12:39
[python]16-62进制互转
#coding=gbk
#
#62进制,特别合于月、日、时、分、秒的压缩进储
#
digit62 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
#整数转化为62进制字符串
#入口:
# x : 整数
#返回: 字符串
def int_to_str62( x ):
@debbbbie
debbbbie / gist:7656037
Last active December 29, 2015 10:19
Add a test: every redis commands should be realized in redis-namespace
it "every redis commands should be realized in redis-namespace" do
# Use methods.map{|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([])
end