View Visibility.js
import { Children, PropTypes } from 'react';
const Visibility = ({ visible, children }) => (
visible ? Children.only(children) : null
);
Visibility.defaultProps = {
visible: true,
};
View diff-package-json.js
/**
* Simple script that compares our npm manifest against Oscar's manifest
* and list all results that don't match versions.
*
* Usage:
*
* node tools/diff-package-json.js path/to/oscar/package.json
**/
const current = require('../package');
View replace_strings.sh
# This script will take care of react-specific imports just so
# Preact can do its job (production only)
modules=./node_modules
bin=$modules/.bin
replace=$bin/replace
pattern="require\('react\/lib\/ReactDOMFactories'\)"
target=$modules/remarkable-react/lib/lib/renderer.js
if [ ! -d "$modules" ]; then
View markdown-image.js
const MATCH_MARKDOWN_IMAGE = /\!\[(.*)\]\((.*)\)/gm;
const MATCH_INLINE_IMAGE = /\(inline\)/i;
class MarkdownImage {
// We receive both `markdown` and `containerWidth` on the constructor here
static updateImageTags(markdown) {
let updatedMarkdown = markdown;
let match;
let matches = [];
View component.js
import Preact from 'preact'
import { StyleSheet, css } from 'aphrodite/no-important'
class Component extends Preact.Component {
constructor () {
super()
this._rawStyles = this.styles ? this.styles() : {}
this._styles = StyleSheet.create(this._rawStyles)
this._parseClassNames = this._parseClassNames.bind(this)
View index.js
// Polyfills
import 'promise-polyfill';
import 'whatwg-fetch';
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Redirect, Router, Route, IndexRoute, browserHistory } from 'react-router';
import configureStore from './store/configureStore';
View index.js
module.exports = {
meta: {
docs: {
description: 'requires a TODO to be specified either with a task number or URL and a message',
category: 'Best Practices',
recommended: true
},
schema: []
},
View .hyper.js
module.exports = {
config: {
fontSize: 18,
fontFamily: 'Roboto Mono, "DejaVu Sans Mono", "Lucida Console", monospace',
padding: '12px 14px',
},
plugins: [],
localPlugins: [
View .vimrc
"###############################################################################
"# Bootstrap
"###############################################################################
" Vim doesn't like fish
set shell=/bin/bash
" be iMproved, required
set nocompatible
View route.js
import settings from '../settings';
const {routes} = settings;
const {basePath} = routes;
/*
* Route path resolver.
* Read routes from the settings file.
*
* - id: route identifier (or alias)