Skip to content

Instantly share code, notes, and snippets.

View spearwolf's full-sized avatar

Wolfger Schramm spearwolf

View GitHub Profile
@spearwolf
spearwolf / json-beautify.sh
Created December 1, 2015 10:20
reformat a json/javascript file
#!/usr/bin/env bash
if [ $# -eq 0 ] || [ "$1" = '-h' ] || [ "$1" = '--help' ]
then
cat <<HELP
simple usage: $0 <file> [ -TABSIZE ]
HELP
exit
fi
@spearwolf
spearwolf / .eslintrc
Last active January 26, 2021 16:06
vim-autoformat configuration for using eslint to reformat javascript with vim
{
"parser": "babel-eslint",
"ecmaFeatures": {
"jsx": true,
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
@spearwolf
spearwolf / inheritance.js
Last active August 29, 2015 14:21
javascript patterns
// javascript inheritance example
// ECMAScript 5.1 (ECMA-262) / Javascript 1.8.5
function Foo ( name ) {
this.name = name;
}
@spearwolf
spearwolf / serve-cors.js
Created April 1, 2015 11:23
http static file server: cors enabled
// npm install finalhandler serve-static
var finalhandler = require('finalhandler');
var http = require('http');
var serveStatic = require('serve-static');
var serve = serveStatic('./', {
'index': false,
'setHeaders': setHeaders
});
@spearwolf
spearwolf / snowcrystal.vim
Created March 1, 2014 10:03
best vim colorscheme ever ;-)
" --- colorscheme -=* snowcrystal *=- --------- --- -- -
" created by wolfger@spearwolf.de
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
@spearwolf
spearwolf / gist:6578223
Created September 16, 2013 09:00
Gruntfile.js for developing node.js apps with watch and optional coffeescript ..
module.exports = function(grunt) {
grunt.initConfig({
watch: {
coffee: {
files: [
'*.coffee',
'app/**/*.coffee',
'routes/**/*.coffee',
'lib/**/*.coffee'
@spearwolf
spearwolf / serve-public.js
Last active December 10, 2015 13:39
http static file server ./public/ with node
var http = require('http'),
send = require('send'), // npm install send
url = require('url'),
app = http.createServer(function(req, res){
function redirect() {
res.statusCode = 301;
res.setHeader('Location', req.url + '/');
res.end('Redirecting to ' + req.url + '/');
@spearwolf
spearwolf / node-mysql-tail.js
Last active September 25, 2015 01:17
nodejs based mysql table tail
var _ = require('./underscore'),
MysqlClient = require('mysql').Client;
//===========================================================
// MysqlTail( options )
// --------------------
//
// initialize the mysql tail module.
//
// opts.host --> mysql hostname
@spearwolf
spearwolf / wolfcrystal.vim
Created July 9, 2009 09:43
best vim colorscheme ever ;-)
" --- colorscheme -=* wolfcrystal *=- ---( created by wolfger@spearwolf.de )----- --- -- -
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "wolfcrystal"
@spearwolf
spearwolf / github.vim
Created March 10, 2009 09:51
light vim colorscheme original based on syntax highlighting on github.com
" ----------------------------------------------------------
" a light colorscheme based on syntax hiliting on github.com
" created by wolfger@spearwolf.de
" ----------------------------------------------------------
set background=light
hi clear
if exists("syntax_on")
syntax reset