Skip to content

Instantly share code, notes, and snippets.

View sebastianhoitz's full-sized avatar
🎯
Focusing

Sebastian Hoitz sebastianhoitz

🎯
Focusing
View GitHub Profile
@sebastianhoitz
sebastianhoitz / keybindings.json
Last active March 16, 2023 20:00
VSCode Vim improvements
[
{
"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 / StreamingResponse.coffee
Last active December 26, 2022 07:06
node.JS streaming zip file
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
@sebastianhoitz
sebastianhoitz / etc-init.d-graylog2.sh
Last active December 16, 2015 19:49 — forked from marzocchi/etc-init.d-graylog2.sh
This version works with the current graylog 0.10 graylog2ctl script
#! /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 December 13, 2015 19:39
nodeJS mongoDB instrumentation – This allows you to profile all queries to your mongoDB collection, including collectionName, special find parameters and conditions.
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
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
/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:
<?php
function buildSetString($arguments)
{
if (count($arguments) == 0)
{
return "";
}
$query = 'SET ';
@sebastianhoitz
sebastianhoitz / gist:2007824
Created March 9, 2012 18:10
My Sublime Text 2 Key Bindings
[
// 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 November 28, 2011 17:47
Zend Framework Auth plugin
<?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"
@sebastianhoitz
sebastianhoitz / gist:1348738
Created November 8, 2011 18:58
Hem + Less Bug
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 = '';