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
<article title="Le titre de mon article machin" | |
cite="http://example.com/url/to/article.html" | |
pubdate="2010-06-08T00:00:00Z"> | |
<p> | |
le contenu de l'article et un peu de lorem ipsum et | |
<a href="#">un lien pour voir</a> pis kin, un <b>gras</b>! | |
</p> | |
</article> |
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
/* Bien sur, cet exemple utilise jQuery... */ | |
$(function() { | |
$('article').each(function() { | |
var $a = $(this), | |
$link = $('<a>').attr( | |
{ | |
href: $a.attr('cite'), | |
text: $a.attr('title') | |
}, true |
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
/* | |
Innershiv from J.D. Bartlett | |
*/ | |
window.innerShiv = (function() { | |
var d, r; | |
return function(h, u) { |
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
# Get a list of available VMs: | |
VBoxManage list vms | |
# Start one of the VMs w/o starting a gui | |
VboxHeadless -s VMname & | |
# Run your web server inside a headless VM. Or an SSH server, etc. |
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
// pulled from example.js | |
var directive = { | |
'li': { | |
'child <- children': { | |
'a': 'child.name', | |
'a@onclick':'alert(\'#{child.name}\');', | |
'div.children': function(ctxt){ | |
return ctxt.child.item.children ? rfn(ctxt.child.item):''; | |
} |
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
var stdin = process.openStdin(); | |
stdin.setEncoding('utf8'); | |
stdin.on('data', logeval ); | |
function logeval(chunk){ | |
if(chunk) console.log( eval( chunk ) ); | |
} |
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
defineImportCallback = (script, callback) -> | |
unless script.readyState? | |
script.onload = -> callback() | |
return | |
# IE case | |
script.onreadystatechange = -> | |
if script.readyState is "loaded" or script.readyState is "complete" | |
script.onreadystatechange = null | |
callback() |
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
function element(value, context) { | |
var ret = $([]); // $(context) ? | |
if (value.jquery) { | |
ret = value; | |
} else if (value == 'parent') { | |
ret = $(context).parent(); | |
} else if (value == 'clone') { | |
ret = $(context).clone().removeAttr('id'); | |
} else if (value == 'window') { |
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
/* Je prétends que ton POST est pas Cross-Domain.. */ | |
var tonCallback = function(textOrHTML){ | |
// si textOrHTML est du JSON | |
var json = JSON.parse(textOrHTML); | |
// sinon | |
var resultDocument = $(textOrHTML); | |
}; | |
// tu peut en plus de l'option "data" mettre des variables GET dans ton url... |
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
var fs = require('fs'); | |
/** | |
* Offers functionality similar to mkdir -p | |
* | |
* Asynchronous operation. No arguments other than a possible exception | |
* are given to the completion callback. | |
*/ | |
function mkdir_p(path, mode, callback, position) { | |
mode = mode || 0777; |