Skip to content

Instantly share code, notes, and snippets.

View ayroblu's full-sized avatar

Ben Lu ayroblu

  • London
View GitHub Profile
import {MainApi} from '../api'
// import * as postActions from '../actions/post'
// Similar to redux thunk
// type ReduxAction = {
// dispatch: function
// , getState: function
// }
type StateFuncs = {
getState: function
@ayroblu
ayroblu / example.sql
Created June 20, 2017 05:55
Declarative DB
--Init:
CREATE TABLE table_name(
id INT PRIMARY KEY
, name TEXT NOT NULL
)
--Later on:
CREATE TABLE table_name(
id INT PRIMARY KEY
, name TEXT NOT NULL
function universalLoader(req, res) {
const filePath = path.resolve(__dirname, '..', 'build', 'index.html')
fs.readFile(filePath, 'utf8', (err, htmlData)=>{
if (err) {
console.error('err', err)
return res.status(404).end()
}
match({ routes, location: req.url }, (err, redirect, renderProps) => {
if(err) {
require('ignore-styles')
require('babel-register')({ ignore: /\/(build|node_modules)\//, presets: ['react-app'] })
const createElement = require('react').createElement
const renderToString = require('react-dom/server').renderToString
const {match, RouterContext} = require('react-router')
const routes = require('../src/routes').default()
const configureStore = require('../src/store').default
const Provider = require('react-redux').Provider
import { SET, RESET } from '../types/user'
export function set(payload){
return {
type: SET
, payload
}
}
export function reset(){
import React from 'react'
import { Router, Route, IndexRoute, browserHistory } from 'react-router'
import App from './containers/App'
import FirstPage from './containers/FirstPage'
import SecondPage from './containers/SecondPage'
import NoMatch from './components/NoMatch'
const Routes = props => {
return (
import { createStore, applyMiddleware, compose } from 'redux'
import reducers from './reducers'
export default function configureStore(initialState = {}) {
// Create the store with middlewares
const middlewares = [
]
const enhancers = [
applyMiddleware(...middlewares)
@ayroblu
ayroblu / RsyncTutorial.md
Last active February 3, 2017 12:20
How to rsync so that you get the directories right (such as when I do a deploy)
@ayroblu
ayroblu / Idea.md
Created January 4, 2017 08:06
An event planner idea

Event Planner

The idea behind this is people plan events and usually it requires a big team, and a lot of effort and a lot of note taking

We can simplify this by providing suppliers and task management, and calendar management to coordinate everyone on the same page

Tasks

  • Get "suppliers" - think flowers, caterers, entertainment through an online directory
#. /Users/blu/.profile
env shellshock="() { :; }; echo 'Shellshockable!'" bash -c "echo -n ''"
# Makes homebrew stuff work first
#export PATH='/usr/local/bin:$PATH'
# Makes colourful ls and such (more impressive stuff is abit further on
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced