Skip to content

Instantly share code, notes, and snippets.

View glurp's full-sized avatar

Abby Archer glurp

View GitHub Profile
@glurp
glurp / rupy_source_example.py
Created December 11, 2012 12:31
rupy source example
require 'benchmark'
REP = 10
puts 'Generating data...'
class Array
def qsort
return self if length <= 1
pivot = self[0]
less, greatereq = self[1..-1].partition { |x| x < pivot }
less.qsort +[pivot] + greatereq.qsort
@glurp
glurp / rupy_dest_example.rb
Created December 11, 2012 12:33
rupy result
require 'benchmark'
REP = 10
puts 'Generating data...'
class Array
def qsort
return self if length <= 1
pivot = self[0]
less, greatereq = self[1..-1].partition { |x| x < pivot }
less.qsort +[pivot] + greatereq.qsort
@glurp
glurp / gtk3.css
Last active December 11, 2015 20:49
a theme for gnome3 on windows
/* put this file in
*
D:\usr\Ruby\ruby19\lib\ruby\gems\1.9.1\gems\gdk3-1.2.0-x86-mingw32\vendor\local\...
* ...share\themes\GreyBird\gtk-3.0\gtk.css
*
* update the file :
*
ruby19\lib\ruby\gems\1.9.1\gems\gdk3-1.2.0-x86-mingw32\vendor\local\etc\...
* ..gtk-3.0\settings.ini
* with :
@glurp
glurp / node_pdfkit_writetest.js
Created February 1, 2013 18:58
Tst pbif pdf generation witj 400,000 images
var PDFDocument = require('pdfkit');
var ML=2000
var MC=200
var px=6000/ML
var py=4000/MC
doc = new PDFDocument({margin: 10,size: [6000,4000]});
for (var col=0;col<ML*px;col+=px)
for (var li=0;li<MC*py;li+=py)
doc.image('test.png', col,li,{fit:[px,py]});
@glurp
glurp / reflexion.rb
Created February 28, 2013 18:19
Ripper and sourcify
require 'sourcify'# AST from ruby byte code
require 'ripper' # AST from string code
require 'pp'
def ripp(code)
puts "-"*70
puts code
puts "- "*35
pp Ripper.sexp(code)
end
@glurp
glurp / dependency.rb
Last active December 15, 2015 06:09
find gem dependency for a list of gem in current ruby environment
# Show dependencies of current ruby config
require 'tsort'
def prequire(n)
puts "require #{n} ..."
begin
require n.to_s
rescue Exception => e
puts " Error : #{e}"
end
@glurp
glurp / mouse.rb
Created June 17, 2013 19:23
push mouse event to any browser connected
require 'sinatra'
require 'sinatra'
require 'sinatra-websocket'
set :server, 'thin'
set :sockets, []
get '/' do
if !request.websocket?
erb :index
@glurp
glurp / video.rb
Last active December 25, 2015 02:19
Ruiby.app width: 600,height: 400 do
video_url="file:///#{ARGV[0] || "d:/usr/XT.avi"}"
stack do
@v=video(video_url,600,400-40) {|progress| @prog && @prog.progress=progress*100 }
flowi {
buttoni(" Start ") { @v.play }
buttoni(" Stop ") { @v.stop }
@prog=slider(0,0,100.0) { |pos| @v.progress= pos/100.0}
buttoni(" Exit ") { exit!(0) }
}
@glurp
glurp / gol.rb
Last active December 27, 2015 19:09
Gol
require 'Ruiby'
Ruiby.app width: 400, height: 300, title: "Game of Life" do
def freemap() [[false]*MAXL]*MAXC end
MAXC=MAXL=100
PASX=default_width/MAXC
PASY=(default_width)/MAXL
@mat=freemap()
@run=false
@glurp
glurp / regis_duck.rb
Last active January 3, 2016 21:18
My Ruby Robots
class RegisDuck
include Robot
def startup
@last_hit=0
@sens=1
turn_radar 1
turn_gun 0
@v=3
@mt=0