Skip to content

Instantly share code, notes, and snippets.

View vczb's full-sized avatar
🙃
Code with passion, unleash your creations.

Vinicius Zucatti vczb

🙃
Code with passion, unleash your creations.
View GitHub Profile
@vczb
vczb / index.html
Last active April 1, 2020 14:11
import asynchronous css in the link tag
<link media="none" onload="if(media!='all')media='all'" href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;1,300&display=swap" rel="stylesheet">
<link media="none" onload="if(media!='all')media='all'" href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;1,300&family=Montserrat:wght@100;400;700;900&display=swap" rel="stylesheet">
@vczb
vczb / index.html
Created April 1, 2020 14:10
data layer for e-commerce
<script>
var dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'orderPlaced',
'transactionId': 'FINANCING-ID',
'transactionTotal': 'TOTAL-VALUE',
'transactionProducts': [{
'sku': 'ITEM-ID',
'name': 'ITEM-NAME',
@vczb
vczb / useful.rb
Created April 3, 2020 16:23
useful methods on ruby
# retorna valores que não se repetem no array
def only_different(array)
# array = [1, 2, 2, 3]
counts = Hash.new(0)
array.each { |v| counts[v] += 1 }
return counts.select { |v, count| count == 1 }.keys # [1, 3]
end
# retorna apenas valores repetidos no array
def only_similar(array)
@vczb
vczb / low-charge-alert.sh
Last active October 26, 2021 22:38
linux low charge alert
#!/bin/bash
while sleep 180s
do
STATE=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state" | sed -e 's/state://ig');
PERCENT=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "percentage" | sed -e 's/[^0-9]//ig')
if [ $STATE != 'charging' ]; then
@vczb
vczb / .editorconfig
Created October 6, 2020 19:38
my personal editorconfig
# editorconfig.org
root = true
[*]
indent_style = spaces
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
@vczb
vczb / pyserver.sh
Created October 8, 2020 23:50
static http server with python 3
python3 -m http.server
@vczb
vczb / strapi-db-schema.sh
Last active October 13, 2020 01:19
Dockerized Strapi Impor/Export PostgreSQL DB Schema
#import schema
docker exec -i strapi_postgres_1 psql -h 127.0.0.1 -U strapi -d strapi -W < strapi.sql
#export schema
docker exec -i strapi_postgres_1 pg_dump -c --if-exists --exclude-table=strapi_administrator -h 127.0.0.1 -U strapi -d strapi -W > strapi_backup.sql
@vczb
vczb / svg-symbol.html
Created January 25, 2021 20:55
SVG Symbol
<div id="icons" style="display: none;">
<svg xmlns="http://www.w3.org/2000/svg">
<symbol
id="icon-facebook"
viewBox="-164 42.3 512 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M168.3,239.2h-0.1c-7.7,0.1-15.5,0-23,0h-0.3c-3.9,0-7.7,0-11.6,0c-4.4,0-5.9-3-5.9-5.8c0.1-4.8,0-9.7,0-14.3
c0-2.4,0-4.9,0-7.3c0-1.7,0.2-3.3,0.5-4.7c0.8-2.8,2.6-4.6,5.2-5.2c1.5-0.4,3.2-0.6,5.2-0.6h31.1c5.2,0,10.1-4.2,10.5-9.1v-53.4
@vczb
vczb / cert.sh
Created January 27, 2021 20:44
python3-https
openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem
@vczb
vczb / index.tsx
Last active May 8, 2025 21:12
Combobox - React TypeScript Jest Styled-Components
import { ChangeEvent, useState } from 'react'
import * as S from './styles'
export type DropdownProps = {
options: string[]
selectedIndex?: number
description?: string
onSelect?: (value: string) => void
}