This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Window Function examples | |
-- PostgreSQL conference South Africa 2018 | |
-- By Willem Booysen | |
-- Youtube: https://www.youtube.com/watch?v=blHEnrYwySE | |
-- Create database and templates for demo | |
DROP DATABASE IF EXISTS WindowFunctions; | |
CREATE DATABASE WindowFunctions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generate a Array with sequential numbers. | |
* | |
* @param start first value | |
* @param stop last value | |
* @param step step size | |
* @returns {Array} | |
*/ | |
function range(start, stop, step){ | |
return Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sleep for the specified number of milliseconds. | |
* | |
* @param ms time to sleep in milliseconds | |
* @returns {void} | |
*/ | |
async function sleep(ms: number){ | |
return new Promise((resolve) => { | |
setTimeout(resolve, ms); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if executed directly, start the main function | |
if (require.main === module) { | |
main(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creates an incrementor | |
function getIncrementer(start, defaultStep = 1){ | |
let i = start; | |
return function(step = defaultStep){ | |
i += step; | |
return i; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:14.18.1-alpine as builder | |
RUN mkdir /app | |
WORKDIR /app | |
ADD ./package.json /app/package.json | |
ADD ./package-lock.json /app/package-lock.json | |
RUN npm install | |
COPY src /app/src | |
COPY tsconfig.json /app/tsconfig.json | |
RUN npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias clear='[ $[$RANDOM % 10] = 0 ] && timeout 6 cbeams -o; clear || clear' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nconf = require('nconf'); | |
/* eslint import/no-unresolved: [2, { ignore: ['dotenv.*'] }] */ | |
function init() { | |
if ((process.env.ENVIRONMENT || process.env.NODE_ENV || '').toLowerCase().trim() !== 'production') { | |
let dotenv; | |
try { | |
dotenv = require('dotenv-safe'); | |
} catch (error) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "projecttemplate", | |
"description": "", | |
"version": "1.0.0", | |
"homepage": "https://moehrlein.io", | |
"author": "Michael Moehrlein <code@moehrlein.io> (moehrlein.io)", | |
"license": "ISC", | |
"keywords": [], | |
"private": true, | |
"repository": "github:mmoehrlein/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// AWS data | |
$bucketName = "BUCKET-NAME"; | |
$AWSAccessKeyId = "XXXXXXXXXXXXXXXXXXXX"; | |
$AWSSecretAccessKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | |
$date = date("Y-m-d"); | |
$dateISO = date("Ymd"); | |
$validTill = date('Y-m-d\TH:i:s.000\Z', time() + (60 * 60 * 4)); // 4 hours |