Skip to content

Instantly share code, notes, and snippets.

View psi-4ward's full-sized avatar

Christoph Wiechert psi-4ward

View GitHub Profile
@psi-4ward
psi-4ward / rimraf.js
Created September 4, 2013 17:05
npm EPERM error sshfs Uses exec('rm -rf' + path) instead
module.exports = rimraf
rimraf.sync = rimrafSync
var path = require("path")
, fs
try {
// optional dependency
fs = require("graceful-fs")
} catch (er) {
@psi-4ward
psi-4ward / gist:7081377
Created October 21, 2013 09:52
node-heapdump strace
This file has been truncated, but you can view the full file.
execve("/usr/local/bin/node", ["node", "app.js"], [/* 35 vars */]) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26517, ...}) = 0
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\36\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=100728, ...}) = 0
var IncomingForm = require('formidable');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var GridStore = require('mongodb').GridStore;
var pauseStream = require('through');
var ObjectID = require('mongodb').ObjectID;
function IncomingFormGridFS(opts) {
if(!(this instanceof IncomingFormGridFS)) return new IncomingFormGridFS(opts);
if(!opts.mongodbConnection) throw "Please provide mongodbConnection option!";
<?php
/**
* Initialize the system
*/
define('TL_MODE', 'FE');
require 'system/initialize.php';
$tl_filesIDs = array('3', '4', '5', '6');
var buildPath = 'build';
var srcPath = 'src';
var path = require('path');
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
@psi-4ward
psi-4ward / Gruntfile.js
Created December 19, 2013 11:25
Grunt + LiveReload + LESS + Contao Be sure to have LiveReload Chrome Extension installed
var path = require('path');
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function(grunt) {
@psi-4ward
psi-4ward / docker-powerdns-servicediscovery.sh
Created April 15, 2015 08:54
Service Discovery for Docker to update PowerDNS MySQL
#!/bin/bash
# watch events until infinity
UNTIL=99999999999
# respect events 30sec in the past to not forget
# started containers AFTER "register running" but BEFORE event listener starts
SINCE=$(expr `date +%s` - 30)
DOMAIN=fubar
@psi-4ward
psi-4ward / Busboy_gridfs.js
Created October 24, 2013 11:49
Express example using busboy stream to GridFS
var uploader = function(req, res) {
var busboy = new Busboy({ headers: req.headers });
busboy.on('file', function(fieldname, stream, filename, encoding, contentType) {
var pStream = pauseStream(); // use pause stream to have time to open the GridStore
stream.pipe(pStream.pause());
console.log('POST ' + req.originalUrl + ' File: '+ filename + ' Field: ' + fieldname);
cntProcessingFiles++;
@psi-4ward
psi-4ward / contao.conf
Last active October 19, 2016 10:44
NGINX Contao 3 Config with PHP-FPM
index index.php index.html index.html;
client_max_body_size 200M;
sendfile on;
error_page 404 /404.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
import feathersClient from '../../../be/node_modules/feathers/client';
import socketioClient from '../../../be/node_modules/feathers-socketio/client';
import ioClient from '../../../be/node_modules/socket.io-client';
import authentication from '../../../be/node_modules/feathers-authentication/client';
import hooks from '../../../be/node_modules/feathers-hooks';
import findIndex from 'lodash/findIndex';
import find from 'lodash/find';
import Vue from 'vue';
export const errorHandlers = [];