Skip to content

Instantly share code, notes, and snippets.

vonwao

Block or report user

Report or block vonwao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View styled-system-react-native.js
import React from 'react';
import * as N from 'react-native';
import styled from 'styled-components';
import {
compose,
space,
color,
layout,
typography,
flexbox,
View gist:fd8bdedafa3c4b61ab24b7a5cc185b68
import React from 'react';
import PropTypes from 'prop-types';
import debounce from 'lodash/debounce';
class OnChangeDebounce extends React.Component{
constructor(props){
super(props);
this.isValueSourceProps = this.props.hasOwnProperty(this.props.valueProperty);
this._createDebounceFunction(props);
View Styled-component-usage.md

Styled component use case

Styled component as standard react component

avoid creating middleware react component

before

const StyledIcon = styled(Icon)``;
export const HomeIcon = () => <StyledIcon uri="icn-home.svg" />;
View PostList.jsx
import React from 'react';
const PostList = ({posts}) => (
<div>
<ul>
{posts.map(post => (
<li key={post._id}>
<a href={`/post/${post._id}`}>{post.title}</a>
</li>
))}
@vonwao
vonwao / routes.jsx
Created Jan 29, 2016
mantra sample
View routes.jsx
import React from 'react';
import {FlowRouter} from 'meteor/kadira:flow-router';
import {mount} from 'react-mounter';
import MainLayout from '/client/modules/core/components/layout.main.jsx';
import PostList from '/client/modules/core/containers/postlist';
import Post from '/client/modules/core/containers/post';
import NewPost from '/client/modules/core/containers/newpost';
export default function (injectDeps) {
View bootreact
/** @jsx React.DOM */
'use strict';
// Components wrapping Twitter Bootstrap stuff
//
var BSNames = {
// This isn't exhaustive. Need to think through what should go here. Should
// be exclusive.
bsClass: {'column': 'col', 'button': 'btn', 'btn-group': 'btn-group', 'label': 'label',
View BootstrapModalMixin.js
/** @jsx React.DOM */
var BootstrapModalMixin = function() {
var handlerProps =
['handleShow', 'handleShown', 'handleHide', 'handleHidden']
var bsModalEvents = {
handleShow: 'show.bs.modal'
, handleShown: 'shown.bs.modal'
, handleHide: 'hide.bs.modal'
@vonwao
vonwao / gist:2305906
Created Apr 4, 2012
kotlin extension function
View gist:2305906
fun List<Int>.swap(x : Int, y : Int) {
val tmp = this[x] // 'this' corresponds to the list
this[x] = this[y]
this[y] = tmp
}
You can’t perform that action at this time.