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'); | |
var util = require('util'); | |
var writer = fs.createWriteStream('../log.txt'); | |
fs.watch('.', function (event, filename) { | |
writer.write('================\nEvent: ' + event + '\n'); | |
if (filename) { |
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
/** | |
* Watch a directory recursively | |
* | |
* @param {String} dir | |
* @param {Function} cb | |
* | |
* watchRecursive('directory', function(current) { | |
* console.log(current, ' changed'); | |
* }); | |
*/ |
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
#!node | |
var fs = require('fs'), | |
path = require('path'), | |
gzip = require('./gzip'); | |
function process(fileBody, options, cb) { | |
if(typeof(fileBody) === 'object') { | |
options = fileBody; | |
fileBody = undefined; | |
cb = options; |
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
// Variables dc (http://nodejs.org/api/) | |
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs"), | |
port = process.argv[2] || 1337, // Array ex -> http://nodejs.org/docs/latest/api/process.html#process_process_argv | |
mimeTypes = { | |
// Basic mimes | |
'asc' : 'text/plain', |
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
// Restify Server CheatSheet. | |
// More about the API: http://mcavage.me/node-restify/#server-api | |
// Install restify with npm install restify | |
// 1.1. Creating a Server. | |
// http://mcavage.me/node-restify/#Creating-a-Server | |
var restify = require('restify'); |
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
m=require; m('http').createServer(function(_, r) {r.end(m('fs').readFileSync("extracted"))}).listen(4444); |
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
// node server instead of xampp ; | |
var http = require('http'); | |
var fs = require('fs'); | |
http.createServer(function (request, response) { | |
var filePath = '.' + request.url; | |
console.log(request.url); | |
fs.readFile(filePath, function(error, content) { | |
response.writeHead(200); |
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
/* | |
* 1) run node server.js in root category where installed node | |
* 2) install browser extention | |
* 3) http://localhost:3000/index.html | |
*/ | |
//server settings | |
var serveStatic = require('serve-static'); | |
var connect = require('connect'); | |
var http = require('http'); |
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 http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
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
{ | |
"name": "project", | |
"private": true, | |
"scripts": { | |
"build:css": "postcss --use postcss-import --use autoprefixer --autoprefixer.browsers 'last 3 versions' --use cssnano --use postcss-cssnext --output assets/css/full.css assets/css/src/index.css", | |
"watch:css": "postcss --watch --use postcss-import --use autoprefixer --autoprefixer.browsers 'last 3 versions' --use cssnano --use postcss-cssnext --output assets/css/full.css assets/css/src/index.css", | |
"build:js": "uglifyjs assets/js/src/init.js --no-mangle --compress sequences=true,dead_code=true,conditionals=true,booleans=true,unused=true,if_return=true,join_vars=true,drop_console=true --output assets/js/full.js", | |
"watch:js": "watch 'uglifyjs assets/js/src/init.js --no-mangle --source-map full.js.map --output assets/js/full.js' assets/js/src" | |
}, | |
"devDependencies": { |
NewerOlder