Skip to content

Instantly share code, notes, and snippets.

@sutetotanuki
sutetotanuki / 0_reuse_code.js
Last active August 29, 2015 14:08
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
@sutetotanuki
sutetotanuki / delete_keys.rb
Created July 25, 2012 04:52
HashのkeyをGrabのような検索してHashの要素を消す。
class Hash
def delete_keys!(match_string)
keys = self.all_keys
keys.each do |key|
if File.fnmatch?(match_string, key, File::FNM_PATHNAME)
h = self
split_key = key.split("/")[1..-1]
@sutetotanuki
sutetotanuki / thread_sample.rb
Created June 30, 2012 03:31
Rubyでthreadを使うサンプルです
# -*- coding: utf-8 -*-
require 'logger'
# Thread, Queueがrequire される
require 'thread'
MAX_THREAD = 5
# STOP queue
STOP = 0x01