Skip to content

Instantly share code, notes, and snippets.

View lbssousa's full-sized avatar

Laércio de Sousa lbssousa

  • Tribunal Regional Federal da 3ª Região
  • São Paulo, SP, Brazil
View GitHub Profile
@lbssousa
lbssousa / tailwind.md
Created February 18, 2020 18:57 — forked from sandren/tailwind.md
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@lbssousa
lbssousa / useTailwindBreakpoints.ts
Last active February 18, 2020 15:11
Vue composition to get reactive Tailwind CSS breakpoints
/*
* Usage in a component:
*
* import { createComponent } from '@vue/composition-api'
* import { useTailwindBreakpoints } from 'path/to/useTailwindBreakpoints'
* import tailwindConfig from 'tailwind.config.js'
*
* interface Props {
* (...)
* }
@lbssousa
lbssousa / MyComponentJsDoc.vue
Last active July 13, 2022 11:32
A little cheatsheet of how to write type-safe Vue single file components, using either TypeScript or JSDoc comments (reference: https://blog.usejournal.com/type-vue-without-typescript-b2b49210f0b)
<template>
<div>
<slot/>
</div>
</template>
<script>
// @ts-check
/**
@lbssousa
lbssousa / Adobe Flash Plugin integration for Quasar Framework (Electron)
Last active August 11, 2019 15:42
How to integrate Adobe Flash Plugin with Electron in your Quasar Framework project
GENERAL INSTRUCTIONS
--------------------
1. Under your src-electron/ folder, create a folder called ppapi-flash-plugin and separate subfolders for your
supported platforms (linux, win32, darwin) and architectures (ia32, x64).
2. Under each platform/architecture subfolder, put a copy of the plugin binary and manifest.json companion file.
If needed, rename the binary files to pepflashplayer.dll (Windows), PepperFlashPlayer.plugin (macOS)
or libpepflashplayer.so (Linux).
@lbssousa
lbssousa / Example_of_use.vue
Last active July 8, 2019 10:50
Vue component wrapper around parallax-js
<template>
(...)
<parallax-scene :scalar-x="25" :scalar-y="15">
<parallax-layer :depth="0.00">
<img src="~assets/parallax/0_sun.png" style="position: relative; top: -4px;" draggable="false" alt="">
</parallax-layer>
<parallax-layer :depth="0.33">
<img src="~assets/parallax/1_mountains.png" style="position: relative; top: 40px;" draggable="false" alt="">
</parallax-layer>
<parallax-layer :depth="0.67">
@lbssousa
lbssousa / Vagrantfile
Created April 6, 2017 20:02
Configurando uma máquina virtual minimalista do Ubuntu 16.04 no VirtualBox para Internet Banking do Itaú
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<ENDSCRIPT
Home="/home/ubuntu"
# Altere os valores abaixo de acordo com o seu banco
Modulo="warsaw_setup_64.deb"
UrlModulo="https://guardiao.itau.com.br/warsaw/${Modulo}"
UrlBanco="http://www.itau.com.br"
@lbssousa
lbssousa / Vagrantfile
Last active March 8, 2019 16:36
Configurando uma máquina virtual minimalista do Ubuntu 16.04 no VirtualBox para Internet Banking da Caixa Econômica Federal
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<ENDSCRIPT
Home="/home/ubuntu"
# Altere os valores abaixo de acordo com o seu banco
Modulo="GBPCEFwr64.deb"
UrlModulo="https://cloud.gastecnologia.com.br/cef/warsaw/install/${Modulo}"
UrlBanco="http://www.caixa.gov.br"