Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'open-uri'
require 'cgi'
require 'pp'
require 'yaml'
require 'rake'
module GitHub
module Connectivity
packets = [
"\000\020 0@splitnum\000\000\000hostname\000[C&B] Titan Moving 24/7 [DK]\000gamename\000stella\000gamever\0001.10.48.0\000mapname\000Suez_Canal\000gametype\000gpm_ti\000gamevariant\000bf2142\000numplayers\0001\000maxplayers\00048\000gamemode\000openplaying\000password\0000\000timelimit\0000\000roundtime\0002\000hostport\00017567\000bf2142_ranked\0001\000bf2142_anticheat\0001\000bf2142_autorec\0000\000bf2142_d_idx\000http://bf.killercreation.co.uk/demos/bf2142/81.19.208.40/17567/\000bf2142_d_dl\000http://bf.killercreation.co.uk/demos/bf2142/81.19.208.40/17567/\000bf2142_voip\0001\000bf2142_autobalanced\0000\000bf2142_friendlyfire\0001\000bf2142_tkmode\000No Punish\000bf2142_startdelay\00015\000bf2142_spawntime\00015.000000\000bf2142_sponsortext\000Welcome to Crash & Burn - http://www.crashburn.org\000bf2142_sponsorlogo_url\000http://www.crashburn.eu/images/2142_logo.png\000bf2142_communitylogo_url\000http://www.crashburn.eu/images/2142_logo.png\000bf2142_scorelimit\0000\000bf2142_ticketratio\0001
class X
def foo
puts "X"
end
end
module A
def foo
print "A -> "
super
diff --git a/examples/app/blog/app.rb b/examples/app/blog/app.rb
index f17e88b..6faae01 100644
--- a/examples/app/blog/app.rb
+++ b/examples/app/blog/app.rb
@@ -69,3 +69,8 @@ end
require 'model/init'
require 'controller/init'
+
+require 'ramaze/contrib/app_graph'
@manveru
manveru / iseq.rb
Created September 13, 2010 06:14
require 'ffi'
module RB
extend FFI::Library
ffi_lib [:ruby]
attach_function :iseq_load, :rb_iseq_load, [:pointer, :int, :pointer], :pointer
attach_function :iseq_eval, :rb_iseq_eval, [:pointer], :pointer
attach_function :eval_string, :rb_eval_string, [:string], :pointer
>> puts lambda{ a = [*1..100] }.block.method.decode
0000: push_cpath_top
0001: find_const 0
0003: meta_push_1
0004: push_int 100
0006: send_stack :new, 2
0009: cast_array
0010: set_local 0
0012: ret
=> nil
class File
def tail(n)
buffer = 1024
idx = (size - buffer).abs
chunks = []
lines = 0
begin
seek(idx)
chunk = read(buffer)
#!/usr/bin/ruby
$stdout.sync = true
while now = Time.now
# now = Time.at 60 * 30
print "De tijd is nu: #{now.strftime("%H:%M:%S")}"
if now.min + now.sec == 0
print " ", "." * now.hour
require 'benchmark'
class Numeric
def split_digits_1(base = 10)
# head, last = self.divmod(base)
head = self / base
last = self % base
head < base ? [head, last] : head.split_digits_1(base).push(last)
end
@manveru
manveru / higher.rb
Created September 22, 2010 08:56 — forked from hackervera/higher.rb
def higher_order
lambda{|arg| arg + yield(5) }
end
foo = lambda{|arg| arg + 1 }
higher_order(&foo).(3) # => 9