Skip to content

Instantly share code, notes, and snippets.

Avatar

Giora Guttsait gioragutt

View GitHub Profile
@gioragutt
gioragutt / Formula.md
Last active Apr 8, 2021
Prep for circle border svg
View Formula.md

Component Parameters

Name Calculation
Radius (RD) input (px)
Stroke (STR) input (px)
Normalized Radius (NRD) RD - STR * 2
Circumference (CIRC) NR * 2 * π
Border Part Percent (BPP) input
@gioragutt
gioragutt / __nodejs_lambda_layer
Last active Jan 8, 2021
Script for setting up layer for a lambda containing node.js dependencies
@gioragutt
gioragutt / links.md
Last active May 10, 2020
Tracing Links
View links.md
@gioragutt
gioragutt / example1.ts
Created Apr 4, 2020
Examples discussion
View example1.ts
class Component {
data$ = this.service.getData();
constructor(private service: Service) { }
}
class Component {
data$: Observable<Data>;
constructor(private service: Service) {
this.data$ = service.getData();
View autocomplete-example.ts
import { Observable, fromEvent } from 'rxjs';
import { ajax } from 'rxjs/ajax';
import { map, debounceTime, switchMap } from 'rxjs/operators';
function fetchSuggestions(text: string): Observable<string[]> {
return ajax.getJSON(`https://example.com/suggestions?query=${encodeURL(text)}`);
}
const input = document.querySelector('input');
const completions$ = fromEvent(input, 'keyup').pipe(
@gioragutt
gioragutt / hotjar.js
Last active Nov 1, 2019
Reverse engineered HotJar-iframe script, handles analytics action permission handling and passes actions to the parent site.
View hotjar.js
(function () {
function HtmlStorageWrapper(storage) {
return {
get: function (key) {
const valueFromStorage = JSON.parse(storage.getItem(key));
return !valueFromStorage || Date.parse(valueFromStorage.expires) <= (new Date).getTime()
? (storage.removeItem(key), null)
: valueFromStorage.value
},
set: function (key, value, expiresDate) {
View app.component.html
<ul>
<li *ngFor="let item of formEntries$ | async | keyvalue">
{{item.key}}
<ul>
<li *ngFor="let entry of item.value" (click)="pickedComponent = entry.component">
{{entry.name}}
</li>
</ul>
</li>
</ul>
@gioragutt
gioragutt / game.md
Last active Nov 24, 2018
ruven.properties
View game.md

Concept

  • Real time combat
  • Team Game
  • Online - optional, with ability to private host
  • Deathmatch/Team Deathmatch support
  • Time based/ Goal based games. Not endless.

Game Features

@gioragutt
gioragutt / .gitconfig
Last active Mar 19, 2018
Git Presentation
View .gitconfig
[alias]
graph = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%cr)%C(reset) %C(white) %s%C(reset) %C(bold yellow)- %cn%C(reset)%C(bold red)%d%C(reset)' --all
pr = pull --rebase
ob = checkout -b
amend = commit --amend
qam = commit --amend --no-verify --no-edit
tmp = commit --no-verify -m
far-master = !git fetch && git checkout -f master && git reset --hard origin/master