Skip to content

Instantly share code, notes, and snippets.

View helton's full-sized avatar
🏠
Working from home

Helton Carlos de Souza helton

🏠
Working from home
View GitHub Profile
@helton
helton / factorial.js
Created August 5, 2017 01:59
Factorial with String
const factorial = number => {
let f = 1
for (let i = 1; i <= number; i++) {
console.time('elapsed time')
f *= i;
console.log(`${i}! = ${f}`)
console.timeEnd('elapsed time')
if (f === Infinity)
break;
}
@helton
helton / rename-all.sh
Last active August 9, 2017 21:44
Rename multiple files using a <rules.txt> file
#!/bin/sh
eval "$(sed 's/^/mv /g' rules.txt )"
@helton
helton / cookie-clicker.js
Created August 14, 2017 03:59
Automatize the Cookie Clicker Game
@helton
helton / get-video-links-codeschool.js
Last active August 19, 2017 22:29
Get Video Links (in HD 720p) from CodeSchool
@helton
helton / total-mensal-zap.js
Last active August 21, 2017 18:53
Calcula o total mensal de apartamentos do Zap Imóveis
function reaisStrToInteger(reais) {
return parseInt(reais
.match(/R\$ ([0-9]+(\.[0-9]+)?)$/)[1]
.replace('.', ''));
}
if (window.location.href.match(/https:\/\/www\.zapimoveis\.com\.br\/oferta\/(venda|aluguel)\+apartamento/)) {
const aluguel = reaisStrToInteger(document.querySelector('.value-ficha').innerText.replace(/\n/g, ''));
let iptu = 0;
let condominio = 0;
@helton
helton / launch.json
Created August 23, 2017 23:56 — forked from auchenberg/launch.json
VSCode + React debug config
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src"
}
@helton
helton / styles.less
Last active May 15, 2018 05:53
Atom Configuration for JavaScript (JSX) with Fira Code as Font Ligature
//Custom configuration
atom-text-editor {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-family: "Operator Mono";
font-size: 16px;
font-weight: 500;
line-height: 1.5;
}
@helton
helton / db.json
Created December 11, 2017 12:30
Fetch API Test - POST (make sure you start json-server => https://github.com/typicode/json-server)
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
@helton
helton / remove-medium-login-popup.js
Last active May 2, 2018 16:43
Remove forced login popups (Quora, Medium, LinkedIn)
(function() {
const dialogNode = document.querySelector('.overlay.overlay--lighter')
if (dialogNode) {
document.body.style.overflow = 'auto'
dialogNode.remove()
}
})()
@helton
helton / quizlet-simple-markdown.js
Created May 6, 2018 22:06
Simple Markdown for Quizlet description (info page)
const markdown = raw => {
const createBulletList = content => {
const regex = /- /gi
return content.match(regex).reduce((body, bullet) => body.replace(bullet, `<pre style="display: inline-block">• </pre>`), content)
}
const createLinks = content => {
const regex = /\[(.*?)\]\((https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)(\?hl=[a-z]{2})?)\)/gi
let result = content
let match = regex.exec(content)
while (match !== null) {