Skip to content

Instantly share code, notes, and snippets.

View Sauloxd's full-sized avatar
🍊
orange

Saulo Furuta Sauloxd

🍊
orange
View GitHub Profile
/*
* This script fetches all color styles from a Figma team/document.
*
* Dependencies:
*
* - node-fetch
*
* Due to a limitation in the Figma /styles endpoint, we need to use a
* document for actually using the colors in a color grid 🙄That's why
* we're both fetching from /styles and /files below.
@lifeart
lifeart / EmberStyleAngularController.js
Last active March 4, 2020 01:47
Angular Simple DI for controller ES6
class AngularController {
static injections() {
return ['$scope', 'lodash', '$moment', '$timeout'];
}
static requredInjections() {
return ['lodash', '$timeout'];
}
static getInjections() {
let injections = this.injections();
this.requredInjections().map(injectionName => {
@jesstelford
jesstelford / README.md
Last active November 14, 2023 12:26
Starving the Event Loop with Microtasks

Starving the Event Loop with microtasks

"What's the Event Loop?"

Sparked from this twitter conversation when talking about doing fast async rendering of declarative UIs in Preact

These examples show how it's possible to starve the main event loop with microtasks (because the microtask queue is emptied at the end of every item in the event loop queue). Note that these are contrived examples, but can be reflective of situations where Promises are incorrectly expected to yield to the event loop "because they're async".

  • setTimeout-only.js is there to form a baseline
@robertknight
robertknight / Build.md
Last active July 8, 2022 01:32
Minimal Webpack DllPlugin example

Compile with:

webpack --config vendor.webpack.config.js
webpack --config app.webpack.config.js

Use with the following index.html

@seanbuscay
seanbuscay / git_create_orphan.sh
Created June 27, 2013 15:26
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@ajvargo
ajvargo / input_example.el
Created January 20, 2013 03:56
An example of getting user input for an Elisp function with a default value divined from context.
(defun input-example (text)
"Gets user input and prints it back. Defaults to word at point"
(interactive
(list
(read-string
(format "Text (%s): " (word-at-point)) ; prompt. It's nice to show the default value
nil ; initial input. This value is prefilled in the mini-buffer. Available but considered deprecated.
nil ; history list if you have a specific one for this
(word-at-point) ; Whatever this evaluates to will be the default value
)))
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git