Skip to content

Instantly share code, notes, and snippets.

Hilton Perantunes hperantunes

Block or report user

Report or block hperantunes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fetch.js
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) {
View sumObjects.js
export const sumObjects = (first, second) => Object.keys(second).reduce((object, key) => ({
...object,
[key]: (first[key] || 0) + (second[key] || 0)
}), {});
View findInObject.js
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);
};
View noise.js
/**
* 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)
View delete-watch-later-yt.js
setInterval(function() {
document.getElementsByClassName('pl-video-edit-remove')[0].click();
}, 2000);
@hperantunes
hperantunes / settings.json
Last active Jun 14, 2018
vscode settings.json
View 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 Jun 16, 2017
requirebin sketch
View index.js
// 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 Mar 18, 2017
meteor -> git bash
View .bashrc
alias meteor="cmd //c meteor"
View sanitize.java
// Newlines, tabs and non-printable unicode characters
private static final String sanitizePattern = "(\\r|\\n|\\t|\\p{C})";
private static final String whitespacePattern = " +";
private static final String replacementString = " ";
private static String sanitize(String text) {
return text.replaceAll(sanitizePattern, replacementString);
}
View vs-code-settings.json
{
"editor.tabSize": 2,
"editor.renderWhitespace": "none",
"workbench.iconTheme": "vs-seti",
"editor.minimap.enabled": true,
"terminal.integrated.shell.windows": "c:\\windows\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k",
"c:\\program files\\git\\bin\\bash.exe"
],
You can’t perform that action at this time.