Skip to content

Instantly share code, notes, and snippets.

View spinner.html
<div class="spinner-container">
<svg class="spinner" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
</svg>
</div>
@tspringborg
tspringborg / walk.js
Last active Jul 7, 2020
synchronously recursively list directory files in nodejs with fs
View walk.js
const fs = require('fs');
const walk = function (dir) {
let results = [];
const list = fs.readdirSync(dir);
list.forEach(function(file) {
file = dir + '/' + file;
const stat = fs.statSync(file);
if (stat && stat.isDirectory()) {
/* Recurse into a subdirectory */
results = results.concat(walk(file));
@tspringborg
tspringborg / index.js
Created Jun 9, 2020
nodejs index.js for twigjs templates
View index.js
/*
https://twig.symfony.com/doc/3.x/templates.html (note this is php but syntax is similar (mostly)
https://github.com/twigjs/twig.js/wiki/Implementation-Notes
*/
const fs = require('fs');
const Twig = require('twig');
const renderFunction = Twig.twig;
@tspringborg
tspringborg / keytool commands
Last active Apr 23, 2020
Keyhashes from android keystores
View keytool commands
#debug build
keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64
#release build
keytool -exportcert -alias <aliasName> -keystore release.keystore | openssl sha1 -binary | openssl base64
#forgot alias of keystore for release build? run this
keytool -v -list -keystore release.keystore
@tspringborg
tspringborg / android deeplink
Last active Feb 17, 2020
Pass deeplink to simulators via terminal
View android deeplink
@tspringborg
tspringborg / exampleMethodDecorator.ts
Created Jan 22, 2020
example methodDecorator typescript
View exampleMethodDecorator.ts
// use like this
/*
@ExampleMethodDecorator({
// whatever....
foo: 2,
bar: 'foobar',
})
*/
export function ExampleMethodDecorator(configuration?: any): MethodDecorator {
@tspringborg
tspringborg / replaceTokens.ts
Created Jan 22, 2020
replaceTokens function
View replaceTokens.ts
export const replaceTokens = (str, args): string => {
// *********** replaces all tokens like so: **********
// ${[0]foo} will be replaced with the value of ...args[0].foo
// where args are the arguments supplied to the decorated function
// ***************************************************
let parsedStr = str;
/*
\$ matches the character $ literally (case sensitive)
{ matches the character { literally (case sensitive)
\[ matches the character [ literally (case sensitive)
View Koch Snowflake shader
// Koch Snowflake - by Martijn Steinrucken aka BigWings 2019
// Email:countfrolic@gmail.com Twitter:@The_ArtOfCode
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
//
// This effect is part of a tutorial on YouTube
// https://www.youtube.com/watch?v=il_Qg9AqQkE
vec2 N(float angle) {
return vec2(sin(angle), cos(angle));
}
@tspringborg
tspringborg / click.outside.directive.ts
Last active Dec 18, 2019
angular clickOutside directive
View click.outside.directive.ts
import {Directive, ElementRef, EventEmitter, HostListener, Output} from '@angular/core';
@Directive({
// tslint:disable-next-line:directive-selector
selector: '[clickOutside]'
})
export class ClickOutsideDirective {
private readonly startTime: number;
constructor(private elementRef: ElementRef) {
View material-module.ts
import {DragDropModule} from '@angular/cdk/drag-drop';
import {ScrollingModule} from '@angular/cdk/scrolling';
import {CdkTableModule} from '@angular/cdk/table';
import {CdkTreeModule} from '@angular/cdk/tree';
import {NgModule} from '@angular/core';
import {
MatAutocompleteModule,
MatBadgeModule,
MatBottomSheetModule,
MatButtonModule,