- Fronttrends 2013
- Notes from ScotlandJS * thanks to Orde Saunders :)
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
class nodejs ( $version, $logoutput = 'on_failure' ) { | |
$nave_path = '/usr/local/bin/nave' | |
$nave_dir = '/usr/local/lib/nave' | |
package { 'bash': | |
ensure => present, | |
} | |
package { 'curl': | |
ensure => present, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>ES5 Data Binding Proof of Concept</title> | |
</head> | |
<body> | |
<section> | |
<label> | |
Name: | |
<input data-bind="name" type="text" /> |
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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
* Inspired by Filipe Kiss' protip (http://coderwall.com/p/o2hpka), * | |
* I decided to port his PHP variable to JavaScript. * | |
* Do whatever you want with this. Enjoy. Full credit to Filipe. * | |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
var status = { | |
100: 'HTTP/1.1 100 Continue', | |
101: 'HTTP/1.1 101 Switching Protocols', |
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
#-webkit-web-inspector #toolbar { | |
background: #cdcdcd !important; | |
height: 36px !important; | |
} | |
#-webkit-web-inspector #main { | |
top: 36px !important; | |
} | |
#-webkit-web-inspector .toolbar-item.elements:hover:after { | |
content: "elements"; | |
z-index: 9999; |
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
#!/bin/sh | |
# This shell script is used to bootstrap the app and update external libraries | |
# | |
# ====== IMPORTANT ====== | |
# | |
# it may break application if 3rd party libs aren't backwards compatible | |
# or if libs were edited locally, use with care !!! |
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
// Grab the EventEmitter constructor. events is a core node module. | |
var Emitter = require('events').EventEmitter; | |
// Our internal function will generate random numbers | |
function randomInt(limit) { | |
return Math.ceil( Math.random() * limit ); | |
} | |
module.exports = function(limit) { | |
if(!(limit && limit > 0)) { |
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
node -e 'process.stdin.pipe(require("fs").createWriteStream(process.argv[1]))' FILENAME |
What I'm considering for an async event emitter is a situation like this:
- I want to be able to fire events before something happens and after something happens.
- Each of the event handlers may do an async process.
- I need to know after all of the "before" event handlers have completed before doing the actual action that I'm saying will happen.
A synchronous example would look like:
emitter.emit('beforewrite');