I githubbed the code from the previous post. It's now at http://github.com/tekai/tools. Also php-run-string has been fixed.
Thursday, March 25, 2010
Tuesday, March 16, 2010
emacs/php code
Some interesting functions if you happen to write PHP code in emacs:
php-mode.el with some modifications:
;; - php-check-syntax-and-goto-line bound to F12 ;; - changed the find-tag-default function to differentiate between ;; methods and functions BUT this means you need to use tag-fucker.php ;; instead of etags/ctags/whatever
tag-fucker.php (rename it to use it). A CLI script which generates TAGS/etags stuff used in my php-mode. Much slower than etags but maybe it can by compiled by HipHop.
php.el Some extra php related elisp code. Them gem of it is update-tag-file which does what it says on saving a file ((php-)after-save-hook)
Those files need a bit of shell & elisp knowledge if you want to use them. Go and hack away. If you like/use/modified it pls leave a comment.
Ideapad: incremental tags
- Add a hook to save buffer
- run script to remove file from TAGS
- run tag-fker to add stuff from buffer
- run some tags function in emacs to make adopt changes in TAGS
Update: check out https://github.com/tekai/tools/blob/master/php.el#L45 for an implementation
Friday, February 26, 2010
strange moments
in emacs:
M-x term ... do something in the shell ... > vim file WTF? moment as I realize I started vim within emacs
Thursday, February 11, 2010
Ideapad: EVE POS exchange format
with JSON: Moon {corp:, alliance:, system:, planet:, moon:, modules: [], rf-timer:, comment:""}
Wednesday, February 10, 2010
Ideapad: Visualize var scope & occurances
Thread with knots. The thread represents the scope, the knots represent the occurances.
Thursday, January 07, 2010
Wednesday, December 30, 2009
ECMAScript 262 Ed. 3 allows extensions
That ECMAScript allows other extensions is no surprise to me. As Chapter 16 states:
An implementation may provide additional types, values, objects, properties, and functions beyond those described in this specification. This may cause constructs (such as looking up a variable in the global scope) to have implementation-defined behaviour instead of throwing an error (such as ReferenceError).
But what surprised me is the reply I got to this bugreport:
The extension in SpiderMonkey is old and it serves to satisfy the conditional compilation use-case:
if (DEBUG) {
function maybe() {...}
}
if DEBUG evaluates to falsy, no function maybe is defined. More, this means the binding of maybe depends on evaluation of the sub-statement containing it. Same goes for the testcase in comment 0.
ECMA-262 Ed. 3 (chapter 16) allows syntactic extensions, which the function as sub-statement definitely is an example of. That we differ from other browsers is a tolerable consequence of ES3 chapter 16 allowing syntactic extension. Note that for ES4, function in a block will be block-scoped, but hoiste to top of the block, so the testcase in comment 0 will work.
So basically all Mozilla implementations of ES3 (SpiderMonkey, Rhino, Tamarin?) have been extended so that if changes the behaviour described in ES3 10.1.3. Functions (not variables) are not added to the Scope Chain if they are wrapped in an if which doesn't evaluate to true.
Doesn't seem much of a problem though as there are only two bug reports about it and an only one comment explaining why it is the way it is.
Thursday, May 14, 2009
Florence And The Machine
Dog Days
Kiss With a Fist
Rabbit Heart (Raise It Up)
Could find a proper video for the song Lungs, which is really awesome
Their album Lungs should be out on June 9th in the UK, no idea when it's out in the rest of the world.
Thursday, February 26, 2009
Dinge die man nicht finden möchte
Die MD5 Summe seines Passworts. Je mehr Treffer desto einfacher ist es.
- Hash Generator zum generieren des Hashes
- Google zum suchen des Hashes
- "Password Recovery" zum prüfen wie leicht sich das Password Cracken lässt
Friday, February 06, 2009
Model M PS/2 to USB Adapter
Auf der Arbeit habe ich seit dieser Woche einen neuen Rechner ohne PS/2 Anschluß. Damit ich nicht auf meine alte IBM Model M verzichten muß habe ich jetzt einen USB-PS/2 Adapter gekauft der imho recht günstig ist, nur bei den Versandkosten hätte ich noch schauen sollen ob ich noch was brauche.
Thursday, November 27, 2008
Deichkind
Die meiner Meinung besten Musikvideos von Deichkind:
Ihr Debüt "Bon Voyage" ft. Nina
Limit
Komm Schon
Ich Betäube mich ft. Sarah Walker
Arbeit Nervt
Friday, November 21, 2008
Friday, September 26, 2008
in the mail today
Gestern Nacht bestellt, Heute geliefert ohne Premium zu zahlen. Irgendwie habe ich das Kings of Leon Album mit dem von Franz Ferdinand verwechselt, ich dachte es kommt erst nächstes Jahr raus.
Von dem AMOP Buch erwarte ich etwas mehr Einblick in in Higher Level OOP und eventuell Design Entscheidungen von OO Sprachen. Das MOP selbst werde ich wohl kaum irgendwo anwenden können.
Thursday, September 25, 2008
Thursday, September 04, 2008
Friday, August 22, 2008
curry
Currying as per the formal definitions is given a function f(x,y) -> z curry(f) -> g(x) -> h(y) -> z. But usually it's defined as taking f and fixing the first parameter. eg curry(f,5) -> g(y), with g being g(y) = f (5,y). The second definition is actually called partial application, but up to today I didn't know this as I learned it that way in university. But what confused me today was why with the first definition and a function f(x,y,z) that curry(curry(f))(x)(y)(z) != f(x,y,z). I thought c(c(f)) should be in lisp (lambda (z) (lambda (y) (lambda (x) (...)))), baffled me until sat on the train home and figured out that my curry function was working as it correctly produced (lambda () (lambda (x) ...)).
Anyways below is my Javascript code. I didn't find a shorter or more flexible version, so imho it's the best. It supports any number of arguments thanks to aist/array-comprehension.
function curry(f) { var args1 = Array.prototype.slice.call(arguments, 1); return function () { var args2 = Array.prototype.slice.call(arguments); args2 = Array.prototype.concat.call(args1, args2); return f.apply(this, args2); }; } function realCurry(f) { return function (x) { return curry(f,x); }; }
Thursday, July 17, 2008
Sunday, July 13, 2008
Saturday, July 05, 2008
Convert PDF to PNGs with The GIMP
Task: Convert the maps from from 2d EVEMaps to png images which can view viewed with the ingame browser.
You'll need GIMP for this.
- start GIMP
- open the Script-Fu console via Extras -> Script-Fu -> Script-Fu-console
- copy & paste the code below into the console, press enter
- open the pdf, set the options as you like but set
Open pages astoimages. To test it select only a few maps. - copy & paste
(export-all-as-png 1)in to console, press enter
The images will be saved as c:\eve-regions\eve-region-1.png, if you don't like that change the code
(define (export-all-as-png start)
(define (loop l i)
(let ((image (car l))
(name (string-append "c:\\eve-regions\\eve-region-"
(number->string i)
".png")))
(gimp-image-convert-indexed image 0 0 255 0 0 "")
(file-png-save 1
image
(car (gimp-image-active-drawable image))
name
name
0
4
0 0 0 0 0)
(gimp-image-clean-all image))
(if (not (null? (cdr l)))
(loop (cdr l) (+ i 1))
i))
(let ((images (reverse (vector->list (cadr (gimp-image-list))))))
(loop images start)))