Skip to content

Instantly share code, notes, and snippets.

View matthiasg's full-sized avatar

matthiasg matthiasg

View GitHub Profile
@matthiasg
matthiasg / basicServiceWorker.js
Created November 30, 2015 09:44 — forked from adactio/basicServiceWorker.js
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';

Legend

This is a command in the Docker Quickstart Terminal

$ This is a command run inside the docker host or inside a container (linux etc, eg after docker-machine ssh default or docker run -it ubuntu bash)

Install Docker Toolbox

  1. start docker quick-start terminal
@matthiasg
matthiasg / gist:2b8748cfdf919ce77c3fd0438613cee6
Created April 12, 2016 21:11 — forked from robinloxley1/gist:7ea7c4f37a3413b1ca16
sample elasticsearch query to sort parent based on child field
{
"query":{
"has_child":{
"query":{
"function_score":{
"functions":[
{
"field_value_factor":{
"factor":1,
"field":"count"
@matthiasg
matthiasg / haproxy.cfg
Created August 9, 2016 19:29 — forked from ryzy/haproxy.cfg
HAProxy - essentials for HTTP/2
frontend https-in
mode tcp
bind *:443 ssl crt /etc/ssl/dummy.pem alpn h2,http/1.1
use_backend nodes-http2 if { ssl_fc_alpn -i h2 }
default_backend nodes-http
backend nodes-http
server node1 web.server:80 check
backend nodes-http2
@matthiasg
matthiasg / create.js
Last active August 31, 2016 05:38
Postgres query test
var pg = require('pg');
var faker = require('faker');
var Promise = require('bluebird');
var uuid = require('node-uuid');
// create a config to configure both pooling behavior
// and client options
// note: all config is optional and the environment variables
// will be read if the config is not present
var config = {
@matthiasg
matthiasg / 1. README.md
Last active December 13, 2016 07:30
Example of GraphQl issues with respect to filtering. Duplicated filter on data__noxe reference field. Also potentially conflicting with different versions.

Given a schema with three entities cases,products,noxe where cases and products link to noxe via field data__noxe and where the type noxe is a union of two major versions Noxe_v1 and Noxe_v2.

If the noxe should be filtered (by parent AND other properties) then the code to filter might be duplicated if put into the resolvers naively. The code can be easily be factored out but the duplication in the arguments remains AND is complicated by the fact that different filters might be needed for different versions of Noxe.

Looking at the line 4: data__noxe(match:"some n2") { we can see an argument data__value which is supposed to define a filter on field data__value. When adding another filter only present in one of the versions data__noxe(data__value:"eq:some n2" data__sometext:"contains:some") {

@matthiasg
matthiasg / _decimal.scss
Created March 25, 2017 14:48 — forked from terkel/_decimal.scss
Rounding decimals in Sass
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0
@matthiasg
matthiasg / chrome_170421_092716.dmp
Last active June 1, 2019 04:15
Hung Chrome.exe Process (windbg)
This file has been truncated, but you can view the full file.
@matthiasg
matthiasg / TestPattern.cpp
Created July 21, 2017 14:38 — forked from roxlu/TestPattern.cpp
Example usage of X264. We create a raw YUV pattern and encode it with x264.
#include <cmath>
#include <assert.h>
#include <core/TestPattern.h>
TestPattern::TestPattern()
:w(0)
,h(0)
,frame_num(0)
,duration(0)
{
"main": "dist/allServicesWrappedByOneService.umd.min.js",
"exports": "service"
}