create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| function getOnlyModifiedValues(originalValues, newValues) { | |
| let isObject = (o) => (typeof o === 'object' && o !== null); | |
| let isEquals = (a, b) => (String(a).trim() === String(b).trim()); | |
| let isEmpty = (o) => (Object.keys(o).length === 0); | |
| function diff(a, b) { | |
| return Object.keys(b).reduce((value, key) => { | |
| let v1 = a[key]; | |
| let v2 = b[key]; |
| import { AfterContentInit, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; | |
| interface TabInterface{ | |
| active: boolean; | |
| name: string | |
| } | |
| @Component({ | |
| selector: 'app-tab', | |
| template: `<div class="tab" [hidden]="!active"><ng-content></ng-content></div>`, |
| import { Injectable } from '@angular/core'; | |
| import { HttpClient } from '@angular/common/http'; | |
| import { Observable, ReplaySubject } from 'rxjs'; | |
| @Injectable() | |
| export class CachedService { | |
| data$: Observable<any> = this.dataSubject.asObservable(); | |
| private dataSubject = new ReplaySubject<any>(1); |
| import { Injectable } from '@angular/core'; | |
| const Polyglot = require('node-polyglot'); // https://www.npmjs.com/package/node-polyglot | |
| // Example of pl_pl.json file: { "Hello world":"Witaj świecie" } | |
| let dictionaries = { | |
| pl_pl: require('./pl_pl/pl_pl.json'), | |
| en_gb: require('./en_gb/en_gb.json') | |
| }; |
| // Source: https://stackoverflow.com/a/8435261 | |
| function weightedRand(spec) { | |
| let i, j, table = []; | |
| for (i in spec) { | |
| // The constant 10 below should be computed based on the | |
| // weights in the spec for a correct and optimal table size. | |
| // E.g. the spec {0:0.999, 1:0.001} will break this impl. | |
| for (j = 0; j < spec[i] * 10; j++) { | |
| table.push(i); |
| // https://jsfiddle.net/koldev/cW7W5/ | |
| var saveData = (function () { | |
| var a = document.createElement("a"); | |
| document.body.appendChild(a); | |
| a.style = "display: none"; | |
| return function (data, fileName) { | |
| var json = JSON.stringify(data), | |
| blob = new Blob([json], {type: "octet/stream"}), | |
| url = window.URL.createObjectURL(blob); | |
| a.href = url; |
| # Random 4-letter word from the dictionary | |
| $ shuf -n4 /usr/share/dict/words | tr -d '\n' |
| function addDelayedEventListener($el, eventName, action) { | |
| const listener = async function (event) { | |
| $el.removeEventListener(eventName, listener); | |
| $el.disabled = true; | |
| await action.call(action, event); | |
| $el.disabled = false; | |
| addDelayedEventListener($el, eventName, action); | |
| }; |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| class AnimationLoop { | |
| constructor(fps = 24) { | |
| this.updateFn = null; | |
| this.id = 0; | |
| this.setFps(fps); | |
| } | |
| onUpdate(fn) { | |
| this.updateFn = fn; | |
| } |