Skip to content

Instantly share code, notes, and snippets.

@q42jaap
q42jaap / slots-index.html
Last active January 14, 2021 21:06
TIL vue v3
<html>
<body>
<div id="app">
<expander v-slot="{isExpanded, toggle}" :initial-expanded="false">
<dl>
<dt class="toggler" :class="{expanded: isExpanded}" v-on:click="toggle">Name</dt>
<dd v-if="isExpanded">
Description
</dd>
</dl>
@q42jaap
q42jaap / CdnConfiguration.cs
Last active May 8, 2018 20:35
CustomFileVersionProvider
using System;
public class CdnConfiguration
{
/// <summary>
/// Base url for the CDN, e.g. https://my-cdn.azureedge.net
/// </summary>
public string BaseUrl { get; set; }
/// <summary>
@q42jaap
q42jaap / express-async.js
Created April 6, 2017 14:51
A way to allow async await style middleware
import Layer from 'express/lib/router/layer';
const Promise = global.Promise;
/**
* "fixt" express mbt promises. Als een stukje middleware een promise returnt dan moeten errors eigenlijk aan next worden gegeven.
*
* We hadden ook de suffix `Async` kunnen gebruiken om naast de bestaande functies nieuwe te maken. Dat heeft een flink nadeel
* omdat de api op verschillende manieren te benaderen is.
*/

Keybase proof

I hereby claim:

  • I am q42jaap on github.
  • I am jaap (https://keybase.io/jaap) on keybase.
  • I have a public key ASDt6FKWFIyeyDcloxOQIq3i2Sd3deVe_4szSeeGX8T96wo

To claim this, I am signing this object:

@q42jaap
q42jaap / index.js
Last active January 27, 2016 15:31
'use strict';
var i = 0;
console.log('starting app');
setInterval(function() {
i++;
console.log('simulate activity');
if (i > 5) {
doesNotExist = 0; // this will throw ReferenceError: doesNotExist is not defined
}
@q42jaap
q42jaap / JsonMacros.scala
Last active January 9, 2018 07:09
This Gist shows one way to create a macro that can read/write Json for a trait with implementations.
package util
import play.api.libs.json.Format
import util.macroimpl.MacrosImpl
import language.experimental.macros
object JsonMacros {
// We did not reuse \/ from scalaz, to avoid a dependency on scalaz in the macros module
trait \/[A, B]
@q42jaap
q42jaap / create-index.sh
Last active December 18, 2015 02:39
Reproduction of sorting on child property (Note that you need 0.90.1)
#!/bin/sh
# assume the index products doesn't exist
# otherwise uncomment the following line
# curl -XDELETE localhost:9200/products
curl -XPUT localhost:9200/products/product/1 -d'{
"property1": "value1"
}'
@q42jaap
q42jaap / create-index.sh
Created June 4, 2013 14:50
Reproduction of faceting of has_child query
#!/bin/sh
# assume the index products doesn't exist
# otherwise uncomment the following line
# curl -XDELETE localhost:9200/products
curl -XPUT localhost:9200/products/product/1 -d'{
"property1": "value1"
}'
@q42jaap
q42jaap / gist:3922846
Created October 20, 2012 10:08
Run CMS as NETWORK SERVICE
PsExec.exe -i -u "NT AUTHORITY\NETWORK SERVICE" cmd.exe
@q42jaap
q42jaap / gist:3905824
Created October 17, 2012 14:30
Shrink database
DBCC SHRINKDATABASE (UserDB, 10);
GO