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 "nokogiri" | |
require "hpricot" | |
require "open-uri" | |
#on my macbook | |
#$ ruby speedtest.rb | |
#uri took: 4.539837 | |
#hpricot took: 3.490182 | |
#nokogiri took: 6.273096 |
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
<?xml version="1.0"?> | |
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" | |
"http://www.wapforum.org/DTD/wml_1.1.xml"> | |
<wml> | |
<card id="card1" title="Tutorial"> | |
<do type="accept" label="Answer"> | |
<go href="#card2"/> | |
</do> | |
<p><select name="name"> |
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
NSDate *date = [NSDate date]; | |
void (^now)(void) = ^ { | |
NSLog(@"The date and time is %@", date); | |
}; | |
now(); | |
sleep(5); | |
date = [NSDate date]; | |
now(); |
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
$ sudo greenpois0n.app/Contents/MacOS/greenpois0n | |
2011-02-13 12:22:09.632 greenpois0n[302:e07] Could not connect the action buttonPressed: to target of class NSApplication | |
2011-02-13 12:22:09.635 greenpois0n[302:e07] Could not connect the action buttonPressed: to target of class NSApplication | |
2011-02-13 12:22:09.636 greenpois0n[302:e07] Could not connect the action buttonPressed: to target of class NSApplication | |
2011-02-13 12:22:09.637 greenpois0n[302:e07] Could not connect the action buttonPressed: to target of class NSApplication | |
Initializing libpois0n | |
No matching processes were found | |
Device must be in DFU mode to continue | |
Device must be in DFU mode to continue | |
opening device 05ac:1227... |
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 "rubygems" | |
rack_app = Proc.new do |env| | |
[200, {"Content-Type"=>"text/html"}, env["REMOTE_ADDR"]] | |
end | |
run rack_app |
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 Foo | |
def self.doit | |
puts "nike" | |
end | |
def bar | |
Foo.doit() | |
end | |
def bar2 |
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 Array | |
def sum | |
inject( nil ) { |sum,x| sum ? sum+x : x } | |
end | |
def mean | |
sum.to_f / size.to_f | |
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
import numpy | |
#your regular array | |
myarray = [123, 221, 3, 16, 199, 0] | |
#convert that to 32 bit integers | |
tmp=numpy.array(myarray, numpy.int32) |
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
*** longjmp causes uninitialized stack frame ***: ruby terminated | |
======= Backtrace: ========= | |
/lib/libc.so.6(__fortify_fail+0x37)[0x7f1bc849d217] | |
/lib/libc.so.6(+0xff1a9)[0x7f1bc849d1a9] | |
/lib/libc.so.6(__longjmp_chk+0x33)[0x7f1bc849d113] | |
/usr/lib/libcurl.so.4(+0x91e5)[0x7f1bc5f001e5] | |
/lib/libpthread.so.0(+0xf8f0)[0x7f1bc8ff88f0] | |
/lib/libpthread.so.0(pthread_cond_wait+0xcc)[0x7f1bc8ff485c] | |
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x180d69)[0x7f1bc9386d69] | |
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x18549b)[0x7f1bc938b49b] |
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
*** longjmp causes uninitialized stack frame ***: ruby terminated | |
======= Backtrace: ========= | |
/lib/libc.so.6(__fortify_fail+0x37)[0x7fee7967e217] | |
/lib/libc.so.6(+0xff1a9)[0x7fee7967e1a9] | |
/lib/libc.so.6(__longjmp_chk+0x33)[0x7fee7967e113] | |
/usr/lib/libcurl.so.4(+0x91e5)[0x7fee75ae21e5] | |
/lib/libpthread.so.0(+0xf8f0)[0x7fee79dab8f0] | |
/lib/libpthread.so.0(pthread_cond_wait+0xcc)[0x7fee79da785c] | |
ruby(_ZN8rubinius7Channel15receive_timeoutEPNS_5StateERNS_11GCTokenImplEPNS_6ObjectEPNS_9CallFrameE+0x3f4)[0x6791e4] | |
ruby(_ZN8rubinius10Primitives15channel_receiveEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x100)[0x62c4f0] |