Skip to content

Instantly share code, notes, and snippets.

View leoasis's full-sized avatar

Leonardo Garcia Crespo leoasis

View GitHub Profile
@leoasis
leoasis / 01.js
Last active June 26, 2017 19:03
Reparenting a component
import React, { Component } from 'react';
import PropTypes from 'proptypes';
import ReactDOM from 'react-dom';
const store = {};
function getMountNode(uid) {
if (!store[uid]) {
store[uid] = {
mountNode: document.createElement('div'),
@leoasis
leoasis / 01.js
Last active September 5, 2017 15:53
React Patterns - Render callback
class Parent extends React.Component {
render() {
return <Child foo={bar => <div>Hello {bar}!</div>} />;
}
}
@leoasis
leoasis / index.js
Created January 26, 2017 21:53
Pinterest example using upcoming React's coroutines
import React, { Component } from 'react';
import ReactDOM from 'react-dom/lib/ReactDOMFiber';
import { createCoroutine, createYield } from 'react-dom/lib/ReactCoroutine';
function Pin(props) {
return createYield(
{ height: props.height + 10 },
() => {
return (
<div
@leoasis
leoasis / index.js
Created September 29, 2015 18:39
Mix and Match
import "babel/polyfill";
import React from "react";
import { render } from "react-dom";
import isMobile from "is-mobile";
import { Spring, TransitionSpring } from "react-motion";
const config = [100, 15];
const spring = (values) => ({val: {...values}, config });
const getProfileInitialSpring = () => spring({size: 40, left: 25, top: 5});
@leoasis
leoasis / .gitconfig
Created November 17, 2014 13:10
Git alias to sync your branch from an upstream repo
[alias]
sync = !"sh -c 'git pull upstream ${1-$(git symbolic-ref --short -q HEAD)}; git push' -"
@leoasis
leoasis / marionette_rivets.js
Last active March 7, 2019 16:00
React vs Marionette + Rivets
var List = Backbone.Marionette.CollectionView.extend({
itemView: Item,
tagName: 'ul'
});
var Item = Backbone.Marionette.ItemView.extend({
tagName: 'li',
template: function(data) {
return '<span rv-text="model.name"></span><p rv-text="model.description"><p>';
},
@leoasis
leoasis / about.md
Created August 10, 2011 18:45 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer