Skip to content

Instantly share code, notes, and snippets.

View rap0so's full-sized avatar
🖥️
Code. Laugh. Commit. Repeat.

William Godoy rap0so

🖥️
Code. Laugh. Commit. Repeat.
View GitHub Profile
@rap0so
rap0so / get.js
Last active January 28, 2021 15:40
This function is a improved way of loadash lib
/**
* _Get function is a copy of a method of loadash lib
* that get `property` of `object` testing all nested properties if needs it
*
* @param {object} obj
* @param {string} key
*
*/
function _get(object, keys, defaultVal) {
keys = Array.isArray(keys) ? keys : keys.split('.')
@rap0so
rap0so / rageClick.js
Created October 21, 2019 01:18
Totally functional method to get rage click
const saveMousePosition = totalClicks => event => {
if (!event) return totalClicks;
totalClicks.push(`${event.clientX}-${event.clientY}`);
return [];
};
const addNewClick = saveMousePosition([]);
const _setRage = () => {
document.addEventListener('click', event => {
addNewClick(event);
@rap0so
rap0so / getShakeMove.js
Last active December 10, 2019 06:22
Method to get shake moves
import throttle from 'throttle';
const totalMoves = [];
let totalShakes = 0;
const mousePos = event => {
totalMoves.push({
x: event.clientX,
y: event.clientY
@rap0so
rap0so / index.js
Last active February 7, 2021 23:08
import waitForTrue from './waitForTrue'
export default waitForTrue
@rap0so
rap0so / removeAccent.js
Last active February 15, 2019 13:08
Remove accent
/**
* Normalizes the string to lowercase letters and no accents
* @param {string} str string to normalize
* @return {string} return string normalized
*/
const removeAccent = (str) => {
const replaceMap = {
'[ãâàáä]': 'a',
'[êèéë]': 'e',
'[îìíï]': 'i',