Skip to content

Instantly share code, notes, and snippets.

View SebastianHGonzalez's full-sized avatar

Sebastian Gonzalez SebastianHGonzalez

View GitHub Profile
import React, { useState, useCallback } from "react";
import { func } from "prop-types";
import { connect } from "react-redux";
import useHistory from "./useHistory";
import FirstStep from "./FirstStep";
import SecondStep from "./SecondStep";
import ThirdStep from "./ThirdStep";
import FlowTransition from "./FlowTransition";
@SebastianHGonzalez
SebastianHGonzalez / transducers.js
Last active June 19, 2019 14:20
JS Transducers
const arrayReducer = (arr, elemnt) => arr.concat(elemnt)
arrayReducer.baseCase = []
const stringReducer = (string, string2) => string + string2
stringReducer.baseCase = ""
const functionReducer = (value, f) => f(value)
const mapTransducer = (f) => (reducer) => (acc, curr) => reducer(acc, f(curr))
const filterTransducer = (f) => (reducer) => (acc, curr) => f(curr) ? reducer(acc, curr) : acc
@SebastianHGonzalez
SebastianHGonzalez / ReactGrid.jsx
Last active May 26, 2019 00:07
ReactGrid using css grid and styled components
import React from "react";
import styled from "styled-components";
/**
* Copyright 2019 Sebastian Gonzalez
*
* 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 copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
@SebastianHGonzalez
SebastianHGonzalez / Wizard.jsx
Last active May 8, 2019 17:36
React Router Wizard
/**
* Copyright 2019 Sebastian Gonzalez
*
* 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 copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
@SebastianHGonzalez
SebastianHGonzalez / ReactUserPlaylist.js
Last active May 1, 2019 17:27
React User Playlist - Example of fetching and displaying an user's playlist using react hooks
/**
* React Example
* User Playlist
*
* Example of fetching and displaying an user's playlist using react hooks
*
*/
/**
* Copyright 2019 Sebastian Gonzalez
/**
* Copyright 2019 Sebastian Gonzalez
*
* 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 copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
@SebastianHGonzalez
SebastianHGonzalez / sassTransitionExample.scss
Created January 23, 2019 13:25
sass transitrions example
$pending-color: hsl(192, 69%, 50%);
$done-color: hsl(128, 69%, 50%);
@mixin transition($x...){
-webkit-transition: $x;
-moz-transition: $x;
-ms-transition: $x;
-o-transition: $x;
transition: $x;
}
@SebastianHGonzalez
SebastianHGonzalez / aopExample.js
Last active January 21, 2019 13:54
AOP example code
class PointCut {
aspects = [];
constructor(definition) {
this.inject(definition);
}
addAspect(aspect) {
this.aspects = [...this.aspects, aspect];
@SebastianHGonzalez
SebastianHGonzalez / pointCutDefinition.js
Last active January 21, 2019 13:24
first pointcutdefinition implementation
class PointCutDefinition {
/**
TODO
**/
decorateTargets(decorator) {
this.decorateMethods(decorator);
}
decorateMethods(decorator) {
this.targetClasses