Skip to content

Instantly share code, notes, and snippets.

View ayozebarrera's full-sized avatar
⚛️
Reacting

Ayoze Barrera ayozebarrera

⚛️
Reacting
View GitHub Profile
@raftheunis87
raftheunis87 / hyperjs.md
Last active January 2, 2024 14:04
Hyper.js + Hyper.js Plugins + ZSH + Starship + Fira Code + Dark Theme - (macOS)

Hyper.js

@kitze
kitze / conditionalwrap.js
Created October 25, 2017 16:54
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
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
});
}
@samwgoldman
samwgoldman / example.js
Last active April 3, 2021 22:20
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>
@tgroshon
tgroshon / AppDispatcher.js
Last active September 1, 2019 14:34
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 / make-repo.sh
Last active August 29, 2015 14:15
Make a repository on github from command line
###############################################################################
# CREAR UN REPOSITORIO EN GITHUB DESDE LA TERMINAL ############################
###############################################################################
###############################################################################
# Crear el repositorio en Github (Github API v3)
curl -u '<user>' https://api.github.com/user/repos -d '{ "name": "<repository>" }'
# Añadir el repositorio remoto de Github a nuestro repositorio local
git remote add origin git@github.com:<user>/<repository>.git
# Añadimos todos los cambios
@marioblas
marioblas / generate-ssh-key.sh
Last active March 29, 2016 18:58
🔐 Generating SSH keys
# References:
# https://help.github.com/articles/generating-ssh-keys/
# https://help.github.com/articles/working-with-ssh-key-passphrases/
###############################################################################
# 1. Check for SSH keys
###############################################################################
# List the files in your .ssh directory, if they exist
ls -al ~/.ssh
@rileyjshaw
rileyjshaw / materialAccents.js
Created October 18, 2014 21:21
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;
});
function numerical_int(dx, y_array) {
var maxy = Math.max.apply(null, y_array);
var dy_array = y_array.map(function(num) {
return Math.abs(maxy - num);
});
var profile_integral = 0;
var n = dy_array.length;
for (i = 1; i < n; i++) {
var dy_init = dy_array[i - 1];
var dy_end = dy_array[i];
@marioblas
marioblas / git-cheat-sheet.sh
Last active March 22, 2017 11:32
🔀 Git cheat sheet
###############################################################################
# EMPEZANDO ###################################################################
###############################################################################
# Configurar email y nombre
git config --global user.name "John Doe"
git config --global user.email "foobarbaz@gmail.com"
# Crear un nuevo repositorio
git init