Skip to content

Instantly share code, notes, and snippets.

Emerson Demetrio emersondemetrio

Block or report user

Report or block emersondemetrio

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
@emersondemetrio
emersondemetrio / url2json.js
Last active Jul 23, 2019
Convert URLs to JSON
View url2json.js
const url2JSON = source => {
const obj = {
source,
props: {},
keysList: [],
valuesList: []
};
const arr = source.split('?');
@emersondemetrio
emersondemetrio / deleting-branchs
Created Jul 16, 2019
Deleting Branchs with bash
View deleting-branchs
#!/bin/bash
while read -r branch;
do echo "deleting: $branch";
git branch -D $branch;
done <<< `git branch | grep 'bugfix'`
@emersondemetrio
emersondemetrio / function.sql
Created Jan 23, 2019
MYSQL Create Function Syntax
View function.sql
-- https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html
DROP FUNCTION db.hello;
CREATE FUNCTION db.hello (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT('Hello, ',s,'!');
SELECT db.hello('eae')
View replica.js
const replicateObject = (obj, times) => {
const tmp = JSON.stringify(obj);
return JSON.parse("[" + tmp.concat(",").repeat(times).slice(0, -1) + "]");
};
const example = {
n: 10,
prop1: "My Name",
prop2: "My Other Name"
};
@emersondemetrio
emersondemetrio / rnb.js
Created Oct 22, 2018
Random Number Between Range
View rnb.js
const rnb = (max, min) => Math.floor(Math.random() * (max - min + 1)) + min;
@emersondemetrio
emersondemetrio / fill-array.js
Created Sep 20, 2018
Fill array with something
View fill-array.js
const arr = Array.from(Array(30), (_d, id) => ({
id,
name: `item-${id}`
}));
You can’t perform that action at this time.