Skip to content

Instantly share code, notes, and snippets.

View vicainelli's full-sized avatar
🤓
Focusing

Vinicius Cainelli vicainelli

🤓
Focusing
View GitHub Profile
@wesleyegberto
wesleyegberto / convert-postman-to-insomnia.js
Created September 22, 2020 05:57
Script to convert a Postman backupt to Insomnia
/**
* Script to parse a Postman backupt to Insomnia keeping the same structure.
*
* It parses:
* - Folders
* - Requests
* - Environments
*
* Notes: Insomnia doesn't accept vars with dots, if you are using you must replace yours URLs manually (see ENVIRONMENTS_EXPORTS).
*/
@timc1
timc1 / getDelayFromNetworkSpeed.ts
Last active March 15, 2022 08:13
Control the speed at which your loading state shows up depending on the user's internet speed.
const defaultDelay = 500;
export default function getDelay(): number {
if (typeof window !== "undefined") {
if (window.navigator && window.navigator.connection) {
const connection = window.navigator.connection.effectiveType;
switch (connection) {
case "4g":
return defaultDelay;
case "3g":
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 15, 2024 20:11
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 22, 2024 08:34
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@reinink
reinink / webpack.mix.js
Created November 20, 2017 13:19
Using Purgecss with Tailwind and Laravel Mix
let cssImport = require('postcss-import')
let cssNext = require('postcss-cssnext')
let glob = require('glob-all')
let mix = require('laravel-mix')
let purgeCss = require('purgecss-webpack-plugin')
let tailwind = require('tailwindcss')
mix.js('resources/assets/js/app.js', 'public/js')
.postCss('resources/assets/css/app.css', 'public/css/app.css', [
cssImport(),
@callmeloureiro
callmeloureiro / comoSerChatoNoWhatsapp.js
Last active January 15, 2024 20:44
Como fazer alguém te responder no whatsapp
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o web.whatsapp.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;
@vicainelli
vicainelli / lamp.sh
Created August 1, 2017 02:43
Lamp Ubuntu 14 .sh
# upgrade existing packages
sudo apt-get update && sudo apt-get -y upgrade
# set timezone
sudo dpkg-reconfigure tzdata
sudo apt-get -y install build-essential ssh curl software-properties-common python-software-properties python g++ make
# install Apache server
sudo apt-get install -y apache2
@mixin for-size($size) {
@if $size == phone-only {
@media (max-width: 599px) { @content; }
} @else if $size == tablet-portrait-up {
@media (min-width: 600px) { @content; }
} @else if $size == tablet-landscape-up {
@media (min-width: 900px) { @content; }
} @else if $size == desktop-up {
@media (min-width: 1200px) { @content; }
} @else if $size == big-desktop-up {
@vicainelli
vicainelli / Preferences.sublime-settings
Last active March 29, 2017 16:05
My Sublime Text Settings
{
"close_window_when_empty": true,
"color_scheme": "Packages/ayu/ayu-mirage.tmTheme",
"create_window_at_startup": false,
"detect_indentation": true,
"draw_indent_guides": true,
"file_exclude_patterns":
[
".DS_Store"
],
@zergiocosta
zergiocosta / custom_error_msgs.php
Last active September 3, 2020 15:43
Changing login error message (wp-admin)
<?php
// Insert into your functions.php and have fun by creating login error msgs
function guwp_error_msgs() {
// insert how many msgs you want as array items. it will be shown randomly (html is allowed)
$custom_error_msgs = [
'<strong>YOU</strong> SHALL NOT PASS!',
'<strong>HEY!</strong> GET OUT OF HERE!',
];
// get and returns a random array item to show as the error msg
return $custom_error_msgs[array_rand($custom_error_msgs)];