Skip to content

Instantly share code, notes, and snippets.

View stacktrace.js
function stacktrace() {
var stack;
function trace(fn) {
return (typeof fn !== 'function')
? []
: trace(fn.caller).concat([fn.toString().split('(')[0].substring(9)]);
}
try {
View functionName.js
function getFunctionName(fn) {
if (typeof fn.name === 'string') {
return fn.name;
}
var fnString = fn.toString();
var firstBracket = fnString.indexOf('(');
return fnString.substr(9, (firstBracket - 9));
}
View bind.js
function bind(fn, context) {
var givenArguments = [];
for (var _i = 2; _i < arguments.length; _i++) {
givenArguments[_i - 2] = arguments[_i];
}
if (typeof Function.prototype.bind == "function") {
return Function.prototype.bind.apply(fn, Array.prototype.concat.apply([context], givenArguments));
}
@friedemannsommer
friedemannsommer / hhvm.conf
Last active Nov 27, 2016
Takes care about installing NGINX, NGINX-RTMP, NGINX-Pagespeed, LibreSSL, PHP, Composer, Laravel, Symfony, Node, NVM, OhMyZSH
View hhvm.conf
; php options
pid = /var/run/hhvm/pid
; hhvm specific
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.server.user = www-data
View Ubuntu kernel clean up
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d;/^linux-\(headers\|image\)/!d'
after this command remove the listed packages with:
sudo apt-get -y purge <package>
View add-host-key.sh
path=$1
user=$2
host=$3
cat $1 | ssh $2@$3 'cat>> ~/.ssh/authorized_keys'
@friedemannsommer
friedemannsommer / URL.php
Last active Aug 29, 2015
PHP URL Generator
View URL.php
<?php
/**
* Class URL
*/
class URL
{
/**
* @author Friedemann Sommer <fs@advanced-store.de>