Skip to content

Instantly share code, notes, and snippets.

module BugWalkSimulation
describe Bug, "#dead?" do
it "should be false when the number of moves is less than the moves lifetime" do
bug = new_bug(:moves_lifetime => 3)
bug.expects(:number_of_moves).returns(2)
bug.should_not be_dead
end
it "should be true when the number of moves is greater than the moves lifetime" do
bug = new_bug(:moves_lifetime => 2)
              __   _____   ______    ,'´ ̄ ̄ ̄ ̄ ̄ヽ.
             ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、   | そ .お ご お |
             'r ´          ヽ、ン、 | れ .風 飯 帰.|
            ,'==─-      -─==', i  | と 呂 に な |
_|\∧∧/|_   i イ iゝ、イ人レ/_ルヽイ i | | も に す  さ |
\       /   レリイi (ヒ_]     ヒ_ン ).| .|、i .|| | ・  す る  い.|
<    じ   >    !Y!""  ,___,   "" 「 !ノ i | | ・  る ? .ア |
/       \   L.',.   ヽ _ン    L」 ノ| .| | ・  ?    ナ |
 ̄|/∨∨\| ̄    | ||ヽ、       ,イ| ||イ| /  |        タ |
             レ ル` ー--─ ´ルレ レ´  ヽ、_____ノ
   _,,....,,_  _人人人人人人人人人人人人人人人_
-''":::::::::::::`''>   はやく帰ってね!!!      <
ヽ::::::::::::::::::::: ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄
 |::::::;ノ´ ̄\:::::::::::\_,. -‐ァ     __   _____   ______
 |::::ノ   ヽ、ヽr-r'"´  (.__    ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、
_,.!イ_  _,.ヘーァ'二ハ二ヽ、へ,_7   'r ´          ヽ、ン、
::::::rー''7コ-‐'"´    ;  ', `ヽ/`7 ,'==─-      -─==', i
r-'ァ'"´/  /! ハ  ハ  !  iヾ_ノ i イ iゝ、イ人レ/_ルヽイ i |
!イ´ ,' | /__,.!/ V 、!__ハ  ,' ,ゝ レリイi (ヒ_]     ヒ_ン ).| .|、i .||
`!  !/レi' (ヒ_]     ヒ_ン レ'i ノ   !Y!""  ,___,   "" 「 !ノ i |
    _,,....,,_  _人人人人人人人人人人人人人人人_
 -''":::::::::::::`''>   ゆっくりしていってね!!!   <
 ヽ::::::::::::::::::::: ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄
  |::::::;ノ´ ̄\:::::::::::\_,. -‐ァ     __   _____   ______
  |::::ノ   ヽ、ヽr-r'"´  (.__    ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、
 _,.!イ_  _,.ヘーァ'二ハ二ヽ、へ,_7   'r ´          ヽ、ン、
 ::::::rー''7コ-‐'"´    ;  ', `ヽ/`7 ,'==─-      -─==', i
 r-'ァ'"´/  /! ハ  ハ  !  iヾ_ノ i イ iゝ、イ人レ/_ルヽイ i |
 !イ´ ,' | /__,.!/ V 、!__ハ  ,' ,ゝ レリイi (ヒ_]     ヒ_ン ).| .|、i .||
 `!  !/レi' (ヒ_]     ヒ_ン レ'i ノ   !Y!""  ,___,   "" 「 !ノ i |
@nagayama
nagayama / gist:2108
Created July 24, 2008 10:02 — forked from cho45/gist:2106
undefined
   _,,....,,_  _人人人人人人人人人人人人人人人_
-''":::::::::::::`''>   だが断る!!!      <
ヽ::::::::::::::::::::: ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄
 |::::::;ノ´ ̄\:::::::::::\_,. -‐ァ     __   _____   ______
 |::::ノ   ヽ、ヽr-r'"´  (.__    ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、
_,.!イ_  _,.ヘーァ'二ハ二ヽ、へ,_7   'r ´          ヽ、ン、
::::::rー''7コ-‐'"´    ;  ', `ヽ/`7 ,'==─-      -─==', i
r-'ァ'"´/  /! ハ  ハ  !  iヾ_ノ i イ iゝ、イ人レ/_ルヽイ i |
!イ´ ,' | /__,.!/ V 、!__ハ  ,' ,ゝ レリイi (ヒ_]     ヒ_ン ).| .|、i .||
`!  !/レi' (ヒ_]     ヒ_ン レ'i ノ   !Y!""  ,___,   "" 「 !ノ i |
@sids
sids / xml_twig.pl
Created July 24, 2008 10:30
Perl: XML Parsing and creation examples.
#!/usr/bin/perl
use strict; use warnings;
use XML::Twig;
my $t= XML::Twig->new( twig_handlers =>
{
'level(2)' => \&filter_doc
},
pretty_print => 'indented',
output_filter => 'safe'
class Foo
class Bar
end
end
@sids
sids / README
Created July 24, 2008 11:01
Perl: Unicode handling
http://gist.github.com/2118
Unicode handling in Perl.
# Authentication
def socks_authenticate
Socksify::debug_debug "Sending no authentication"
write "\005\001\000"
Socksify::debug_debug "Waiting for authentication reply"
auth_reply = recv(1)
if auth_reply[0] != 4 and auth_reply[0] != 5
raise SOCKSError.new("SOCKS version #{auth_reply[0]} not supported")
end
auth_reply = recv(1)
@sids
sids / PackTest.java
Created July 24, 2008 11:30
Perl: I/O examples
import java.io.DataOutputStream;
public class PackTest {
public static void main (String[] args) throws Exception {
DataOutputStream out = new DataOutputStream(System.out);
out.writeInt(11351);
out.flush();
}
}