Skip to content

Instantly share code, notes, and snippets.

View mpragliola's full-sized avatar
😀

Marco Pragliola mpragliola

😀
  • Customer Alliance GmbH
  • Berlin
View GitHub Profile
@mpragliola
mpragliola / gist:9c99ee1a30baf1b83e3cd1ba74dfb833
Created April 1, 2020 14:12
Example of GIT hook: pre-commit
#!/bin/bash
# ---------------
# Color shortcuts
# ---------------
_B=$(tput setaf 0)
_R=$(tput setaf 1)
_G=$(tput setaf 2)
_Y=$(tput setaf 3)
@mpragliola
mpragliola / gist:a73a483b6761519d124d51d04156aab3
Created May 23, 2017 13:52
Konami code with RxJs Observables
const keys$ = Rx.Observable.fromEvent(document, 'keyup')
.map(ev => ev.code)
.bufferCount(10, 1)
.map(codes => codes.join(','))
.filter(codes => codes === "ArrowUp,ArrowUp,ArrowDown,ArrowDown,ArrowLeft,ArrowRight,ArrowLeft,ArrowRight,KeyB,KeyA");
keys$
.subscribe(
x => console.log('KONAMI!')
);