Skip to content

Instantly share code, notes, and snippets.

View thegitfather's full-sized avatar

thegitfather thegitfather

View GitHub Profile
@thegitfather
thegitfather / parameter-url.js
Created March 18, 2019 14:49
function to return url parameters as a string
_computeSearchUrlParameters(freeTextSearch, originFilter, destinationFilter, quotationStatusFilter) {
const argNames = ['freeTextSearch', 'originFilter', 'destinationFilter', 'quotationStatusFilter'];
let result = '?';
[].forEach.call(arguments, (arg, index) => {
if (arg && arg.length) {
result += argNames[index] + '=' + arg + '&';
}
});
@thegitfather
thegitfather / twitch-auto-fullscreen.user.js
Last active December 7, 2020 12:50
Twitch Auto Fullscreen (tampermonkey)
// ==UserScript==
// @name Twitch Auto Fullscreen
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Enter fullscreen after a countdown (ESC to cancel)
// @author You
// @include https://www.twitch.tv/*
// @include https://twitch.tv/*
// @require https://cdnjs.cloudflare.com/ajax/libs/umbrella/3.1.0/umbrella.min.js
// @grant GM_addStyle
@thegitfather
thegitfather / angular.io.cheat.sheet.md
Created September 4, 2019 14:23
Angular.io Cheat Sheet

ANGULAR (2+) CHEATSHEET

NG MODULES

import { NgModule } from '@angular/core';

@NgModule({
  declarations: ...,
 imports: ...,
@thegitfather
thegitfather / sum-reduce.js
Created September 10, 2019 09:51
use reduce() to calc sum of some property in object[]
calcSum = (items, prop) => {
return items.reduce((a, b) => a + b[prop], 0);
}
let foo = [{price: 1}, {price: 2}, {price: 3}];
calcSum(foo, 'price'); // 6