Live data from Hacker News

Things to commit just before leaving your job

gist.github.com

81–90 of 165 posts

Re: Things to commit just before leaving your job

#81

Oh I so desperately need a PHP equivalent right now.

PHP actually allows much less mischief here than C or, say, Python does. It doesn't let you redefine or delete functions, classes or constants, unlike C where macros can be abused for this, and Python where you can delete anything. But you could hide all errors if you want to screw with people: error_reporting(0); set_ini('display_errors', '0'); set_error_handler(function () { return TRUE; }, E_ALL | E_STRICT); set_e…

Subtle abuse of type juggling is the way to go in PHP

    var_dump(true == 'false');
Or you can overload library functions by abusing namespacing or runkit, but yeuch.

Re: Things to commit just before leaving your job

#82
post #9

Earlier quoted context omitted.

Most languages don't have a purely textual and completely unsafe preprocessor running during the compilation process, so it would be quite hard.

You could do some real evil stuff with reflection though, such as messing with Java's IntegerCache: http://codegolf.stackexchange.com/a/28818

Ruby:

    irb(main):009:0> class Fixnum; def + other; 42; end; end
    => nil
    irb(main):010:0> 4 + 5
    => 42

Re: Things to commit just before leaving your job

#84
post #38

Earlier quoted context omitted.

Worse. Depending on the jurisdiction, they may be able to get you arrested for hacking.

Not some - all* US jurisdictions. From the Computer Fraud and Abuse Act (18 U.S. Code § 1030(5)(A)): >knowingly causes the transmission of a program, information, code, or command, and as a result of such conduct, intentionally causes damage without authorization, to a protected computer

I wonder how the U.S. Code is valid in Europe?

Re: Things to commit just before leaving your job

#85
post #70
post #37

Something I wrote to amuse the junior front end developers here: document.write('Error: Script not found.'); var node = document.currentScript; if (node.parentNode) { node.parentNode.removeChild(node); } Pop that in a JS file called something like jQuery.min.js and add it to an HTML page with the usual . It'll run when the page loads, add the line of text to the page, and then it'll remove it's own tag so there's no…

'View source' shows the HTML source, not the DOM, in both Firefox and Chrome. Maybe you're thinking of the developer console, or the Firefox 'View selection source' feature?

You're right, I am, but pretty much every developer will use the browser's built-in dev tools to query the source these days, so the trick worked.

Re: Things to commit just before leaving your job

#86
post #38

Earlier quoted context omitted.

Worse. Depending on the jurisdiction, they may be able to get you arrested for hacking.

Not some - all* US jurisdictions. From the Computer Fraud and Abuse Act (18 U.S. Code § 1030(5)(A)): >knowingly causes the transmission of a program, information, code, or command, and as a result of such conduct, intentionally causes damage without authorization, to a protected computer

English isn't my first language, and I don't live in America so it's not like this matters to me, but now I'm curious. How is editing a source file you're meant to be editing "transmitting" anything?

Re: Things to commit just before leaving your job

#87

The horror story that I heard was a disgruntled engineer silently replaced the source codes (C++ based) in the project with compiled binary object files and he kept the source codes on his local computer, not checking those in. He did this over an extended period of time to make sure this crept into the backup tapes as well. No one found out because each engineer owned a code module of their own. Then he resigned. Wh…

this is why we have code. reviews. haha. Yeah...I'd file a criminal lawsuit on his ass though.

Well, if the troublemaker is allowed to show the code from his own laptop, you might not see the problem.

Normally, when we do code reviews, I just ask for the repository location and branch or tag name. I check it out myself to review before we meet as a group.

Re: Things to commit just before leaving your job

#88
post #2

We've got a guy in the office that merges the past over the present all the time. He's not quitting but I imagine if you were to try to break things this would be a good way to do it.

I am curious - wouldn't your Version Control system catch this and warn him that "file xyz has changed since you last checked it out, ..." etc?

There is no warning.

    Pull
    cp * ../work
    cd ../work
    Work
    (cd ../src && pull)
    cp * ../src
    cd ../src
    Commit

Re: Things to commit just before leaving your job

#89
post #4

From "How to write unmaintainable code" [0], here is a function declaration that changes signature based on how many times the header is #included: #ifndef DONE #ifdef TWICE void g(char* str); #define DONE #else // TWICE #ifdef ONCE void g(void* str); #define TWICE #else // ONCE void g(std::string str); #define ONCE #endif // ONCE #endif // TWICE #endif // DONE Granted, it isn't one line long. [0] https://www.thc.org…

I honestly believe that one of the CTOs at my previous employer has followed that guide to ensure the security of his job.

He wrote an entire custom framework for their SaaS platform. I couldn't believe my eyes when I started work on it. I think I lasted 4 weeks before I gave them my 2 weeks notice.

Post reply on HN