Skip to content

Instantly share code, notes, and snippets.

View guaiamum's full-sized avatar
🌞

Cainã Brazil guaiamum

🌞
View GitHub Profile
@guaiamum
guaiamum / balanced-brackets.js
Created May 16, 2022 12:03
Exercise to check if string of brackets is balanced or nah..
const isBalanced = (s) => {
const stack = [];
const charArray = s.split("");
for (const [index, char] of charArray.entries()) {
switch (char) {
// insert
case "(":
case "[":
case "{":
// import Queue from 'queue-promise'
const newPage = () => { console.log('newPage called'); }
const window = { lpTag: {} }
// script loading
setTimeout(() => { window.lpTag.newPage = newPage; console.log('script arrived'); }, 1500)
// ************ QUEUE
// const queue = new Queue({
// interval: 1000,
@guaiamum
guaiamum / pckgJson-yarnAdd.js
Last active May 28, 2020 20:05
todo: combine in one replace
`"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/polyfill": "^7.6.0",
"@babel/preset-env": "^7.4.3",
"babel-eslint": "^10.0.1",`
.replace(/"(@babel\/[a-z-]*)(.*)\n/g,'$1')
.replace(/\s+/g,' ')
@guaiamum
guaiamum / ssh_config
Created October 30, 2019 21:39
Hosts and keys
# comment
Host git.custom.net
HostName git.custom.net
User git
IdentityFile ~/.ssh/id_rsa_custom
@guaiamum
guaiamum / git-config.sh
Created October 20, 2019 19:47
Config GIT alias
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.ft fetch
git config --global alias.st status
var x = {
c: 1,
a: c,
};
x();
@guaiamum
guaiamum / cloudSettings
Last active October 22, 2020 12:59 — forked from caina-jumia/cloudSettings
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-10-22T12:59:27.584Z","extensionVersion":"v3.4.3"}
@guaiamum
guaiamum / generate_properties.js
Created May 28, 2018 11:05
transforms multiline property listing string into class members in c#
/**
* @param {string} str : multiline string
* @return {string} result
*/
function genProps(str){
let arr = str.split('\n');
let ini = 'public string ';
let fim = ' {get;set;}\n';
return ini+ arr.join(fim + ini) + fim;
}
@guaiamum
guaiamum / getMonday.js
Created May 21, 2018 14:36
gets the monday of the given week
function getMonday(d) {
d = new Date(d);
var day = d.getDay(),
diff = d.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday
return new Date(d.setDate(diff));
}
@guaiamum
guaiamum / piscaCursor.js
Last active October 24, 2018 09:28
makes cursor blink
let interval;
const blink = () => {
interval = setInterval(() => $('.cursor').toggle(), 600);
};
const stopBlinking = () => {
clearInterval(interval);
}