goj@abulafia ~ $ tail ~/.bashrc
function apply() {
cmd=$1
shift
for x in $*; do $cmd $x; done
}
function go() {
$@
cd ${!#}
}
Much better now. :)
goj@abulafia ~ $ tail ~/.bashrc
function apply() {
cmd=$1
shift
for x in $*; do $cmd $x; done
}
function go() {
$@
cd ${!#}
}
My Motto: "Why program by hand in five days what you can spend five years of your life automating?"
hg init my_repo; cd my_repo
mkdir -p a/b/c/d; cd a/b/c/d
mv my_file /tmp; cd /tmpmkdir -p a/b/c/d; cd !$go hg init my_repo
go mkdir -p a/b/c/d
go mv my_file /tmp$1 is the first argument, $2 - second and $# - argument count and $@ all arguments as an array... yes, you guessed it. It's ${!#}$$# ${$#} ${${#}} $@[$#].goj@abulafia tmp $ cat go
#!/bin/bash
$@
cd ${!#}goj@abulafia tmp $ ./go echo ~
/home/goj
goj@abulafia tmp $goj@abulafia tmp $ . ./go echo ~
/home/goj
goj@abulafia ~ $goj@abulafia tmp $ echo 'alias go=". go-source-me"' >> ~/.bashrc
goj@abulafia tmp $ mv go ~/bin/go-source-megoj@abulafia tmp $ go echo ~
/home/goj
goj@abulafia ~ $
ExtFilterDefine ortozawal mode=output intype=text/html cmd="/usr/local/bin/ortozawal"
ExtFilterDefine ungzip-filter mode=output intype=text/html cmd="/bin/gunzip -"
ExtFilterDefine gzipme-filter mode=output intype=text/html cmd="/bin/gzip"
ExtFilterDefine flip-image mode=output cmd="/usr/bin/convert - -flip -"
<Location "/forum">
SetOutputFilter ungzip-filter;ortozawal;gzipme-filter
</Location>
<Location "/forum/images">
SetOutputFilter flip-image
</Location>
eval in LISP it's just a big cond. It translates directly to if/elif/elif/... which doesn't look good. I used dict of functions instead, which looks better in my eyes. Uses as many Python features as possible. Python functions, python lists. etc.
class slist(object):
class iterator(object):
def __init__(self, lst):
self.lst = lst
def next(self):
if self.lst:
result = self.lst.car
self.lst = self.lst.cdr
return result
else: raise StopIteration
def __iter__(self):
return slist.iterator(self)
def __init__(self, a, b=None):
self.car = a
self.cdr = b
def __str__(self):
return '(%s)' % ' '.join(str(elem) for elem in self)
list_123 = slist(1, slist(2, slist(3)))
a, b, c = list_123
date("L"), yes they did their own calculations (using sqrt?!?), and yes, they f*ck*d it badly. Awful switch full of magic numbers (hello, PHP is a junk, but it has loops and arrays) is just a minor ugliness.
I've just read Terence Parr's post titled "How To Read C Declarations". The quoted "Golden Rule" makes reading declarations really easy even for a drunk ape, but it's one of the kind I dislike. It gives you some "magical" steps to follow (here are the same rules stated more verbosely in an awful, BASIC-ish GOTO-step-N manner) with no explanation why this way, no another.
Here is the missing explanation:
Declaration reflects how you use declared expression (how you get the value of it), so in int tab[]; tab is an array (you index it) of integers. int (*tab)[]; is a pointer to an array (you dereference it, then index). int *(tab[]); is an array of pointers — you have to index it, then dereference.
How about int *tab[]? You have to know operator precedence
It's not that hard as in looks like. In our case the rule of thumb is: "Postfix binds stronger than prefix.", so you read int *tab[] as array of pointers. "Postfix binds stronger than prefix" is the reason why you look right, then left
, in "Golden rule".
Easy, isn't it? Now you know this post's title reads pointer to the function returning pointer to an array of pointers to functions returning pointers to integers
. 10 is redundant in this case. (It's no 5 from here, I'm so lazy...).
Of course you'll find out that the Golden rule
is an obvious result of sentences above. It's convinient to read declarations that way, but IMO it's very bad to actually think about declarations only in terms of now jump out of the parenthesis
.
My text is brilliant
My vim is pure.
I saw a Wombat.
Of that I'm sure.
[...]
You're beautiful. You're beautiful.
You're beautiful, it's true.
" done with current line
inoremap <c-cr> <c-o&ht;o
"XML, HTML, JSP
autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap <C-b> <Esc>"tciw<<C-o>"tp><CR></<C-o>"tp><Esc>O
autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap <C-a> <Esc>"tciw<></><Esc>"tPF>"tPla
autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap <C-s> <ESC>"tciw</><ESC>h"tPa<Space><Space><Left>
autocmd FileType python syn keyword Constant True False None
autocmd FileType python syn keyword Keyword with