Skip to content

Instantly share code, notes, and snippets.

View image.js
import React, { Component } from 'react';
import styled from 'styled-components';
const Figure = styled.figure`
height: 0;
margin: 0;
background-color: #efefef;
position: relative;
padding-bottom: ${props => props.ratio}%;
`;
View Component.jsx
import React from 'react';
import MapBox from './Map.jsx';
var Component = React.createClass({
getInitialState: function() {
return {
data: {
x: 0,
y: 0
}
View file.js
show(status, slotId, carStatusTypeInfo) {
var typeIdForCar = '';
if (typeof status === 'undefined') {
var types = ['ACTIVE', 'DISABLED', /* ... */];
typeIdForCar = types.reduce(function(value, type){
return value || this.getTypeIdForCar(carStatusTypeInfo, type);
}, '');
} else {
typeIdForCar = this.getTypeIdForCar(carStatusTypeInfo, status)
}
View routes.js
import React from 'react'
import { IndexRoute, Route } from 'react-router'
import RootComponent from './containers/RootComponent'
import BaseLayout from './components/BaseLayout'
import AuthenticatedLayout from './components/AuthenticatedLayout'
import Auth from './containers/Auth'
import Dashboard from './containers/Dashboard'
import Inbox from './containers/Inbox'
import Schedule from './containers/Schedule'
import NotFound from './components/NotFound'
View routes.js
import React from 'react'
import { IndexRoute, Route } from 'react-router'
import RootComponent from './containers/RootComponent'
import BaseLayout from './components/BaseLayout'
import AuthenticatedLayout from './components/AuthenticatedLayout'
import Auth from './containers/Auth'
import Dashboard from './containers/Dashboard'
import Inbox from './containers/Inbox'
import Schedule from './containers/Schedule'
@brigand
brigand / ioRpi.md
Last active Aug 29, 2015
easy installation of io.js on a rasberry pi
View ioRpi.md

io.js on raspberry pi

installing io.js is now really easy thanks to the io.js and nvm team. They provides prebuilt binaries for arm.

get the system up to date

io.js require packages that are not available on the standard (Wheezy) need to change to Jessie. Update your package url

@brigand
brigand / 1.js
Last active Aug 29, 2015 — forked from lf94/1.js
View 1.js
/*
A widget that will appear when the screen reaches a certain size. Allows opening and closing of a sidebar.
100% pure, vanilla JavaScript and CSS.
*/
(function(){
var Badge = function(target, placement) {
var self = this;
this.target = target;
this.placement = placement;
View gist:653e1df562c3f5e1c9d2
var breadOne = {};
breadOne.name = "White";
breadOne.type = "Flour";
//why make vars inside the constructor Bread if I can add more here like this?
breadOne.whatever = "another option";
View LoginForm.js
import React from 'react/addons';
import ReactMixin from 'react-mixin';
import ReactScriptLoaderMixin from 'react-script-loader';
export default class LoginForm extends React.Component {
constructor() {
super();
this.state = {
user: '',
password: '',
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.js"></script>
<!-- uncomment for React master
<script src="http://react.zpao.com/builds/master/latest/react.js"></script>
-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.7.0/codemirror.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.7.0/theme/solarized.min.css">