Skip to content

Instantly share code, notes, and snippets.

// customPropToClassName.js
const traverse = element => {
if (element.props) {
let props = {};
if (element.props.customProp) {
// Inject className or anything you want
props.className = 'important-class';
}
@jide
jide / slices.js
Last active September 22, 2015 21:48
import React from 'react';
class Slice extends Component {
static propsTypes = {
children: PropTypes.func.isRequired
}
render() {
return this.props.children();
}
'use strict';//jshint
module.exports = function(grunt) {
grunt.initConfig({
less: {
compileCore: {
files: {
'css/style.css': 'less/style.less'
}
}
@import "../bootstrap/less/bootstrap.less";
@import "variables.less";
// Your rules go here
{
"name": "My project",
"version": "1.0.0",
"author": "author",
"homepage": "",
"devDependencies": {
"grunt": "*",
"grunt-contrib-clean": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-less": "*"
export default ({ Event, Region, Animate, Button, dispatch }) => ([
<Event start='00:00:00.000' end='00:00:10.000'>
<Region id='left' transition='cross-fade' duration={ 2 }>
<Button test={ dispatch('test') } type='important'>
Hello John !
</Button>
</Region>
<Region id='bottom' transition='cross-fade' duration={ 2 }>
<Button test={ dispatch('test') } type='important'>
Hello John !
STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ];
then
defaults write com.apple.finder AppleShowAllFiles NO
else
defaults write com.apple.finder AppleShowAllFiles YES
fi
killall Finder
open -a Finder
export default class Video extends Component {
render() {
return (
<video
ref='video'
{ ...this.props }
onDurationChange={ this.handleDurationChange }
onRateChange={ this.handleRateChange }
onTimeUpdate={ this.handleTimeUpdate }
onSeeking={ this.handleSeeking }
class Example extends Component {
componentWillReceiveProps(nextProps) {
// Only update state if needed.
if (nextProps.startTime !== this.state.startTime) {
// Change state using new prop value.
this.setState({
seconds: toSeconds(this.props.startTime)
})
}
}
@jide
jide / tooling.js
Created August 9, 2016 01:11
Tooling presets
// package.json
{
//...
"tooling": {
"presets": [
"modern", // es2015, stage-0, autoprefixer...
"react",
"redux",
"react-router",
"css-modules",