Skip to content

Instantly share code, notes, and snippets.

@aljopro
aljopro / expandable-content.css
Last active March 31, 2017 18:54
ADA compliant Expandable Content Component for Knockout
.expandable-content-collapsed .expandable-content-wrapper {
display: none;
}
@aljopro
aljopro / array-examples.js
Last active July 7, 2017 21:58
Functional Javascript
"use strict";
//Array.prototype.map
function multiplyBy ( multiplier ) {
return function ( value ) {
return value * multiplier;
};
}
var array = [1, 2, 3, 4, 2];
@aljopro
aljopro / gulpfile.js
Created June 10, 2017 12:07
Static Site Generator using Gulp, Nunjucks, and Markdown with Front Matter
const gulp = require('gulp');
const nunjucksRender = require('gulp-nunjucks-render');
const gulpGrayMatter = require('gulp-gray-matter');
const debug = require('gulp-debug');
const markdown = require('gulp-markdown');
const data = require('gulp-data');
const through = require('through2');
const fs = require('fs');
const path = require('path');
@aljopro
aljopro / big-decimal.ts
Created December 16, 2022 22:56
Big Decimal
export type BigDecimalCoersable = BigDecimal | string | number | bigint | undefined;
export class BigDecimal {
// Configuration: constants
public static decimalPrecision = 8; // number of decimals on all instances
public static isRounded = true; // numbers are truncated (false) or rounded (true)
protected static shift = BigInt('1' + '0'.repeat(BigDecimal.decimalPrecision)); // derived constant