Live Demo: TODO
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
const node = document.querySelector('input[name="test"]'); | |
const p = document.querySelector('p'); | |
function Observable(subscribe) { | |
this.subscribe = subscribe; | |
} | |
Observable.fromEvent = (element, name) => { | |
return new Observable((observer) => { | |
const callback = (event) => observer.next(event); |
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
#!/usr/bin/env node | |
/** | |
* bin/daemon | |
* A simple Linux HTTP Daemon | |
*/ | |
require('daemon')(); | |
const cluster = require('cluster'); |
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
const strategies = { | |
cacheFirst(request) { | |
return caches.open(APPLICATION_CACHE).then((cache) => { | |
return cache.match(request).then((matching) => { | |
return matching || Promise.reject('no-match'); | |
}); | |
}); | |
}, | |
networkFirst(request, delay) { | |
return new Promise((resolve, reject) => { |
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
#!/usr/bin/env node | |
const { log } = require('./logger'); | |
switch (process.argv[2]) { | |
case 'start': | |
log('start command detected'); | |
break; | |
case 'stop': | |
log('stop command detected'); |
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
const { Console } = require('console'); | |
const { createWriteStream } = require('fs'); | |
const output = createWriteStream('./stdout.log'); | |
const errorOutput = createWriteStream('./stderr.log'); | |
const logger = new Console(output, errorOutput); | |
module.exports = logger; |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading; | |
namespace TestTrapCtrlC { | |
public class Program { | |
static bool exitSystem = 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
const { spawn } = require('child_process') | |
const { existsSync, readdirSync, lstatSync, unlinkSync, rmdirSync } = require('fs') | |
const utils = { | |
/** | |
* Convert an options object into a valid arguments array for the child_process.spawn method | |
* from: | |
* var options = { | |
* foo: 'hello', | |
* baz: 'world' |
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
module.exports = { | |
entry: "./src/main.js", | |
output: { | |
filename: "./dist/bundle.js" | |
}, | |
module: { | |
loaders: [{ | |
test: [/\.js$/, /\.es6$/], | |
exclude: /node_modules/, |
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
module.exports = function (grunt) { | |
// Load grunt tasks automatically | |
require('load-grunt-tasks')(grunt); | |
// Time how long tasks take. Can help when optimizing build times | |
require('time-grunt')(grunt); | |
// Define the configuration for all the tasks | |
grunt.initConfig({ |