Skip to content

Instantly share code, notes, and snippets.

import store from './store'
export default class HttpClient {
getUser() {
const token = store.getState()
// fetch and pass along your token
}
}
import httpClient from './httpClient'
const login = (email, password) => (dispatch) => {
return httpClient.login(email, password)
.then(response => {
httpClient.token = response.token
dispatch(loginSuccess(response))
})
}
@hedgerh
hedgerh / inplay.jsx
Last active September 10, 2018 13:10
import React, { Component } from "react";
import axios from "axios";
import moment from "moment";
export default class Feutred extends Component {
state = {
sports: [],
events: [],
isLoading: true,
errors: null
@hedgerh
hedgerh / gulpfile.js
Created July 2, 2015 00:18
Simple gulp build system
'use strict';
var path = require('path');
var gulp = require('gulp'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
const initialState = {
1: {
todos: [],
visibilityFilter: 'SHOW_ALL'
},
2: {
todos: [],
visibilityFilter: 'SHOW_ALL'
},
3: {
function* countdown() {
yield call(delay, toMilliseconds(480));
yield put(showLogoutWarning());
yield call(delay, toMilliseconds(120));
yield put(logout());
}
function* watchForActivity() {
while (true) {
yield takeLatest(action => action.type !== ' SHOW_LOGOUT_WARNING', countdown);
const Client = require('./Client')
const StatusSocket = require('./Socket')
/**
* Upload files to Transloadit using Tus.
*/
module.exports = class Transloadit extends EventEmitter {
constructor (core, opts) {
super(core, opts)
this.type = 'uploader'
.container {
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
}
.container::after {
content: "";
display: table;
clear: both;
@hedgerh
hedgerh / cross-browser.md
Last active April 6, 2017 18:05
How to add easy cross-browser testing to your existing project

Here's an easy way to add easy cross-browser testing on your existing projects using browser-sync

1. install browser-sync

npm i browser-sync --save-dev

2. add an npm script to your package.json

"test:browser": "browser-sync start --config ./bs-config.js"

@hedgerh
hedgerh / README.md
Last active April 1, 2017 22:22
Build Gitbooks for each Git tag of a repository.

Setup:

Set permissions to allow script to run

chmod a+x ./gitbook-tag-build.sh

Usage:

Choose an output folder, and an input file containing a list of Git tags.

The default ouput folder is _allBooks and the default input is .gitbook-tags