Skip to content

Instantly share code, notes, and snippets.

@clupprich
clupprich / gist:8c1d85c1c3ce79767875
Created December 19, 2014 09:20
Write CouchDB stats into DB with current timestamp
curl -s -X GET http://localhost:5984/_stats | echo "[$(cat -), { \"datetime\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\" }]" | jq '.[0] + .[1]' | curl -X POST -H "Content-Type: application/json" -d @- http://localhost:5984/stats
@clupprich
clupprich / .gitignore
Last active August 29, 2015 14:15
mongo-replica-test
data/**
source 'https://rubygems.org'
gem 'bson_ext'
gem 'mongo_mapper', '0.13.1'
@clupprich
clupprich / schema_matcher.rb
Last active August 29, 2015 14:24
JSON Schema matcher
# spec/support/schema_matcher.rb
class Schema
@definitions = {}
def self.define(name, &block)
@definitions[name] = block.call
end
def self.defined?(name)
@definitions.key?(name)
@clupprich
clupprich / gist:130208
Created June 15, 2009 16:43
WMSMapServiceLayer.cs
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
public class HeatMapLayer : DynamicLayer
{
BackgroundWorker renderThread; //background thread used for generating the heat map
ESRI.ArcGIS.Client.Geometry.PointCollection heatMapPoints;
private Envelope fullExtent; //cached value of the calculated full extent
private struct HeatPoint
{
public int X;
public int Y;
XnMSwipeDetector SwipeDetector;
XnMWaveDetector WaveDetector;
var context = new XnMOpenNIContext();
XnMSessionManager sessionManager;
try
{
context.Init();
sessionManager = new XnMSessionManager(context, "Wave,Click", "RaiseHand");
@clupprich
clupprich / tests.watchr
Created August 12, 2011 11:47 — forked from boxedup/tests.watchr
watchr file for Rails with test/unit and turn
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
message.gsub!(/\e\[\d+m/, "")
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
@clupprich
clupprich / git-tag-semantic
Created March 16, 2013 14:17
git tag for semantic versions
#!/bin/bash
# Sorts the output of `git-tag` correctly for version string like v1.2.3.4.
# Save this file somewhere in your bin path and execute with git tag-semantic
semantic_tags=$(git tag | sort -n -t. -k1,1 -k2,2 -k3,3 -k4,4)
echo "$semantic_tags"
@clupprich
clupprich / template.rb
Created December 7, 2013 14:27
Rails 4 Application Template
# Rails 4 Application Template
#
# Author: Christoph Lupprich <christoph@luppri.ch>
#
#
# Gems
gem 'devise'
gem 'cancan'