This file contains hidden or 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
/* | |
Created using http://jsbin.com | |
Source can be edit via http://jsbin.com/ukipo/edit | |
*/ | |
var alldivs = document.getElementsByTagName('div'); | |
for (var i = 0; i < alldivs.length; i++) { // infinite loop | |
document.body.appendChild(document.createElement('div')); | |
} |
This file contains hidden or 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
# For use with VMWare when you don't run an X server: | |
cat /dev/zero > zero.dat ; sync ; sleep 1 ; sync ; rm -f zero.dat |
This file contains hidden or 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
// Seen in the Facebook Client library | |
} catch (e) { | |
if (e.number == -2146828218) { | |
//Permission denied | |
return; | |
} | |
}; |
This file contains hidden or 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
// Extracted from SyntaxHighlighter | |
MultiLineCComments : new RegExp('/\\*[\\s\\S]*?\\*/', 'gm'), | |
SingleLineCComments : new RegExp('//.*$', 'gm'), | |
SingleLinePerlComments : new RegExp('#.*$', 'gm'), | |
DoubleQuotedString : new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"','g'), | |
SingleQuotedString : new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'", 'g') |
This file contains hidden or 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
# From Entropy.ch: | |
# Here’s a little terminal command I use to repeatedly attempt to download a file. This is useful if the transfer aborts frequently or if the server is busy: | |
# The while/do/done loop keeps calling curl, with pauses of 10 seconds. curl will keep returning a failure exit code, which is what keeps the while loop going if inverted with the ! (logical not) operator. The -C - flag tells curl to continue at the last byte position. | |
while ! curl -C - -O 'http://download.parallels.com/GA/Parallels%20Desktop%203186%20Mac%20en.dmg'; | |
do sleep 10; | |
done |
This file contains hidden or 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
I found Tim Fanelli's Blog ( http://www.timfanelli.com/cgi-bin/pyblosxom.cgi/j2ee/ ) entry quite helpful | |
1. In xcode, create a new empty project with the same dir any sources were checked out from. | |
2. Name the project with the same name used as the SVN module. NOTE: the .xcodeproj file should end up in the same directory as your build.xml file. | |
3. From the finder, dragged the src/ directory into the top level project name item in the project window. | |
4. Removed any unwanted items from the folder hierarchy now in xcode. For example, remove all generated build .jar files. |
This file contains hidden or 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
/* | |
A single regex to parse and breakup a full URL including query parameters and anchors e.g. | |
https://www.google.com/dir/1/2/search.html?arg=0-a&arg1=1-b&arg3-c#hash | |
*/ | |
Url.regex = /^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/; | |
url: RegExp['$&'], | |
protocol: RegExp.$2, | |
host: RegExp.$3, |
This file contains hidden or 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
<!-- | |
A quick code snippet to include the right XHTML DTD in your XSL generated output. This took me a bit of reseach to find out: | |
--> | |
<xsl:output | |
method="xml" | |
encoding="utf-8" | |
omit-xml-declaration="yes" | |
indent="no" | |
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" |
This file contains hidden or 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
/* | |
I wanted a table to allow the user to select a range of rows with a Shift+Click… The problem is that, by default, the browser will select the page’s text content. This isn’t something you’ll want to do very often but it is possible to get around this: | |
Firefox can do this from your CSS: | |
table { | |
-moz-user-select: none; | |
} | |
On the table element IE needs: |
This file contains hidden or 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
/* | |
Using as a benchmark the task of iterating over a live collection produced by getElementsByTagName. IE/Win, Gecko and Safari all agree as to the fastest means - use a while loop and store the live collection in a variable: | |
*/ | |
var i = 0, el, els = document.getElementsByTagName(nodeName); | |
while (el = els[i++]) { | |
// [...] | |
} |