Skip to content

Instantly share code, notes, and snippets.

View ErickPetru's full-sized avatar
🎯
Focusing

Erick Eduardo Petrucelli ErickPetru

🎯
Focusing
View GitHub Profile
@ErickPetru
ErickPetru / dabblet.css
Created June 14, 2013 14:50
CSS Only Checkbox
/*
* CSS Only Checkbox
*/
div {
color: #333;
margin-bottom: 1em;
}
div.large {
@ErickPetru
ErickPetru / index.html
Last active June 25, 2017 19:12
Meu primeiro aplicativo Vue
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Meu primeiro aplicativo Vue</title>
<script src="https://unpkg.com/vue"></script>
</head>
<body>
<div id="app">
{{ message }}
var currencyValidator = {
format: function (number) {
return (Math.trunc(number * 1000000000000) / 1000000000000).toFixed(2)
},
parse: function (newString, oldNumber) {
var CleanParse = function (value) {
return { value: value }
}
var CurrencyWarning = function (warning, value) {
return {
@ErickPetru
ErickPetru / keep-fork-updated.md
Last active September 13, 2019 13:14 — forked from CristinaSolana/gist:1885435
Keeping the "vuejs-br/br.vuejs.org" fork up to date with the upstream "vuejs/vuejs.org" repository.

1. Clone your fork, if you didn't it yet:

git clone [email protected]:vuejs-br/br.vuejs.org.git

2. Add remote from original repository in your forked repository:

cd into/cloned/br.vuejs.org
git remote add upstream git://github.com/vuejs/vuejs.org.git
git fetch upstream
@ErickPetru
ErickPetru / What is Vue.js.pt-BR.srt
Created December 26, 2017 21:05
Brazilian Portuguese subtitles for the "Why Vue.js?" video.
1
00:00:00,000 --> 00:00:02,418
- Nos últimos 10 anos
as páginas Web se tornaram
2
00:00:02,418 --> 00:00:05,600
mais dinâmicas e poderosas
graças ao JavaScript.
@ErickPetru
ErickPetru / bookmarklet-css-layout-hints.js
Last active September 4, 2019 20:26 — forked from vcastroi/css-layout-hack.js
Easy-To-Use Bookmarklet to Toogle CSS Layout Hints On/Off
/* Easy-To-Use Bookmarklet to Toogle CSS Layout Hints On/Off
* Thanks to: https://dev.to/gajus/my-favorite-css-hack-32g3 and https://gist.github.com/vcastroi
* Usage: create a new bookmarklet (inside your browser Bookmark Manager) and use the folowing code as the bookmark URL:
*/
javascript: (function () {
const DEPTH = 10, els = document.body.getElementsByTagName('*'), items = [];
let selector = '', style = '*{color:#000!important;outline:1px solid #f00!important;outline-offset:-2px;background-color:#fff!important;}\n';
for (let el of els) el.innerHTML.indexOf(style) !== -1 && items.push(el);
if (items.length > 0) items.forEach(item => item.innerHTML = '');
else {
@ErickPetru
ErickPetru / worktree-publish-to-gh-pages.md
Created September 13, 2019 13:26
Publishing a `dist` folder from `master` branch using **worktree** feature to `gh-pages` branch.

Setup

First of all, you need to have a gh-pages. If you don't have, create:

git branch gh-pages

This makes a branch based on the master HEAD. It would be okay but the files and the git history of master branch are not meaningful on gh-pages branch.

@ErickPetru
ErickPetru / Inspirado no Exemplo 03.EXCEL.yaml
Created May 12, 2021 01:24
Calcula o valor com desconto a partir do preço e do percentual de desconto, lidos das células A1 e B1, com o resultado sendo exibido em C1.
name: Inspirado no Exemplo 03
description: >-
Calcula o valor com desconto a partir do preço e do percentual de desconto,
lidos das células A1 e B1, com o resultado sendo exibido em C1.
host: EXCEL
api_set: {}
script:
content: "const form = document.getElementById(\"form\") as HTMLFormElement;\r\nconst result = document.getElementById(\"result\") as HTMLDivElement;\r\n\r\nform.addEventListener(\"submit\", (event) => {\r\n event.preventDefault();\r\n\r\n Excel.run(async (context) => {\r\n const sheet = context.workbook.worksheets.getActiveWorksheet();\r\n const range = sheet.getRange(\"A1:C1\");\r\n range.load(\"values\");\r\n await context.sync();\r\n\r\n const price = parseFloat(range.values[0][0]);\r\n const discount = parseFloat(range.values[0][1]);\r\n\r\n const amountDiscounted = (price * discount) / 100;\r\n const finalPrice = price - amountDiscounted;\r\n\r\n result.innerHTML = `\r\n <ul>\r\n <li>Preço base: <b>${price}</b>.</li>\r\n <li>Valor
@ErickPetru
ErickPetru / Exemplo Básico.EXCEL.yaml
Created May 12, 2021 01:26
Faz chamadas básicas à API Excel para mudar a cor de fundo de células selecionadas ou limpar a formatação.
name: Exemplo Básico
description: >-
Faz chamadas básicas à API Excel para mudar a cor de fundo de células
selecionadas ou limpar a formatação.
host: EXCEL
api_set: {}
script:
content: |
const run = document.getElementById("run");
run.addEventListener("click", () => {
@ErickPetru
ErickPetru / Aritmética Básica.EXCEL.yaml
Created May 18, 2021 21:21
Calcula operações aritméticas básicas a partir dos dados extraídos da planilha aberta.
name: Aritmética Básica
description: >-
Calcula operações aritméticas básicas a partir dos dados extraídos da planilha
aberta.
host: EXCEL
api_set: {}
script:
content: |
const calc = document.getElementById("calc");
calc.addEventListener("click", async () => {