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 / homebrew-fix.sh
Created September 26, 2014 12:52
re-link all the installed packages
#!/bin/bash
FORMULAS=(`brew list`);
for FORMULA in "${FORMULAS[@]}"
do
echo "brew unlink $FORMULA" && echo "brew link $FORMULA";
OUTPUT=`brew unlink $FORMULA`;
echo $OUTPUT;
OUTPUT=`brew link $FORMULA`;
echo $OUTPUT;
done
@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' '*';
#
// 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 / 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
@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 / 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 / LICENSE.txt
Created January 27, 2014 20:37 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

Overview

We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.

Analytics

// jshint devel: true
// make a copy of each `console` methods and adds them
// to the global object so that you can call `log('foobar')`
// instead of the verbose `console.log('foobar')`
// DO NOT USE IT IN PRODUCTION MODE
// @623HS
(function(global) {
'use strict';
var name, value;
@pid
pid / install-nodejs.sh
Created January 12, 2014 16:17
install nodejs on raspberry pi
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git-core build-essential python libssl-dev
sudo git config --global http.sslVerify false
cd /opt
sudo git clone https://github.com/joyent/node.git
cd node
sudo git checkout v0.10.24
sudo ./configure
sudo make