Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pid's full-sized avatar

Sascha pid

  • Baden-Württemberg, Germany
View GitHub Profile
@pid
pid / toInteger.js
Created February 8, 2014 14:13
helper: convert value/string to an integer // don't use parseInt( n , 10)
function toInteger(n) {
n = Number(n);
return n < 0 ? Math.ceil(n) : Math.floor(n);
}
@pid
pid / Gulpfile.js
Created February 9, 2014 16:12
gulp example
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
@pid
pid / resize.js
Created February 11, 2014 23:50
The browsers provide us with 2 key APIs which allow us to add Responsive Javascript to our site, they are the window.matchMedia API and the window.onresize API.
var resizeMethod = function(){
if (document.body.clientWidth < 768) {
console.log('mobile');
}
if (document.body.clientWidth > 768) {
console.log('desktop');
}
};
//Attach event for resizing
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@pid
pid / cors-nginx.conf
Last active August 29, 2015 14:06 — forked from michiel/cors-nginx.conf
nginx CORS config
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
#!/bin/bash
##############################################
# modified version of original http://media-glass.es/ghost-sitemaps/
# for ghost.centminmod.com
# http://ghost.centminmod.com/ghost-sitemap-generator/
##############################################
url="ghost.centminmod.com"
webroot='/home/nginx/domains/ghost.centminmod.com/public'
path="${webroot}/sitemap.xml"
user='nginx' # web server user
@pid
pid / default.vcl
Last active August 29, 2015 14:08 — forked from lkarsten/default.vcl
varnish vcl for ghost blogging platform
#
# Varnish VCL file for Ghost blogging platform.
# http://ghost.org/
#
# Written for Ghost v0.3.0.
#
# This is a low-hanging-fruit type of VCL. TTL of objects are overridden to 2
# minutes, and everything below /ghost/ is pass()-ed so the user sessions
# work.
#
#!/bin/bash
##############################################
# modified version of original http://media-glass.es/ghost-sitemaps/
# for ghost.centminmod.com
# http://ghost.centminmod.com/ghost-sitemap-generator/
##############################################
url="www.CHANGE_THIS.com"
webroot='/VAR/CHANGE_THIS'
path="${webroot}/sitemap.xml"
user='nginx' # web server user
@pid
pid / README.md
Last active August 29, 2015 14:08 — forked from iki/README.md

Update global top level npm packages

Problem

npm update -g updates all global packages and their dependencies, see npm/npm#6247.

Solution

  1. Either use the shell script or windows batch here instead.
var last = function(fn, l) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.push(l);
return l = fn.apply(null, args);
};
};