Skip to content

Instantly share code, notes, and snippets.

@DevWouter
DevWouter / gist:b783b943ad939ce5693f
Last active August 29, 2015 14:13
Example: Bouncing ball Euler and RK4
--------------------------------------------------------------------------------
-- License
-- =============================================================================
-- Copyright (c) 2015 Wouter Lindenhof <wouterlindenhof@gmail.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
@DevWouter
DevWouter / whatsapp-countdown.js
Last active May 4, 2020 12:30
Countdown timer for whatsapp (now with instructions)
/**
* This script was written in 2015 and no longer works since 2017.
* The issue is most likely the `document.querySelector` since the queries return no results.
*/
// How to use this script:
// 1. Go to web.whatsapp.com and connect your device.
// 2. Open the developer console in chrome (F11 on windows, command+alt+i on mac)
// 3. Go to the tab console
// 4. Copy the script below, paste it and press enter.
@DevWouter
DevWouter / css-rule-checker.ts
Created July 13, 2018 15:21
A bit of code to check if a certain css rule is being use by the site
rules = [];
website = "https://www.yoursite.com/";
Array.from(document.styleSheets)
.filter(x => (x.href || "").startsWith(website))
.forEach(sheet => {
Array.from(sheet.rules)
.filter(x => x.conditionText === undefined)
.filter(x => x.selectorText !== undefined)
.filter(x => !x.selectorText.includes(":"))
.filter(x => ($$(x.selectorText) || []).length == 0)
@DevWouter
DevWouter / Jenkinsfile
Last active July 18, 2018 08:41
JenkinsTutorial - Hello world
node { ws {
// Checkout de source code
checkout scm;
// Verkrijg de path van de globale geinstalleerde tool.
def msbuild_tool = tool(
name: 'MSBuild 4 (x64)',
type: 'hudson.plugins.msbuild.MsBuildInstallation');
// Draai een commando om het project te bouwen.
@DevWouter
DevWouter / Jenkinsfile
Created July 18, 2018 10:11
tutorial-input
node { ws {
def msbuild_tool = tool(
name: 'MSBuild 4 (x64)',
type: 'hudson.plugins.msbuild.MsBuildInstallation');
stage("checkout") {
checkout scm;
}
stage("build") {
@DevWouter
DevWouter / pre-commit
Created July 5, 2019 09:03
Prevent fit/fdescribe in ts files
#!/bin/sh
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
# uncomment next line for debugging, will print all expanded bash commands
# set -x
# Yes, if you put "fdescribe" in a comment block, this will still abort the
void Main()
{
var factory = new System.Threading.Tasks.TaskFactory();
Console.WriteLine("Create empty task");
var basicTask = factory.StartNew(() => { });
Console.WriteLine("Queueing first message");
basicTask = basicTask.ContinueWith(t => { Thread.Sleep(3000); Console.WriteLine("First message"); });
Console.WriteLine("Queueing second message");
basicTask = basicTask.ContinueWith(t => { Thread.Sleep(1000); Console.WriteLine("Second message"); });
Console.WriteLine("All message are queued");
@DevWouter
DevWouter / git.md
Last active July 2, 2020 11:08 — forked from peterjwest/git-cleanup.sh
Git aliases

git pushup - Pushes a branch and sets the upstream to be the branch of the same name (useful if your git push.default is simple):

On Linux:

git config --global alias.pushup \!'git push --set-upstream origin `git symbolic-ref --short HEAD`'

On Windows:

git config --global alias.pushup '!git push --set-upstream origin `git symbolic-ref --short HEAD`'
import { Subject, BehaviorSubject, ReplaySubject, Observable } from 'rxjs'; // Subjects and Observable
import { Subscription } from "rxjs"; // Subscription
import { combineLatest, of, pipe, } from "rxjs"; // Functions
import { delay, filter, map, share, switchMap, tap } from 'rxjs/operators'; // Operators
import { fromFetch } from "rxjs/fetch"; // Fetch subject (a special subject)
////////////////////////////////////////////////////////////////////////////////////////////////
// Creating an subject.
////////////////////////////////////////////////////////////////////////////////////////////////
type RouteData = PathArgs<"/company/:companyId/customer/:customerId/vendor-user/:vendorUserId">;
// .
// /|\
var routeData: RouteData = { // |
companyId: "",// <-- Strong typed based on URL |
customerId: "",// <-- Strong typed based on URL |
vendorUserId: "", // <-- Strong typed based on URL |
};