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 | |
| # | |
| # Ruby, ruby, ruby | |
| # | |
| DATA.each{|line| puts "#{DATA.lineno}: #{line}"} | |
| __END__ | |
| Line one | |
| Line two | |
| Line three :D |
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 | |
| # | |
| # Allow the user to query the status of several running totals via multiple | |
| # background threads | |
| code = lambda do | |
| Thread.current[:x] = 0 | |
| loop do | |
| Thread.current[:x] += 1 | |
| Thread.pass |
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/python2 | |
| import sys | |
| arg = sys.argv | |
| if len(arg) != 3: | |
| exit(1) | |
| infile = arg[1] | |
| outfile = arg[2] |
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
| Ruby | |
| real 0m2.820s | |
| user 0m1.887s | |
| sys 0m0.040s | |
| ------------------------------------------------------------------------------ | |
| Perl | |
| real 0m1.344s | |
| user 0m1.047s |
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 | |
| data = DATA.read | |
| data.gsub! '\:', "\0" | |
| pieces = data.split ":" | |
| pieces.each do |piece| | |
| piece.gsub! "\0", '\:' | |
| end | |
| puts pieces | |
| __END__ | |
| 5082333~GBP~ACTIVE~0~1~NR\: (RSA) <br>8. Fan Mail (0%,11\:07), 6(2.5%,11\:08)~true~5.0~1162835723938~6. Earlswood,9.08,2.5;8. Fan Mail,9.07,2.4;Y:1058616~0~6.04~8.4~~11.9~false||:670160~1~6.18~17.5~~4.2~false||:113 2008~2~9.78~5.2~~20.4~false||:894820~3~140.02~4.6~~20.4~false||1.01~5.0~B~1~:1414415 ~4~8.2~6.2~~16.0~false||:575636~5~5.54~11.5~~8.6~false||:1433455~6~0.0~~~0.4~false|| :1433456~7~0.0~~~0.9~false||:746753~8~5.54~11.5~~5.2~false||:1433457~9~0.0~~~4.2 se||:1147548~10~0.0~~~2.6~false||:1433458~11~62.46~2.0~~3.5~false||:1433459~12~0.0~~ ~ 0.9~false||:1433460~13~0.0~~~0.9~false|| |
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 python2 | |
| # Python | |
| # lolz | |
| occurences = {} | |
| string = raw_input('string> ') | |
| for character in string: | |
| occurences[character] = occurences.get(character, 0) + 1 |
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
| #=====================================================================# | |
| # General # | |
| #=====================================================================# | |
| # Min | Hour | Mday | Month | Wday | Command # | |
| #=====================================================================# | |
| # * * * * * $HOME/bin/gmail.rb | |
| 0 5 * * * $HOME/bin/dotbackup.rb | |
| # */15 * * * * $HOME/bin/temp-help.sh | |
| #=====================================================================# |
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
| module Main where | |
| -- Define the BST data type | |
| data BST a = Node (BST a) (BST a) a | |
| | Tip | |
| deriving (Show, Eq) | |
| -- Make a leaf node | |
| leaf y = Node Tip Tip y |
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
| module List where | |
| data List a | |
| = Null | |
| | Node (List a) a | |
| deriving (Show, Eq) | |
| build = build' Null | |
| where | |
| build' Null [] = Null |
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
| module BST where | |
| -- Define the BST data type | |
| data BST a | |
| = Node (BST a) (BST a) a | |
| | Tip | |
| deriving (Show, Eq) | |
| -- Make a leaf node | |
| leaf y = Node Tip Tip y |
OlderNewer