Skip to content

Instantly share code, notes, and snippets.

@dannylagrouw
dannylagrouw / Liquibase-XML-inserts.xml.groovy
Created November 15, 2021 10:28 — forked from davidwatkins73/Liquibase-XML-inserts.xml.groovy
Jetbrains Intellij / Datagrip: Data Extractor - allows export of row data into Liquibase compatible insert statements
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@dannylagrouw
dannylagrouw / Semaphore jump to FAILED v2.user.js
Last active March 22, 2021 12:46
TamperMonkey script for jumping to failed tests in Semaphore build output by clicking on red "Failed in ..." button
// ==UserScript==
// @name Semaphore jump to FAILED
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://nedap.semaphoreci.com/jobs/*
// @grant GM_addStyle
// ==/UserScript==
// https://gist.github.com/dannylagrouw/3e7d528b15b069e879e909424af4d8fb
@dannylagrouw
dannylagrouw / git-archive.sh
Created June 12, 2019 08:39
Lets user select a git branch to archive.
#!/usr/bin/env bash
echo "--------------------------------------------------------------------------------"
echo "Select a branch to archive"
echo "--------------------------------------------------------------------------------"
PS3="Branch no or 0 to quit> "
options=( $(git branch -l | grep --invert-match '*' | grep --invert-match 'master') )
select opt in "${options[@]}"; do
if [[ $opt != '' ]]; then
echo "Archiving $opt ..."
@dannylagrouw
dannylagrouw / parse-dutch-written-date.ts
Last active September 1, 2017 14:06
Parse Dutch written date
"use strict";
function findMonth(s) {
var MONTHS = ['januari', 'februari', 'maart', 'april',
'mei', 'juni', 'juli', 'augustus', 'september',
'oktober', 'november', 'december'];
return MONTHS.reduce(function (result, month, index) {
var i = s.indexOf(month);
if (i >= 0) {
return [month, index, i];
}
function i() {
alert('a');
document.getElementById('size').value = '123x123';
}

Keybase proof

I hereby claim:

  • I am dannylagrouw on github.
  • I am dny (https://keybase.io/dny) on keybase.
  • I have a public key whose fingerprint is 620C 91E1 497D 0550 8876 4236 91D3 1FD7 9E51 38F8

To claim this, I am signing this object:

def split[A <% Ordered[A]](list: List[A], p: A): (List[A], List[A]) = list match {
case e :: rest =>
val (left, right) = split(rest, p)
if (e < p)
(e :: left, right)
else
(left, e :: right)
case _ => (Nil, Nil)
}
trait AbstractCreatureBuilder {
var bodyParts = List.empty[String]
def creatureType: String
def addBodyPart(name: String): AbstractCreatureBuilder
override def toString = {
"A " + creatureType + " with " + bodyParts.mkString(", ")
val pattern = java.util.regex.Pattern.compile ("""(?xs) ("(.*?)"|) ; ("(.*?)"|) (?: \r?\n | \z ) """)
val matcher = pattern.matcher (input)
while (matcher.find) {
val col1 = matcher.group (2)
val col2 = matcher.group (4)
// ...
}
// Scala 2.7.7, immutable map, uses foldLeft to loop over files/words
import java.io._
import scala.io._
def time(f: => Unit) = {
val t1 = System.currentTimeMillis
f
((System.currentTimeMillis - t1)/1000.0)
}