Damnit, most of my best hacks could be considered proprietary, though I seriously doubt any of the companies involved would care. One that I can share: I architected a game-creation platform so that all the game runtime code was both legal Flash and legal JavaScript, such that the same code could be inserted verbatim in both the JavaScript editor and the Flash compiled version.
Confess HN: Share your Immoral Hacks, Codes or Tweaks
21–30 of 70 posts
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#22I am writing PHP in Common Lisp, and my codebase is litered with the following: (defun make-record (&rest args) ; insert &allow-other-keys ;-) (let ((*db-auto-sync* t)) (object (make-instance 'record args))) (when object (update-records-from-instance object)))) Both the LET binding of db-auto-sync and the update-records call do the EXACT same thing. However, due to weirdness I don't grok quite yet, the calls to the d…
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#23...:: Hacking World Cup Tickets for Germany 06 ::... Australia was a late qualifier for the tournament. The ticket submission was via email. Tickets were allocated on a first email received basis after 09:00. There was a countdown webpage which advertised the time. --- Preparation * I telneted to port 25 of the destination and saw via EHLO that the mail server clock was 1 minute faster than advertised on the webpage,…
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#24I am writing PHP in Common Lisp, and my codebase is litered with the following: (defun make-record (&rest args) ; insert &allow-other-keys ;-) (let ((*db-auto-sync* t)) (object (make-instance 'record args))) (when object (update-records-from-instance object)))) Both the LET binding of db-auto-sync and the update-records call do the EXACT same thing. However, due to weirdness I don't grok quite yet, the calls to the d…
I've always wanted to do sort of the opposite... That is to say, I've always wanted to compile Scheme to PHP. I make the claim that PHP is the web's assembly language. Or, at least it's portable assembly language.
(And no, you should not compile your app into your frontend webserver. Use FastCGI or a reverse proxy!)
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#25Gotos aren't necessarily bad - for example when you have a large amount of nested loops and need to break out of a certain number of them.
Also good for exception/error handling for languages that don't have that capability built in. E.g. the SQL script I've been working on today has a number of gotos in it.
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#26Gotos aren't necessarily bad - for example when you have a large amount of nested loops and need to break out of a certain number of them.
Perl also provides 'last LABEL', which is handy (lets you break out of any level of nesting).
I guess in a language like C where you can have neither and function calls are slow so the 'return' escape continuation is also unusable there is a reason to use goto for this.
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#27Gotos aren't necessarily bad - for example when you have a large amount of nested loops and need to break out of a certain number of them.
Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#28Re: Confess HN: Share your Immoral Hacks, Codes or Tweaks
#29The hack was cool, but utterly stupid and pointless (the C++ was used for speed - calling back into PowerBuilder defeated the purpose). The only reason I did it was because the consultant who originally created the C++ DLL managed to convince my boss that the application would run much faster if PowerBuilder supported callbacks. So naturally my boss instructed me to do the impossible. I didn't complain because it seemed like a fun challenge at the time. I didn't tell him that it actually slowed the app down a bit though >:)