varreq tab
--> cursor in two spots: after var and after require('
varreq tab
github --> var github = require('github');
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import { Router, Route } from 'react-router'; | |
import { reduxRouteComponent } from 'redux-react-router'; | |
import { checkAuthentication } from '../actions/AuthActions.js'; | |
import Root from './Layout/Root'; | |
import Dashboard from './Dashboard'; |
# sass-lint config generated by make-sass-lint-config v0.0.4 | |
# | |
# The following scss-lint Linters are not yet supported by sass-lint: | |
# BemDepth, DisableLinterReason, ElsePlacement, PropertyCount | |
# PropertyUnits, SelectorDepth, SelectorFormat, SpaceAroundOperator | |
# TrailingWhitespace, UnnecessaryMantissa, UnnecessaryParentReference, Compass::* | |
# | |
# The following settings/values are unsupported by sass-lint: | |
# Linter Indentation, option "allow_non_nested_indentation" | |
# Linter Indentation, option "character" |
// Here is a very simple Node.js script to perform GET HTTP requests to a | |
// collection of similar pages (see `URLS`) in order to extract some information | |
// from the (virtual) DOM. For instance, you could parse an array of pages and | |
// grab the title of each of them. | |
// | |
// The script then writes the resulting data (an array as well, of course) in a | |
// JSON file (see `DEST_FILE`). It will also cache the requested HTML documents | |
// in a cache file (see `CACHE_FILE`) in order to avoid having to perform all | |
// the HTTP requests when only the collected data changes (see `parseData`). |
{ | |
"parser": "babel-eslint", | |
"env": { | |
"es6": true, | |
"mocha": true, | |
"node": true | |
}, | |
"ecmaFeatures": { | |
"blockBindings": true, | |
"forOf": true, |
So this is roughly how I handle CSS these days. As much as I'd like to use CSSModules for everything, I work on a lot of different projects, for a lot of different clients. They can't all be a SPA.
Some of this seems blindingly obvious. But until I stop cleaning up messy, repetitive CSS, I figure it all merits being said.
I use one file to style HTML. This creates a baseline for the body, defines my box model, sets global typography rules, etc. If I need to style an HTML element, I style it globally. Otherwise, I give an element a class, and only style that class.
/* this lacks subscribe behavior or ability to dispatch from outside of component tree but that is generally not neccesary */ | |
class State extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = YOUR_INITIAL_STATE; | |
} | |
reducer = (action, state, props) => {...newState}; | |
/* setState takes an object of new state as first arg or a function of props and state that returns new state | |
* which we will use here | |
* we pass dispatch around and use it similarly to redux dispatch |
function £http(method, uri, body) { | |
let opts = { | |
mode: 'cors', | |
method: method, | |
credentials: 'include', | |
headers: { | |
'Content-Type': 'application/json', | |
'Accept': 'application/json', | |
'X-XSRF-TOKEN': getCookieValue('XSRF-TOKEN') | |
} |
let Rx = require(`rx`) | |
function makeRequestProxies(drivers) { | |
let requestProxies = {} | |
for (let name in drivers) { | |
if (drivers.hasOwnProperty(name)) { | |
requestProxies[name] = new Rx.ReplaySubject(1) | |
} | |
} | |
return requestProxies |
import React from 'react' | |
import { Machine } from 'xstate' | |
const createMachineComponent = chart => Comp => { | |
const machine = Machine(chart) | |
return class extends React.Component { | |
state = { | |
state: machine.getInitialState(), | |
data: {} |