Instantly share code, notes, and snippets.
- Tab Computing
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
classEmail | |
attr:headers | |
attr:body | |
definitialize | |
@headers=Multimap.new | |
@body="" | |
end | |
defparse(io) |
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
$argv= [] ofString | |
defcli(argv=ARGV) | |
# Convert single dash flags into multiple flags. | |
a= [] ofString | |
argv.eachdo |v| | |
if v[0,1]=="-"&& v[1,1]!="-" | |
a.concat(v[1..-1].chars.map{|c|"-#{c}"}) | |
else | |
a<< v |
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
defcli(opts :Hash(String,Proc)) | |
cli(ARGV.dup, opts) | |
end | |
defcli(argv :Array(String), opts :Hash(String,Proc)) | |
args= [] ofString | |
# Split option aliases. | |
h= {} ofString =>-> | |
opts.eachdo |k,v| |
trans /tk-8.5.10.1.sh
Last activeAugust 29, 2015 14:10
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 is a build script made for ruby-install, though it may be out of date by now. | |
# Still the same basic approach applies. | |
# @see http://www.tkdocs.com/tutorial/install.html | |
# TODO: Add support for MacOS. | |
if [-z$installdir ];then | |
installdir="/opt/ActiveTcl-8.5" | |
fi |
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 runhaskell | |
importText.Pandoc | |
importText.Pandoc.Shared | |
importText.Pandoc.JSON | |
importText.Parsec | |
importText.Regex | |
importControl.Applicative | |
importData.Monoid | |
importData.List |
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
# Notes: Notice there is no `module Gtk` at the top. b/c not the file _is_ the module. | |
# | |
# The term `use` was chosen just to differentiate from the others. It would | |
# probably be called `import` in the end. | |
# | |
# The complex imports for GLib are gone. Why does there need to be a separate | |
# and specific import just b/c a function is going to be extended. The same is | |
# true for Base. | |
# | |
# The arguments are just file names and could also be written, e.g. `("GLib/Glib")`. |
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
---!!yaml | |
- !!version "2.0" | |
- !!tags | |
"!!":"tag:example.com,2000:app/" | |
--- | |
!!int 1 - 3# Interval, not integer |
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
# Postponed Evaluation of Arguments | |
Today in Ruby, there are a few special `methods' in that they do not seem to evaluate their arguments. An example is alias, which contrary to Module#alias_method does not take symbols as arguments, but instead takes the method names directly. This cannot be done by pure Ruby code as the method name would be evaluated by calling the method and taking the return value as the actual value of the parameter. The idea would be to give a method control over this. There are lots of unanswered questions though: | |
Languages like Lisp can do this in their macros because code is data and can easily be manipulated. In Ruby, code is not data (yet). It would be nice if it could be data. This requires the representation of a parse tree (although that may change with the advent of YARV) that can be inspected or even manipulated. This would be a powerful tool by itself, but at least inspection is required to make full use of the idea of postponed evaluation of arguments. | |
How is it indicated |
NewerOlder