Skip to content

Instantly share code, notes, and snippets.

View hperantunes's full-sized avatar

Hilton Perantunes hperantunes

  • Montreal, Canada
View GitHub Profile
function uniqueReducer(unique, item) {
return unique.includes(item) ? unique : [...unique, item];
}
function mergeObjectsReducer(accumulator, current) {
return {
...accumulator,
...Object.keys(current)
.filter(
key =>
Start-Process "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" `
-ArgumentList "--remote-debugging-port=9222",`
"--enable-features=`"dns-over-https<DoHTrial`"",`
"--force-fieldtrials=`"DoHTrial/Group1`"",`
"--force-fieldtrial-params=`"DoHTrial.Group1:server/https%3A%2F%2F1.1.1.1%2Fdns-query/method/POST`""
import retry from "async-retry";
const retryOptions = {
forever: true,
factor: 2
};
export default (url, options) => retry(async () => {
const response = await fetch(url, options);
if (response.status !== 200) {
export const sumObjects = (first, second) => Object.keys(second).reduce((object, key) => ({
...object,
[key]: (first[key] || 0) + (second[key] || 0)
}), {});
export const findInObject = (combinedPath, object, separator = ".") => {
if (combinedPath === undefined) {
return undefined;
}
const path = combinedPath.split(separator);
return path.reduce((accumulator, value) => ((accumulator && accumulator[value] !== undefined) ? accumulator[value] : undefined), object);
};
/**
* 1D noise generator function.
* Inspired by https://codepen.io/Tobsta/post/procedural-generation-part-1-1d-perlin-noise
*
* @param {string} seed Initializes the pseudorandom number generator (default empty)
* @param {number} width Total number of points in the generated noise line (default 1)
* @param {number} amplitude Height of the wave (default 128)
* @param {number} wavelength Distance between the peaks of each wave (default 128)
* @param {number} octaves How many noise lines will be combined together (default 8)
* @param {number} divisor Number by witch each noise line will be divided (default 2)
setInterval(function() {
document.getElementsByClassName('pl-video-edit-remove')[0].click();
}, 2000);
@hperantunes
hperantunes / settings.json
Last active June 14, 2018 06:07
vscode settings.json
// Place your settings in this file to overwrite the default settings
{
"terminal.integrated.shell.windows": "c:\\windows\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k",
"c:\\program files\\git\\bin\\bash.exe"
],
"editor.minimap.renderCharacters": false,
"extensions.ignoreRecommendations": false,
"git.autofetch": true
@hperantunes
hperantunes / index.js
Created June 16, 2017 21:02
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const GitHub = require('github-api');
const gh = new GitHub();
const me = gh.getUser('hperantunes');
me.listStarredRepos((err, repos) => {
@hperantunes
hperantunes / .bashrc
Created March 18, 2017 03:16
meteor -> git bash
alias meteor="cmd //c meteor"