Skip to content

Instantly share code, notes, and snippets.

View e-schultz's full-sized avatar

Evan Schultz e-schultz

View GitHub Profile
@e-schultz
e-schultz / redux-test.ts
Created August 3, 2017 11:28
TypeScript action creators / reducers
export enum SomeActions {
AGE_ACTION = 'AGE_ACTION',
NAME_ACTION = 'NAME_ACTION',
LASTNAME_ACTION = 'LASTNAME_ACTION'
}
interface Age extends Action {
type: SomeActions.AGE_ACTION;
payload: {
age: number;
}
@e-schultz
e-schultz / photo.md
Last active February 12, 2018 22:46
photo.md

img_8178

@e-schultz
e-schultz / rxjs.md
Last active June 12, 2018 19:35
Useful RXJS Stuff
@e-schultz
e-schultz / notes.md
Created October 31, 2018 15:39
Vue Things

Another way we can approach passing data down into Vue, is instead of passing in an object like

<SomeComponent :contact="contact"/>

and in SomeComponent needing to do

{{contact.firstName}}
@e-schultz
e-schultz / test.js
Created January 4, 2019 19:34
pts fork
// Source code licensed under Apache License 2.0.
// Copyright © 2017 William Ngan. (https://github.com/williamngan/pts)
window.demoDescription = "A retro-style dazzling effect created by a grid whose cells change color and size based on their distances to the pointer.";
Pts.quickStart( "#pt", "#123" );
//// Demo code starts (anonymous function wrapper is optional) ---
(function() {
@e-schultz
e-schultz / ex1.md
Created March 13, 2019 15:02
Function Overload Example

JavaScript does not allow you to overload a function

function add(a: number[], b: number[]): number {
    let sum = (acc,val)=>acc+val;
    return a.reduce(sum,0) + b.reduce(sum,0)
}
function add(a: string, b: string) : string{
    return a + b;
}
@e-schultz
e-schultz / hooks-before-class.md
Last active May 1, 2019 14:26
Should you teach Hooks before Classes

When teaching React, should you cover Hooks first or classes?

I've been running a 3-4 day course covering fundamental JavaScript and React. The first day or so is focused on JavaScript fundamentals and new features of ES2015.

  • let, var, const
  • destructuring
  • functions, arrow functions, scope, context
  • arrays / array methods - map, filter, reduce

Basically, the material covered in JavaScript - The React Parts

@e-schultz
e-schultz / divjoy.js
Last active August 16, 2019 20:59
the joy
let divJoyExport = {
data: [
{
type: "instance",
subtype: "app-instance",
componentId: "app",
id: 4010090
}
],
components: [
@e-schultz
e-schultz / react hooks - lifecycle-search.jsx
Created August 20, 2019 15:48
react hooks - lifecycle
export default SearchComponent extends Component {
constructor(props) {
super(props);
this.state = {
results: []
}
}
componentDidMount() {
this.query(this.props.id)
@e-schultz
e-schultz / component - hooks.jsx
Created August 20, 2019 15:50
react - hooks - lifecycle post
export default SomeComponent = ({id}) => {
let [results, setResults] = useState([]);
useEffect(()=>{
fetch(`/some/url/${id}`)
.then(r=>r.json())
.then(r=>setResults(r))
},[id])
}