Skip to content

Instantly share code, notes, and snippets.

View wmeints's full-sized avatar

Willem Meints wmeints

View GitHub Profile
@wmeints
wmeints / PostIndexer.cs
Created September 13, 2015 14:42
Sample code for indexing logic in ASP.NET 5
using System;
using System.Threading.Tasks;
using Weblog.Models;
using Nest;
using Polly;
namespace Weblog.Services
{
public class PostIndexer: IPostIndexer
{
@wmeints
wmeints / RequestHandler.scala
Last active August 29, 2015 14:17
Extensions to make handling request in Spray framework easier to do
package nl.fizzylogic.restservice
import akka.actor.{Actor, ActorRef, Props, ReceiveTimeout}
import org.json4s.DefaultFormats
import spray.httpx.Json4sSupport
import spray.http.{StatusCode, StatusCodes}
import spray.routing.{HttpService, RequestContext}
import scala.concurrent.duration._
import scala.reflect.ClassTag
@wmeints
wmeints / public_ip.sh
Created January 28, 2015 08:12
Grab first IP-address of your linux machine
export PUBLIC_IP=$(ip addr show eth0 | grep "inet" | awk 'NR == 1 { print $2 }' | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
@wmeints
wmeints / PixelBuffer.cs
Created November 28, 2012 17:30
Component to write random pixels into a WriteableBitmap on Windows 8
/// <summary>
/// Allows for drawing random pixels into a writeable bitmap
/// </summary>
public class PixelBuffer
{
private WriteableBitmap _source;
private byte[] _pixels;
/// <summary>
/// Initializes a new instance of <see cref="PixelBuffer"/>