Skip to content

Instantly share code, notes, and snippets.

View htammen's full-sized avatar

Helmut Tammen htammen

View GitHub Profile
@htammen
htammen / holidays.ts
Created January 21, 2022 16:52
Returns holidays for a year, country and state. Many countries are supported
import dateHolidays from 'https://cdn.skypack.dev/date-holidays';
import { ld } from 'https://x.nest.land/[email protected]/mod.ts'
import { parse } from "https://deno.land/std/flags/mod.ts"
/**
* returns a command line argument by name from the args array
*/
const getArg = function(argName: string, args: any[]): string {
//@ts-ignore
const arg = ld.find(args, (arg: string[]) => arg[0] === argName)
@htammen
htammen / days.ts
Last active January 21, 2022 17:04
Calculates weekdays, sundays, saturdays and total days for a time period
/* run with 'deno days --help'
*/
import containedPeriodicValues from 'https://cdn.skypack.dev/contained-periodic-values';
import sugarDate from 'https://cdn.skypack.dev/sugar-date';
import { ld } from 'https://x.nest.land/[email protected]/mod.ts'
import { parse } from "https://deno.land/std/flags/mod.ts"
/**
* returns a command line argument by name from the args array
*/
@htammen
htammen / cookieTest.js
Last active April 24, 2024 08:54
Simulation of OAuth authorization grant process flow
/**
* This litte program allows to test HTTP redirect cookie options.
* It can be used to simulate the OAuth authorization grant login process implemented
* by the german eID provider DTrust.
*
* How to use it?
* - start the application with `node cookieTest.js`. This starts a http server at Port 8000 at your localhost.
* - In another terminal window run ngrok with the command `ngrok http 8000`
* - you now can access your server via localhost:8000 and a ngrok https url.
* - Encode the ngrok url e.g. by node.js repl command `encodeURIComponent('https://ee3f-84-58-22-35.ngrok-free.app')`