Skip to content

Instantly share code, notes, and snippets.

View ayozebarrera's full-sized avatar
⚛️
Reacting

Ayoze Barrera ayozebarrera

⚛️
Reacting
View GitHub Profile
@ayozebarrera
ayozebarrera / hyperjs.md
Created May 2, 2020 09:26 — forked from raftheunis87/hyperjs.md
Hyper.js + Hyper.js Plugins + ZSH + Starship + Fira Code + Dark Theme - (macOS)

Hyper.js

@ayozebarrera
ayozebarrera / async-await.js
Created May 28, 2018 10:42 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@ayozebarrera
ayozebarrera / AppDispatcher.js
Created December 18, 2017 16:48 — forked from tgroshon/AppDispatcher.js
A Flux Dispatcher with an Action Queue sitting on top to allow dispatching actions at any time.
/**
* Create an ActionQueue and dispatch each synchronously
* @author tgroshon
*
* See an alternate implementation using ASync from
* https://github.com/facebook/flux/issues/106
* by fabiozaffani
*/
import {Dispatcher} from 'flux'
@ayozebarrera
ayozebarrera / README.md
Created July 24, 2017 08:17 — forked from joyrexus/README.md
Nested grouping of arrays

nest.js

A multi-level groupBy for arrays inspired by D3's nest operator.

Nesting allows elements in an array to be grouped into a hierarchical tree structure; think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. The levels in the tree are specified by key functions.

See this fiddle for live demo.

@ayozebarrera
ayozebarrera / materialAccents.js
Created December 12, 2016 18:38 — forked from rileyjshaw/materialAccents.js
Return an array of accent colors from Google's [Material Design guide](http://www.google.com/design/spec/style/color.html)
[].filter.call(document.querySelectorAll('.color-group .color'), function(el) {
return el.querySelector('.shade').textContent === 'A400';
}).map(function (el) {
return el.querySelector('.hex').textContent;
});
@ayozebarrera
ayozebarrera / random.js
Created July 19, 2016 16:35 — forked from kerimdzhanov/random.js
Javascript get random number in a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {float} a random floating point number
*/
function getRandom(min, max) {
return Math.random() * (max - min) + min;
}
@ayozebarrera
ayozebarrera / example.js
Created January 8, 2016 10:00 — forked from samwgoldman/example.js
Pure, stateless, type-checked React components with Immutable.js and Flow
/* @flow */
var React = require("react")
var Immutable = require("immutable")
// In order to use any type as props, including Immutable objects, we
// wrap our prop type as the sole "data" key passed as props.
type Component<P> = ReactClass<{},{ data: P },{}>
type Element = ReactElement<any, any, any>
/** @jsx React.DOM */
var SVGComponent = React.createClass({
render: function() {
return this.transferPropsTo(
<svg>{this.props.children}</svg>
);
}
});
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {

#Tmux Cheat Sheet

Dotfiles: richardkall/dotfiles

##Basic

Command Description
<C-a> Prefix
`` : Command mode