Skip to content

Instantly share code, notes, and snippets.

@coelhucas
coelhucas / macos_gmail.md
Last active October 8, 2024 19:14 — forked from roubles/EmailOSXCommandLine.md
Send email from OSX Command line using gmail as SMTP
@coelhucas
coelhucas / what-forces-layout.md
Created June 26, 2024 15:20 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@coelhucas
coelhucas / custom_game_engines_small_study.md
Created April 4, 2023 11:39 — forked from raysan5/custom_game_engines_small_study.md
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@coelhucas
coelhucas / final_example.js
Last active October 16, 2021 20:06
javascript reduce
const components = [
{
name: 'Button',
styles: {
color: 'white',
backgroundColor: 'black',
borderRadius: '20px'
}
},
{
@coelhucas
coelhucas / a11y_studies.js
Created September 28, 2021 21:00
Accessibility studies
// Use this: https://contrast-ratio.com/
/**
* Gets relative luminance from 8-bit RGB color
*/
function getRelativeLuminance(r8bit, g8bit, b8bit) {
const rsRGB = r8bit / 255;
const gsRGB = g8bit / 255;
const bsRGB = b8bit / 255;
@coelhucas
coelhucas / gipply.sh
Last active February 4, 2021 20:57
Gipply takes an URL to a diff and applies with a git apply. Helps to quickly customize dwm, for instance.
#!/bin/bash
url="$1"
# Check if received parameter
if [ -z "$url" ]
then
echo "URL to apply .diff must be supplied"
exit
fi
echo "Applying ${url}..."
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 Victor Gama de Oliveira <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
{
"odata.metadata":"http://ott.online.meo.pt/Catalog/v7/$metadata#Channels",
"odata.count":"152",
"value":[
{
"Id":98910,
"Title":"11",
"IsAdult":false,
"InPromotion":false,
"PromotionDescription":null,
{
"config":{
"url":"http://localhost:3000/api/v1.0/bff-plataforma/clientes",
"method":"post",
"data":"{\"nome\":\"lucas\",\"email\":\"[email protected]\",\"telefone\":\"(24) 99868-4321\",\"renda\":\"8.391.823,12\"}",
"headers":{
"Accept":"application/json, text/plain, */*",
"Content-Type":"application/json;charset=utf-8"
},
"baseURL":"http://localhost:3000/api",