Skip to content

Instantly share code, notes, and snippets.

@Sstobo
Sstobo / freelanceaccounting.txt
Created December 1, 2017 05:13
[Freelancing Accounting] #freelance #accounting #job #pay
Use Wave / Toggl to bill
Include correct info
-date
-description of services
-payment terms (date, late fees, ect)
-GST / Reference number
-under 1000$ pay with credit card
Save Taxes
@Sstobo
Sstobo / react-day1.txt
Created January 9, 2018 21:52
[React Day 1] #react
SSR -> Server Side Rendering
SPA -> Single Page Application
#### SETUP Local Development Server #####
use html boiler plate in ADP
-> npm i -g http-server
-> http-server
-->create-react-app [name of app]
@Sstobo
Sstobo / react-day2.txt
Created January 10, 2018 19:44
[React Day2] #react
State
One-way data flow
Two-way data binding
Synthetic events
### Ref
For taking input from forms
@Sstobo
Sstobo / gist:1920e3257ba9621466d1e6cb43988561
Last active January 26, 2018 15:32
[React serve local json] #react #json
npm i -g json-server
json-server --watch db.json -p 4000
// "test": "echo \"Error: no test specified\" && exit 1",
// "start": "PORT=4001 nodemon index.js"
const items = fetch(' http://localhost:4000/items');
@Sstobo
Sstobo / gist:2127d1f347ecb94480e9bf3dc74b62f2
Created January 11, 2018 19:42
[React Routing] #react #routing
import React, { Component } from 'react';
import { render } from 'react-dom';
import {
BrowserRouter as Router,
Route,
Switch,
Link,
Redirect
} from 'react-router-dom';
@Sstobo
Sstobo / functional-programming.txt
Created January 15, 2018 23:51
[Functional Programming] #react #js
Procedural Programming
###### Pure function
- function that does not rely on data outside of its scope. Just does itself. No side effects.
- one output
- if it manipulates a global variable, it is impure (copy list into new variable, output that
- take an argument, make it newVariable, modify, output
{ robot.name = "Sean"} is a "reference" <- this will modify a global variable
{ robot = { name: "Sean" } } is "pass by value" <- this will not leave scope
@Sstobo
Sstobo / gist:fddb937331d1318edf31b9732220246a
Created January 16, 2018 00:42
[Reduce, map, filter, slice] #js
function toList(stockedList)
// Grocery store lab
const data = [
['apples', 73],
['pears', 12],
['oranges', 97],
['grapes', 387],
['grapes', 88],
const array = [
[name: sean,
age: 35,
height: 6
]
const CopyOfArray = { ...array };
##### Spread is how we copy arrays
TV = "state machine"
Remote control sends "actions"
-channel up / down
-power on ect
Webpack Installation
Install Webpack and its dependencies in your project:
npm install --save-dev babel-loader babel-core babel-preset-stage-0 webpack webpack-dev-server html-webpack-plugin
Add scripts to your package.json:
@Sstobo
Sstobo / redux-vocab
Created January 17, 2018 19:54
[React Redux vocabulary] #
REDUX GIVES YOU THE STORE, DISPATCH AND REDUCERS
###
store holds state
state is 0
click the +1 button
'dispatches an action (which is action and state) to reducer
switch in reducer = if ActionType = type(increment) and payload (1), use the increment switch in the reducer to add 1 to state
state gets send back to store