This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Standard horizontal list, using word-spacing trick to remove whitespace | |
| // between inline-block elements. | |
| @mixin horizontal-list { | |
| padding: 0; | |
| text-align: center; | |
| word-spacing: -1em; | |
| display: table; | |
| width: 100%; | |
| li { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Usage | |
| import React from 'react'; | |
| import { BrowserRouter as Router } from 'react-router-dom'; | |
| import Route from './AuthRoute'; | |
| import Login from './Login'; | |
| import Private from './Private'; | |
| export default () => | |
| <Router> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # This bootstraps installing ssh-keys to github | |
| # set colors | |
| if tput setaf 1 &> /dev/null; then | |
| tput sgr0 | |
| if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then | |
| ORANGE="$(tput setaf 172)" | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const assert = require('assert') | |
| const fakeFetch = (url, page=+url.split('page=')[1], | |
| perpage=3, | |
| data=[1,4,6,9,7,3,1,4]) => | |
| Promise.resolve({ | |
| data: data.slice((page-1)*perpage, page*perpage), | |
| nextPage: page*perpage < data.length ? page+1 : null | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fetchPages(resultsArray, page, end) { | |
| return new Promise((resolve, reject) => { | |
| fetch(`https://my-api.com/?page=${page}`) | |
| .then((res) => { | |
| // res.json | |
| // { | |
| // data: [1,2,3], | |
| // nextPage: 1, | |
| // previousPage: 0, | |
| // } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //License CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0/ | |
| class Deferred extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| value: '' | |
| }; | |
| } | |
| componentDidMount() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| language: node_js | |
| node_js: | |
| - "6" | |
| env: | |
| - CXX=g++-4.8 | |
| addons: | |
| apt: | |
| sources: | |
| - ubuntu-toolchain-r-test | |
| packages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| componentWillReceiveProps( nextProps, nextContext) | |
| shouldComponentUpdate(nextProps,nextState,nextContext) | |
| componentWillUpdate(nextProps,nextState,nextContext) | |
| componentDidUpdate(prevProps,prevState,prevContext) |