Skip to content

Instantly share code, notes, and snippets.

Avatar

Erko Bridee erkobridee

View GitHub Profile
View web5.md

Okay, this is where I leave you.

Improvements

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
mikowl / oneliners.js
Last active Oct 24, 2020
👑 Awesome one-liners you might find useful while coding.
View oneliners.js
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new 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
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) {
super(props);
this.state = props.state || {};
this._dispatch = this.dispatch.bind(this);
}
dispatch(action) {
@merlosy
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 https://github.com/Leonidas-from-XIV/node-xml2js
* @author Jérémy Legros
View webpack-babel-config-example.md
  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
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', () => {
setUpCachedTestBed({
declarations: [ AppComponent ],
});
beforeEach(() => {
View promise-walkthrough.md

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
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"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@fdaciuk
fdaciuk / Esconder_console_log.md
Last active Jul 9, 2020
Esconder console.log() quando o site for para produção
View Esconder_console_log.md

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

  • Trocar o www.mywebsite.com 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
pbojinov / README.md
Last active Nov 26, 2020
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/
View README.md

Two way iframe communication

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

Parent

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

iframe

You can’t perform that action at this time.