var fs = require('fs'),
connect = require('connect')
var oneYear = 31557600000,
app = connect(
connect.favicon(),
connect.logger(),
connect.staticCache(),
connect.static(__dirname + '/static', { maxAge: oneYear }),
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 util = require('util'), | |
cp = require('child_process'), | |
p = cp.spawn( | |
'/opt/redis/redis-server', | |
[__dirname + '/redis/redis.conf'], | |
{ | |
cwd: __dirname, | |
env: process.env, | |
setsid: false | |
} |
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
:xxx Hi, I'm metadata! I apply to my parent element and I will be translated to whatever form supported by Google, FaceBook and the rest! | |
# Hi there! | |
:icon https://lh3.ggpht.com/I5NYwBKCBphMQvQLC7DWgTbMabYxqrwR83wEe2o4IryOJBfcndjz4ZN4cc2rMNPlCA=w124 | |
:author Julien Cayzac <[email protected]> | |
:published 2010-09-20 13:05:34 | |
I'm a new article about something super interesting. This might look like Markdown, but it's not! | |
You should check [https://youtu.be/g2FOLrC2e6E](this video) out! Here, I just put it below: |
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
CGRect frame = self.frame; | |
float aspect = frame.size.height/frame.size.width; | |
// Assuming: | |
// - the phone is held 30cm away from the eye, | |
float near = 0.3f; | |
// - objects farther than 10Km aren't shown, | |
float far = 10000.f; | |
// iPhone4S: | |
// http://stackoverflow.com/questions/3594199/iphone-4-camera-specifications-field-of-view-vertical-horizontal-angle | |
// In portrait mode, horizontal angle is 47.5 degrees |
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
<h1>This is loaded only after the DOM is ready, if JS is supported</h1> | |
<p>Loading the iframe normally would block until the iframe's own DOM is ready, resulting in slow loading times. Non-Javascript browsers get normal (inefficient) behaviour.</p> | |
<!-- note: on JS-enabled browsers, the noscript element will get replaced by its content (keep that in mind for CSS) --> | |
<noscript class="noblock"> | |
<iframe src="https://www.youtube-nocookie.com/embed/g2FOLrC2e6E?wmode=opaque&vq=hd720&autohide=1&fs=1&iv_load_policy=3&loop=1&rel=0&showsearch=0&showinfo=0&modestbranding=1"></iframe> | |
</noscript> |
It only captures the tag's FQN along with the optional leading !
and leading/trailing /
.
/<((?:\/|\!)?(?:[a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]+)(?:\s*(?:(?:[a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s]+))?)*\s*(\/?)>/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
var sortedJSON = function (obj) { | |
if (obj === null) { | |
return 'null'; | |
} | |
if (Array.isArray(obj)) { | |
return '[' + obj.map(sortedJSON).join(',') + ']'; | |
} | |
if (obj instanceof RegExp) { |
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
// sortedJSON is from https://gist.github.com/2318775 | |
var crypto = require('crypto'), | |
getStableHash = function (obj) { | |
return crypto.createHmac('sha1', 'woot').update(sortedJSON(obj)).digest('hex'); | |
}; |
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 ParentClass = function() { } | |
ParentClass.prototype = {} | |
ParentClass.prototype.constructor = ParentClass; | |
var SubClass = function() { | |
ParentClass.prototype.constructor.apply(this, []); | |
}; | |
SubClass.prototype = Object.create(ParentClass.prototype) | |
SubClass.prototype.constructor = SubClass |