Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Sebastian Hoitz sebastianhoitz

🎯
Focusing
View GitHub Profile
@sebastianhoitz
sebastianhoitz / keybindings.json
Last active Feb 13, 2021
VSCode Vim improvements
View keybindings.json
[
{
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusRightGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
@sebastianhoitz
sebastianhoitz / etc-init.d-graylog2.sh
Last active Dec 16, 2015 — forked from marzocchi/etc-init.d-graylog2.sh
This version works with the current graylog 0.10 graylog2ctl script
View etc-init.d-graylog2.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: Graylog2
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts Graylog2
# Description: Starts Graylog2 using start-stop-daemon
### END INIT INFO
@sebastianhoitz
sebastianhoitz / instrumenting_mongodb.coffee
Last active Dec 13, 2015
nodeJS mongoDB instrumentation – This allows you to profile all queries to your mongoDB collection, including collectionName, special find parameters and conditions.
View instrumenting_mongodb.coffee
collection = require("mongodb/lib/mongodb/collection").Collection
oldFind = collection.prototype.find
collection.prototype.find = ->
tagName = "#{@db.databaseName}/#{@collectionName}/find"
findParameters = arguments[1]
start = +new Date()
cursor = oldFind.apply @, arguments
@sebastianhoitz
sebastianhoitz / StreamingResponse.coffee
Last active Jan 8, 2020
node.JS streaming zip file
View StreamingResponse.coffee
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
View gist:3505502
/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/server/application.coffee:100
return this._super.apply(this, arguments);
^
TypeError: Cannot call method 'apply' of undefined
at Application.Tower.Application.Application.init (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/server/application.coffee:100:26)
at Application.Class (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/node_modules/ember-runtime-node/index.js:3202:12)
at Application.Hook (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/shared/hook.coffee:10:41)
at Application.Engine (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/shared/engine.coffee:10:43)
at new Application (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/server/application.coffee:21:
View gist:3505316
prisma-cloud@0.0.1/Library/WebServer/Documents/prisma/prisma-cloud
├── async@0.1.22
├── chai@1.2.0
├─┬ cli-table@0.0.2
│ └── colors@0.3.0
├── coffee-resque@0.1.7
├── coffee-script@1.3.2
├─┬ coffeecup@0.3.11
│ └── optparse@1.0.3
├─┬ connect-redis@1.4.1
View application.php
<?php
function buildSetString($arguments)
{
if (count($arguments) == 0)
{
return "";
}
$query = 'SET ';
@sebastianhoitz
sebastianhoitz / gist:2007824
Created Mar 9, 2012
My Sublime Text 2 Key Bindings
View gist:2007824
[
// easy insert mode exiting
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
},
@sebastianhoitz
sebastianhoitz / gist:1401279
Created Nov 28, 2011
Zend Framework Auth plugin
View gist:1401279
<?php
class App_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()
&& !($request->getControllerName() == "session"
View gist:1348738
var hem = new (require('hem'));
var less = require('less');
var fs = require('fs');
var argv = process.argv.slice(2);
hem.compilers.less = function(path) {
var content, result;
content = fs.readFileSync(path, 'utf8');
result = '';