Skip to content

Instantly share code, notes, and snippets.


Erko Bridee erkobridee

View GitHub Profile

Okay, this is where I leave you.


Infinite Scroll

We have a few issues with our current Infinite Scroll:

  1. It will attach infinite elements into the DOM as is being scrolled;
  2. The code for handling it is being copy/pasted in different files to do the same thing;
  3. Some files has extra handling for no apparent reason;
mikowl / oneliners.js
Last active Oct 24, 2020
👑 Awesome one-liners you might find useful while coding.
View oneliners.js
// By @coderitual
// Remove any duplicates from an array of primitives.
const unique = [ Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
francisrstokes / StateDispatcher.js
Last active May 28, 2019
Redux without redux - sharing state and one way data flow using only standard react
View StateDispatcher.js
import React from 'react';
export class StateDispatcher extends React.Component {
constructor(props) {
this.state = props.state || {};
this._dispatch = this.dispatch.bind(this);
dispatch(action) {
merlosy / merge-cobertura.js
Last active Sep 28, 2020
Merge multiple cobertura report in XML (node script)
View merge-cobertura.js
* This is a node script to merge cobertura reports in XML format.
* It requires `xml2js` : `npm i -D xml2js`
* Execute with:
* ```
* node merge-cobertura.js coverage/file1.xml coverage/file2.xml to=coverage-final.xml
* ```
* @see
* @author Jérémy Legros
  1. Instale as dependências:
yarn add webpack babel-core babel-loader babel-preset-env
  1. Crie o arquivo de configuração do webpack:
touch webpack.config.js
willgm / app.component.spec.ts
Created Sep 4, 2017
Speed up your component's test suite by caching the test module
View app.component.spec.ts
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { setUpCachedTestBed } from '../test-utils';
describe('AppComponent', () => {
declarations: [ AppComponent ],
beforeEach(() => {

Walkthrough of the following script (v8:6573).

var logFoo;
var promise1 = Promise.resolve().then( () => logFoo = () => console.log( "foo" ) );
promise1.then( () => logFoo() ).then( logFoo );

1. var logFoo;

noelmace / nodejs_installer.ps1
Last active Nov 22, 2020
Powershell script installing nodejs (with git) and some npm packages
View nodejs_installer.ps1
write-host "`n ## NODEJS INSTALLER ## `n"
# nodejs
$version = "4.4.7-x64"
$url = "$version.msi"
# git
$git_version = "2.9.2"
fdaciuk /
Last active Jul 9, 2020
Esconder console.log() quando o site for para produção

Esconder console.log() para o site em produção

  • Trocar o pelo endereço do site em produção;
  • Incluir isso no início do seu script.

Se passar o parâmetro ?development na URL, ele ignora e mostra os console.log().

pbojinov /
Last active Nov 26, 2020
Two way iframe communication- Check out working example here:

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.


Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')


You can’t perform that action at this time.