Skip to content

Instantly share code, notes, and snippets.

Tim Holt astrotim

  • ABC
  • Brisbane
Block or report user

Report or block astrotim

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 .travis.yml
language: node_js
node_js:
- "node"
cache:
- yarn
install:
- yarn install
script:
- yarn build
deploy:
View react-router-dom.diff
import React, { Component } from 'react';
+import { BrowserRouter, Link, Switch, Route } from 'react-router-dom';
+import Home from './Home';
+import Post from './Post';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
@astrotim
astrotim / Home.js
Created Dec 22, 2017
stub out a new page
View Home.js
// Home.js
import React from 'react';
class Home extends React.Component {
render() {
return <p>Home</p>;
}
}
export default Home;
View display-grid.sass
@mixin display-grid {
// single column by default at XS size
@include screen-from($bp-sm-min) {
display: grid;
@include grid-not-supported {
display: flex;
flex-wrap: wrap;
};
@astrotim
astrotim / grid-not-supported.sass
Last active Aug 23, 2017
CSS Grid feature detection
View grid-not-supported.sass
@mixin grid-not-supported {
// fallback with native feature detection
@supports not (display: grid) {
@content;
}
// fallback with Modernizr feature detection (IE)
.no-supports & {
@content;
}
@astrotim
astrotim / client.js
Created Jul 25, 2017
The application file used by the development Webpack build
View client.js
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import App from './App';
const root = document.getElementById('root');
ReactDOM.render(<BrowserRouter><App /></BrowserRouter>, root);
@astrotim
astrotim / index.js
Created Jul 25, 2017
The application file used by the Webpack production build
View index.js
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import { StaticRouter as Router } from 'react-router-dom';
import App from './App';
import HTML from './HTML';
// static site generator
export default function render(locals, callback) {
const context = {};
@astrotim
astrotim / webpack.prod.config.js
Created Jul 25, 2017
Builds site as static files using StaticSiteGeneratorPlugin
View webpack.prod.config.js
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin');
module.exports = {
entry: [path.resolve(__dirname, 'src')],
output: {
@astrotim
astrotim / webpack.dev.config.js
Created Jul 25, 2017
Builds site as client side app and runs with Webpack dev server
View webpack.dev.config.js
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
bundle: path.resolve(__dirname, 'src', 'client.js'),
scripts: path.resolve(__dirname, 'src', 'scripts.js')
},
You can’t perform that action at this time.