Skip to content

Instantly share code, notes, and snippets.

View paulvi's full-sized avatar

Paul Verest paulvi

View GitHub Profile
@sawanoboly
sawanoboly / .mongorc.js
Created November 14, 2011 09:41
Sample .mongorc.js for replicaSets.
prompt = function() {
// set version
version = db.version();
// case mongos
if (rs.status().info == 'mongos') {
return rs.status().info + ':[' + version + '] > ';
}
// config or replica
@tmtk75
tmtk75 / markdown-tag.rb
Created November 30, 2011 08:10
Jekyll Markdown Tag
=begin
Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
Usage:
{% markdown <filename> %}
Dependency:
- kramdown
=end
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
@bnoordhuis
bnoordhuis / trace-all-events.js
Created January 3, 2012 14:38
Trace all events in a node.js application
(function() {
var EventEmitter = require('events').EventEmitter;
var inspect = require('util').inspect;
var emit_ = EventEmitter.prototype.emit;
EventEmitter.prototype.emit = function(name) {
var args = Array.prototype.slice.call(arguments);
if (!(this === process.stderr && name === 'drain')) {
console.error("Event '%s', arguments: %s",
name, inspect(args.slice(1), false, 1));
}
@joelverhagen
joelverhagen / README.md
Created February 12, 2012 02:14
Jekyll YouTube Embed Plugin

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
@haschek
haschek / .jshintrc
Created May 4, 2012 16:08
JSHint Configuration, Strict Edition
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
# use the npm mirror:
npm set registry http://ec2-46-137-149-160.eu-west-1.compute.amazonaws.com
# you can reset this later with npm set registry npm set registry https://registry.npmjs.org/
# then use it normally:
npm install express
@streunerlein
streunerlein / gist:3332181
Created August 12, 2012 14:58
NPM Mirrors & Proxies

Definition

Mirrors: standalone servers with complete copy of npm registry

Proxies: proxy to the database (couchdb) of npm registry, if only the npm registry server fails but the db works

## HowTo See this gist: https://gist.github.com/3331671

Mirrors

(+) means server is self updating (pulls newest stuff from offical registry when back online again)

@khernyo
khernyo / build.gradle
Created December 6, 2012 18:39
Gradle Android configuration with .so hack
// This hack works with com.android.tools.build:gradle:0.2, won't work in later version without modification
apply plugin: 'android'
targetCompatibility = 1.6
sourceCompatibility = 1.6
android {
target = 'android-14'
@tobsch
tobsch / SSCCE.java
Created July 9, 2013 07:58
Nashorn Threading Problem
import javax.script.CompiledScript;
import javax.script.Compilable;
import javax.script.ScriptException;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import jdk.nashorn.api.scripting.NashornScriptEngine;
import java.util.concurrent.Future;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
@semistrict
semistrict / gradlew
Last active December 26, 2015 23:19
gradlew search script
#!/bin/bash
_dir=$(pwd -P)
_lastdir=
until [ "$_dir" -ef "$_lastdir" ]; do
_cmd="$_dir/gradlew"
if test -e "$_cmd"; then
exec "$_cmd" "$@"
return $?