This file contains 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
(*This folder action script is designed to keep your downloads folder organised *) | |
property image_extension_list : {"tif", "tiff", "gif", "png", "pict", "pct", "jpg"} | |
property media_extension_list : {"mp3", "avi", "mov", "mpg"} | |
property document_extension_list : {"doc", "pdf", "ps", "mpg"} | |
property archive_extension_list : {"zip", "sit", "dmg", "tar", "hqx", "toast", "rar"} | |
property torrent_extension_list : {"torrent"} | |
property image_foldername : "images" |
This file contains 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 | |
RLSP_VERSION = "1.4.2" | |
class Lambda | |
attr_accessor :args, :body | |
def initialize(args=[],body="") | |
@args = (args.class == Array) ? args : [args] | |
@body = body | |
end |
This file contains 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
adriano@planck:~/Projects/pubsub_test1$ python pubsub_test1.py | |
DEBUG Loaded Plugin (XEP-0060) Publish-Subscribe | |
WARNING Deprecated add_handler used for <message><x xmlns='jabber:x:data' /></message>: <bound method xep_0004.handler_message_xform of <sleekxmpp.plugins.xep_0004.xep_0004 object at 0x1007ca310>>. | |
DEBUG Loaded Plugin (XEP-0004) Data Forms | |
WARNING Deprecated add_handler used for <iq type='get' xmlns='jabber:client'><query xmlns='http://jabber.org/protocol/disco#info' /></iq>: <bound method xep_0030.info_handler of <sleekxmpp.plugins.xep_0030.xep_0030 object at 0x1007ca510>>. | |
WARNING Deprecated add_handler used for <iq type='get' xmlns='jabber:client'><query xmlns='http://jabber.org/protocol/disco#items' /></iq>: <bound method xep_0030.item_handler of <sleekxmpp.plugins.xep_0030.xep_0030 object at 0x1007ca510>>. | |
DEBUG Loaded Plugin (XEP-0030) Service Discovery | |
DEBUG Did not supply (address, port) to connect to and no SRV support is installed (http://www.dnspython.org). Continuing to |
This file contains 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
def cached_result opts | |
puts opts | |
end | |
cached_result :for => 'bleh', :or => do 1+2 end | |
# Problem when executing: | |
#t.rb:5: syntax error, unexpected keyword_do_block | |
#cached_result :for => 'bleh', :or => do 1+2 end | |
# ^ |
This file contains 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 Data.Char;h 1 _=1;h x m|any(==x)m=0;h x m=h(sum$map((^2).digitToInt)$show x)(x:m);main=print$h 7 [] |
This file contains 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
fizz n = n `mod` 3 == 0 | |
buzz n = n `mod` 5 == 0 | |
fizzbuzzFor n | fizz n && buzz n = "fizzbuzz" | |
| fizz n = "fizz" | |
| buzz n = "buzz" | |
| otherwise = show n | |
main = mapM_ (putStrLn . fizzbuzzFor) [1..100] |
This file contains 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
-- Stefan van den Oord, 2010-12-29 | |
-- The "cd to" command for iTerm2 | |
-- Original from: http://code.google.com/p/iterm2/wiki/AppleScript | |
-- Modified to open a new tab instead of a new window | |
tell application "Finder" | |
set _cwd to POSIX path of ((folder of (front window)) as alias) | |
end tell | |
tell application "iTerm" |
This file contains 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
Parsing... | |
macro.mirah | |
Inferring types... | |
Inference Error: | |
Could not infer typing for nodes: | |
FunctionalCall(find_class) | |
Call(parent) | |
Field(call) at line 14 (child of LocalAssignment(name = class_node, scope = MethodDefinition(_expand), captured = false)) | |
macro.mirah:12: Could not infer typing for nodes: | |
FunctionalCall(find_class) |
This file contains 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
-- Make: ghc --make groups.hs | |
-- Run: echo -e "[4,3,3,2]\n[5,3,2,1,1,3,5]\n[4,5]" | ./groups | |
import System.IO | |
import Data.List | |
isSameSolution f (s1,s2) = f == (s2,s1) | |
discardDuplicated = nubBy isSameSolution | |
uniqueSubsequences = filter ((/=0).length) . nub . subsequences | |
solutionsFor list = discardDuplicated solutions |
This file contains 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 | |
input_map = IO.readlines(ARGV[0]).inject({}) do |memo, line| | |
field_name, fstart, fend = line.match(/(\S+)\s+([0-9]+)-([0-9]+)/).captures | |
range = Range.new(fstart.to_i, fend.to_i) | |
memo.merge({field_name => range}) | |
end | |
class Parser | |
attr_accessor :line |
OlderNewer