Skip to content

Instantly share code, notes, and snippets.

function transform(input) {
return input
.filter(havePrice)
.map(withDiscount)
}
const havePrice = (product) => Boolean(product.price)
function withDiscount(product) {
switch (product.savingsType) {
@doliG
doliG / observe.directive.ts
Last active May 12, 2020 10:16
Angular directive adding native-like events `enterViewport` and `leaveViewport`
import { Directive, Output, EventEmitter, ElementRef } from '@angular/core';
@Directive({
selector: '[appObserve]'
})
export class ObserveDirective {
@Output() enterViewport = new EventEmitter();
@Output() leaveViewport = new EventEmitter();
observer: IntersectionObserver;
#!/bin/sh
# Colors
CGREEN="\033[32m"
CRED="\033[31m"
CNONE="\033[39m"
CYELLOW="\033[33m"
# Catch forbidden pattern in js files
PATTERNS="console.log"
@doliG
doliG / .vimrc
Last active February 1, 2018 15:31
My vimrc - vim and iTerm2
set nu
syn on
colors desert
set cc=80
highlight ColorColumn ctermbg=235
" Enable copy pasting in multiples vim instances
"
" in short, whenever you select/yank something put it in the clipboard as well

Keybase proof

I hereby claim:

  • I am dolig on github.
  • I am guibarbe (https://keybase.io/guibarbe) on keybase.
  • I have a public key ASAI04eTfGAzXryaPQ7jxzV74occ5ODgdphp7JPInl9g_wo

To claim this, I am signing this object:

/**
* Extending object method with isDefined()
* @param {string} keysAsString Kets you want to check
* @return {boolean} Return true if object.keys exist, false otherwise
*
* Example :
* const fruitSalad = {
* strawberry: {
* apple: {
* pear: "Wtf",