Skip to main content

Posts

Showing posts from July, 2009

New Feature at Paste Ninja

Some of you may have noticed last week a new feature was rolled out on Paste Ninja , the premier PHP-powered paste bin-- patches! Here's how it works: Update an existing paste Click the Compare link that appears in the updated paste's header In the Compare dialog that opens, select your desired current and target revisions; a colorized unified diff is displayed so you can verify the changes Click the dialog's Download button It’s that simple!

Seamless Error Highlighting

A lot of output can be generated when you compiling large projects. When it breaks, it can be difficult to identify the particular spot in the build-process where things when wrong. Highlighting the error messages can help them stand out from the rest of the output. ANSI escape sequences can be used to modify how your terminal window displays its text. For example, outputting the sequence \033[41;37mHello World\033[0m would result in "Hello World" displayed in white text against a red background. Escape sequences begin with an escape character (ASCII 27, octal 033) and bracket. The control values are then given (multiple values are semicolon-separated) and the entire sequence closes with m . You can highlight certain messages by routing the STDOUT and STDERR streams to sed and performing a replacement. s,(.*error.*|.*fail.*|.*undef.*),\033[41;37m\1\033[0m,gi The values you match are of course entirely up to your discretion. The tricky part is quoting and escaping the

OOP in JS

When people would ask me about Object Oriented Programming in JavaScript, I would always send them to two pages written by Gavin Kistner. The other day when I went to visit them myself to quickly check something, they were gone! What happened, Gavin?! I promptly dug the pages up from a search engine's cache to mirror them, but all the original copyrights still belong to Gavin. OOP in JS, Part1: Public/Private Variables and Methods originally at http://phrogz.net/JS/Classes/OOPinJS.html OOP in JS, Part 2: Inheritance originally at http://phrogz.net/JS/Classes/OOPinJS2.html