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' | |
require 'rubygems' | |
require 'publisher' | |
COUNT = 10_000_000 | |
class Eventer | |
extend Publisher | |
def initialize |
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
%% | |
%% Ad-hoc hot-code swap upgrade definitions file. Unlike .appup and .relup, | |
%% this is a pure Erlang file. Use this module to define how an upgrade is supposed | |
%% to take place for this system. | |
%% | |
%% Usage of this module is simple. You need to define up() and down() methods for | |
%% each version of the application. On an upgrade, the upgrade_manager will call | |
%% up(NewVsn) for upgrades. If you need to roll back, it will call down(NewVsn) | |
%% (with NewVsn being the version defined in your .app file). | |
%% |
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 A | |
def method_missing(*args) | |
puts "Missing in A" | |
end | |
end | |
class B < A | |
def method_missing(*args) | |
puts "Missing in B" | |
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
# david_koontz hkhalid: here's a practice Ruby problem, | |
# given the Array [4, 53, 27, 81, 90] | |
# return all elements that are odd | |
puts [4, 53, 27, 81, 90].select {|n| n.odd? } |
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
roelofs@trillian ~ $ multiruby -e "puts({}.hash == {}.hash)" | |
VERSION = 1.8.6-p368 | |
CMD = ~/.multiruby/install/1.8.6-p368/bin/ruby -e puts({}.hash == {}.hash) | |
false | |
RESULT = 0 | |
VERSION = 1.8.7-p72 |
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/perl -w | |
# | |
# Simple Flash Socket Policy Server | |
# http://www.lightsphere.com/dev/articles/flash_socket_policy.html | |
# | |
# Copyright (C) 2008 Jacqueline Kira Hamilton | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or |
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
import flash.system.Security; | |
... | |
Security.loadPolicyFile("xmlsocket://" + securityServiceHost + ":" + securityServicePort); |
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
#include <iostream> | |
using namespace std; | |
template<class ArgType> | |
void func(int val, ArgType arg) { | |
cout << "In func, val is " << val << " and arg is " << arg << endl; | |
} | |
int main() { |
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
irb(main):005:0> var = 14 | |
=> 14 | |
irb(main):006:0> b1 = proc {|var| 10 * var } | |
=> #<Proc:0xb7c4806c@(irb):6> | |
irb(main):007:0> b1.call(12) | |
=> 120 | |
irb(main):008:0> var | |
=> 12 | |
irb(main):009:0> var = 14 | |
=> 14 |
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
str1 = "this is a pretty \ | |
cool way of going about \ | |
makeing really long | |
\ | |
and neat strings \ | |
yo" | |
str2 =<<-END | |
And this way you | |
dont' need a slash |