Skip to content

Instantly share code, notes, and snippets.

Renato de Leão renatodeleao

Block or report user

Report or block renatodeleao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View closest-number-in-range.js
* @desc gets the closes number in a range of numbers
* @param {Array} list
* @param {Number} goal
* @author a mix of stackoverflowers
const closestInRange = (list, goal) => (
list.reduce((prev, curr) => (
Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev
renatodeleao / figma-api-get-svg-via-images-endpoint.js
Last active Aug 1, 2019
Figma API — Get an svg node (via /images endpoint)
View figma-api-get-svg-via-images-endpoint.js
const ACCESS_TOKEN = "token";
const FILE_ID = "fileId";
const NODE_ID = "Check the url for something like => 3%3A2";
const container = document.getElementById("figma-container")
function apiRequest(url) {
return fetch(url, {
method: 'GET',
headers: { "x-figma-token": ACCESS_TOKEN }
}).then(function(response) {
View .gitconfig
lg = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f"
abbrevCommit = true
renatodeleao / example.html
Created Oct 18, 2018 — forked from leevigraham/example.html
Renderless Flyout.Vue component
View example.html
<flyout v-cloak>
<div slot-scope="props">
v-bind:class="'border-2 p-1 ' + (props.isActive ? 'bg-green': 'bg-red')"
class="list-reset bg-white border p-4 shadow z-10"
renatodeleao /
Last active Apr 6, 2017
Quick prototyping with flexbox
position: relative;
display: flex;
//contains keyowords
[data-layout*="vertical"] { flex-direction: column; }
[data-layout*="wrap"] { flex-wrap: wrap; }
[data-layout*="between"] { justify-content: space-between; }
You can’t perform that action at this time.