forked from brianleroux/wtfjs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ssjs syntax highlighting and fixed date on isNaN article
- Loading branch information
1 parent
c21eda1
commit 0074604
Showing
12 changed files
with
61 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
So, [null is not an object](http://wtfjs.com/2010/02/12/null-is-not-an-object) though sometimes null is a Number. | ||
|
||
<code> | ||
isNaN( null ); // false | ||
null === NaN; // false | ||
null == NaN; // false | ||
</code> | ||
|
||
isNaN converts null to number. | ||
|
||
<code> | ||
Number( null ); // 0 | ||
</code> | ||
|
||
But WTF. :) - [@oleg008](http://twitter.com/oleg008) | ||
|
12 changes: 12 additions & 0 deletions
12
posts/2010-04-31-syntax-highlighting-serverside-with-google-prettyfy.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This is much more awesome. I have to thank the guys at [HowToNode.org](http://howtonode.org) for the idea in thier [WheatJS](http://github.com/creationix/wheat) static site blog engine. Essentially, it all boils down to running the rather awesome [Google Code Prettyfy](http://code.google.com/p/google-code-prettify/) _serverside_. | ||
|
||
The only remaining problem with the syntax highlighting is now nested <code> elements have to be escaped to display correctly in the final render. | ||
|
||
<code> | ||
// replace the raw code blocks with prettyfied html | ||
t = t.replace(/<code>[^<]+<\/code>/g, function(code) { | ||
return prettyfy(code.match(/<code>([\s\S]+)<\/code>/)[1]); | ||
}); | ||
</code> | ||
|
||
Perhaps, in the future, a quick routine to fetch only the root code elements rather than blinding fetching all of them. Problem: more solved than before! |