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
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'cgi' | |
require 'pp' | |
require 'yaml' | |
require 'rake' | |
module GitHub | |
module Connectivity |
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
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 |
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
class X | |
def foo | |
puts "X" | |
end | |
end | |
module A | |
def foo | |
print "A -> " | |
super |
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
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' |
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 '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 |
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
>> 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 |
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
class File | |
def tail(n) | |
buffer = 1024 | |
idx = (size - buffer).abs | |
chunks = [] | |
lines = 0 | |
begin | |
seek(idx) | |
chunk = read(buffer) |
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
#!/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 |
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 '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 |
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
def higher_order | |
lambda{|arg| arg + yield(5) } | |
end | |
foo = lambda{|arg| arg + 1 } | |
higher_order(&foo).(3) # => 9 |