Skip to content

Instantly share code, notes, and snippets.

View jaredwilli's full-sized avatar
🏄‍♂️

Jared Williams jaredwilli

🏄‍♂️
View GitHub Profile
@wzup
wzup / _mixins.scss
Created February 1, 2017 13:33 — forked from joelstein/_mixins.scss
Horizontal list mixins
// 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 {
@fdidron
fdidron / App.js
Last active September 26, 2025 04:26
React Router v4 Auth
//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>
@natelandau
natelandau / bootstrapNewMac
Created January 24, 2017 14:45
A bootstrap script to install my dotfiles and configure a new computer
#!/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
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
})
@mtt87
mtt87 / PromiseRecursion.js
Created December 19, 2016 12:03
Promise recursion
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,
// }
@hex13
hex13 / render-promise-in-react.js
Created November 3, 2016 12:33
how to render promises in React
//License CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0/
class Deferred extends React.Component {
constructor(props) {
super(props);
this.state = {
value: ''
};
}
componentDidMount() {
@ericelliott
ericelliott / .travis.yml
Created October 29, 2016 20:46
Using Yarn on Travis-CI
language: node_js
node_js:
- "6"
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
@ryanbrunner
ryanbrunner / Tips And Tricks.md
Last active March 4, 2021 21:00
React tips and tricks

React Tips and Tricks

Here's some handy stuff you can use in React!

componentWillReceiveProps( nextProps, nextContext)
shouldComponentUpdate(nextProps,nextState,nextContext)
componentWillUpdate(nextProps,nextState,nextContext)
componentDidUpdate(prevProps,prevState,prevContext)