Skip to content

Instantly share code, notes, and snippets.

@jorangreef
jorangreef / crash.js
Last active January 28, 2016 18:09
Reproduces a crash in Node.js on Windows 7 and Windows 10 when using a recursive fs.watch
var path = require('path');
var fs = require('fs');
// Be careful of adding in console.log statements as these can
// influence the outcome of the script on Windows and cause it to pass.
process.on('uncaughtException', function(error) {
console.log('error: ' + error);
});
@iuliaL
iuliaL / server.js
Created January 14, 2016 09:30
node http.createServer
// 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);
@iksi
iksi / npm-boilerplate-package.json
Last active May 24, 2016 09:46
npm boilerplate package for web projects
{
"name": "<project>",
"private": true,
"scripts": {
"css": "postcss --use postcss-import --use postcss-modular-scale-plus --use postcss-custom-properties --use postcss-custom-media --use css-mqpacker --css-mqpacker.sort --use postcss-calc --use autoprefixer --autoprefixer.browsers 'last 2 versions' --use cssnano --cssnano.safe",
"build:css": "npm run css -- --output assets/css/full.min.css assets/css/src/index.css",
"watch:css": "npm run css -- --watch --output assets/css/full.min.css assets/css/src/index.css",
"js": "uglifyjs --no-mangle --quotes=1",
"build:js": "npm run js -- --compress drop_console=true --output assets/js/full.min.js assets/js/src/lib/*.js assets/js/src/*.js",
"watch:js": "watch 'npm run js -- --compress --output assets/js/full.min.js assets/js/src/lib/*.js assets/js/src/*.js' assets/js/src",
@MichalZalecki
MichalZalecki / style.js
Created October 24, 2015 00:01
Script transpiling CSS with cssnext
const cssnext = require("cssnext");
const fs = require("fs");
const watch = require("node-watch");
const program = require("commander");
program
.version("0.0.1")
.option("-s, --source [path]", "Source file")
.option("-d, --destination [path]", "Destination file")
.option("-w, --watch [path]", "Watch directory")
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active June 30, 2024 04:14
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@justinmc
justinmc / gist:9149719
Last active October 15, 2018 18:05
Sample Gulpfile
var gulp = require('gulp');
var clean = require('gulp-clean');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var bases = {
app: 'app/',
@mojoaxel
mojoaxel / server.js
Last active January 23, 2016 18:23
simple static node.js webserver
var http = require("http");
var url = require("url");
var fs = require("fs");
var port = process.argv[2] || 8080;
var contentTypes = {
'ico': 'image/x-icon',
'html': 'text/html',
'js': 'application/javascript',
'json': 'application/json',
#!/bin/bash
#
# Provision for Vagrant box ArchLinux
#
# Insert to Vagrantfile:
# config.vm.provision "shell", path: "https://gist.github.com/smaknsk/8165875/raw"
#
#
# Run nginx, httpd, php-fpm as user:
@Gomah
Gomah / gist:7364945
Created November 8, 2013 01:43
Static webserver @node.js
// 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',

HTML5 Markup Template - Basic

A very basic starter template with fundamental HTML5 markup -- only the basics.

Based on HTML5 Bones | http://html5bones.com