Skip to content

Instantly share code, notes, and snippets.

@klzns
klzns / README.md
Last active November 20, 2022 16:06
Adicione nos favoritos para abrir o vídeo como Picture in Picture

Adicione um novo favoritos e coloque o script no campo URL:

javascript: (() => document.querySelector('video:not([title="Advertisement"])').requestPictureInPicture())();

Agora, é so abrir o site da transmissão e clicar no link dos favoritos. Você vai conseguir assistir os jogos assim:

@klzns
klzns / README.md
Last active May 7, 2022 20:38
Delete all passwords saved on Google Chrome
  1. Open chrome://settings/passwords
  2. Copy the script
  3. Paste on Chrome Console
  4. Press ENTER
  5. Wait
@klzns
klzns / printUtils.ts
Created December 20, 2021 14:58
px to cm - cm to px
export function convertPxToCm(pixels: number) {
return (pixels * 2.54) / (96 * window.devicePixelRatio)
}
export function convertCmToPx(cm: number) {
return (cm * 96) / 2.54
}
@klzns
klzns / typescriptreact.json
Last active November 17, 2021 15:53
Snippet to create React components fast, just typing `reactFunc`
{
"React Function Component": {
"description": "Write basic React component",
"prefix": "reactFunc",
"body": [
"import React from 'react'",
"import 'twin.macro'",
"",
"type ${1:${TM_FILENAME_BASE}}Props = {",
" $2",
@klzns
klzns / catalog-url.js
Last active August 11, 2020 21:19
Search endpoint that is being called by IO GraphQL
const searchEncodeURI = (str) => {
return str.replace(/[%"'.()]/g, (c) => {
switch (c) {
case '%':
return "@perc@"
case '"':
return "@quo@"
case '\'':
return "@squo@"
case '.':
@klzns
klzns / README.md
Last active July 23, 2019 14:39
Managing two render majors of an app

Contributing

In this document, we'll describe how we are dealing with the development of two major versions.

This document example have two branches:

  • master: major 0 of the app with render 7
  • 1.x: major 1 of the app with render 8

Development

@klzns
klzns / fade.js
Created December 7, 2018 17:51
Fade effect
<div className="w-100 absolute bottom-0"
style={{
background: 'linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1)',
maxHeight: '50px',
height: '100%',
pointerEvents: 'none',
}}>
@klzns
klzns / example.html
Created July 11, 2018 20:25
React dentro de AngularJS
<react component="vtex.Hello" props=something.insideAngularScope"></react>
@klzns
klzns / picture-in-picture.js
Last active July 2, 2018 15:11
Adicione esse script para abrir a transmissão da copa em picture in picture no Safari.
(function () {
var video = document.querySelector('video:not([title="Advertisement"])')
if (!video.webkitSupportsPresentationMode || typeof video.webkitSetPresentationMode !== 'function') {
console.error('Esse código só funciona no Safari!')
return
}
var scoreX = document.querySelector('.placar__equipes')
var button = document.createElement('button')
@klzns
klzns / javascript.json
Created October 5, 2017 21:31
React Component Snippet
{
"React Component": {
"prefix": "reactComp",
"body": [
"import React, { Component } from 'react'",
"import PropTypes from 'prop-types'",
"",
"class ${1:${TM_FILENAME/(.*)\\.js/${1:/capitalize}/}} extends Component {",
" render() {",
" return (",