This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public Object to_jsonnable(Object o) { | |
if (o instanceof List) { | |
List lo = (List)o; | |
ArrayList nlo = new ArrayList(); | |
for (Object a : lo) nlo.add(to_jsonnable(a)) ; | |
return(nlo); | |
} else if (o instanceof Map) { | |
Map mo = (Map)o; | |
LinkedHashMap<Object, Object> nmo = | |
new LinkedHashMap<Object, Object>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gtk2' | |
############################ SysTray ############################### | |
module Gtk | |
class SysTray < StatusIcon | |
def initialize(window,title="title?",config) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
class Object | |
def invoke_in_shoes_mainloop(&blk) | |
return unless defined?($__shoes_app__) | |
return unless Shoes::App===$__shoes_app__ | |
$__shoes_app__.get_queue().push( blk ) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | |
require 'yajl' | |
require 'benchmark' | |
require 'pp' | |
require 'zlib' | |
def fract(n) n==0? 'eeee' : {"l"+n.to_s => fract(n-1) , :i=> (0..n).to_a, "r"+n.to_s => fract(n-1) } ; end | |
class String ; def zip() Zlib::Deflate.deflate(self,3) end end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pm=ParalleleMap.new( | |
:nbThread => 5, | |
:generator => proc { |res| | |
rfind("/" , ".rb" ) { |file| res << file ; } | |
}, | |
:mapper => proc { |out,in_file_name| | |
selectLine(out,query,in_file_name) | |
}, | |
:reducer =>proc { |rr| reduce(rr) }, | |
:debug => (debug!=nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# S h o e s P 2 P | |
################################################################################ | |
# 2 types of member: | |
# serveur : give only adresses of all member which had connect to him | |
# client : take list of member from one or several serveur, | |
# echange files with others known clients | |
# clients are server too | |
# | |
# so server(s) are necessary only at startup of a client. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'green_shoes' | |
require './p2p.rb' | |
######################" Patch ChipMunk : destroy a shape.... | |
#---------- append shap to attribute | |
ChipMunk # load file (ext are autoloaded by greeen shoes) | |
module ChipMunk | |
def spy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'green_shoes' | |
#require './p2p.rb' | |
######################" Patch ChipMunk : destroy a shape.... | |
#---------- append shap to attribute | |
ChipMunk # load file (ext are autoloaded by greeen shoes) | |
module ChipMunk | |
def spy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'green_shoes' | |
Shoes.app(:title => "Fractal Tree", :width => 600, :height => 600) do | |
background "#000".."#777" | |
stroke "#000" | |
@deg_to_rad = Math::PI / 180.0 | |
C=%w{AA0 EE0 FF0 EE0 EE8 EF8 8F8 7F7 0F0 5BB 0FF FAA} | |
def drawTree(x1, y1, angle, depth) | |
return if depth <= rand(2) | |
s=3+rand(4) | |
x2 = x1 + (Math.cos(angle * @deg_to_rad) * depth * s).to_i |
OlderNewer