Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@trans
trans /email-parser.rb
CreatedDecember 10, 2017 01:51
Parse Email Crude
classEmail
attr:headers
attr:body
definitialize
@headers=Multimap.new
@body=""
end
defparse(io)
@trans
trans /clik2.cr
CreatedSeptember 21, 2015 03:23
$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
@trans
trans /clik.cr
CreatedAugust 10, 2015 03:36
Crystal port of Clik
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|
# 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
@trans
trans /indexfilter.jl
CreatedAugust 14, 2014 15:55
Index filter for Pandoc
#!/usr/bin/env runhaskell
importText.Pandoc
importText.Pandoc.Shared
importText.Pandoc.JSON
importText.Parsec
importText.Regex
importControl.Applicative
importData.Monoid
importData.List
@trans
trans /AltGtk.jl
Last activeAugust 29, 2015 14:05
Another Look at Julia's Import/Module Syatem
# 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")`.
@trans
trans /igny2.yaml
Last activeAugust 29, 2015 14:04
---!!yaml
- !!version "2.0"
- !!tags
"!!":"tag:example.com,2000:app/"
---
!!int 1 - 3# Interval, not integer
@trans
trans /postponed-arguments
CreatedJune 2, 2014 16:47
Postponed Evaluation of Arguments
# 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

[8]ページ先頭

©2009-2025 Movatter.jp