Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonardo Garcia Crespo leoasis

View GitHub Profile
@leoasis
leoasis / marionette_rivets.js
Last active Mar 7, 2019
React vs Marionette + Rivets
View marionette_rivets.js
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 Aug 10, 2011 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
View about.md
@leoasis
leoasis / 01.js
Last active Sep 5, 2017
React Patterns - Render callback
View 01.js
class Parent extends React.Component {
render() {
return <Child foo={bar => <div>Hello {bar}!</div>} />;
}
}
@leoasis
leoasis / 01.js
Last active Jun 26, 2017
Reparenting a component
View 01.js
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 / index.js
Created Jan 26, 2017
Pinterest example using upcoming React's coroutines
View index.js
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 Sep 29, 2015
Mix and Match
View index.js
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 Nov 17, 2014
Git alias to sync your branch from an upstream repo
View .gitconfig
[alias]
sync = !"sh -c 'git pull upstream ${1-$(git symbolic-ref --short -q HEAD)}; git push' -"
You can’t perform that action at this time.