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 / 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 / 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 / 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 / rxjs.md
Last active June 12, 2018 19:35
Useful RXJS Stuff
@e-schultz
e-schultz / photo.md
Last active February 12, 2018 22:46
photo.md

img_8178

@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 / ng2conf2016notes.md
Last active May 4, 2016 17:25
ng2conf2016notes

Welcome Talk

  • Focus on speed - rendering, 2.5x faster, re-render, 4.2x faster

  • template compiler - can have an offline compile step, generate optimized javascript

  • Angular 2 - currently, kind of big - 170k, angular1 - was 56k, ng2 - down to 45k

  • improved lazy loading of routes

  • angular universal - server side rendering improvement, sends on the server side - sends out just HTML/css

  • first payload comes down - start streaming full JS to actually run the app

  • can include a preboot script that records user actions - that replays once everything is ready

@e-schultz
e-schultz / app.ts
Created April 6, 2016 12:37
NG2 Modal
import {Component} from 'angular2/core';
import Modal from './modal';
@Component({
selector: 'ngc-app',
template: `
<div class="p3">
<p class="p4">
<button class="btn btn-primary block col-6 mx-auto"
(click)="showModal()">
@e-schultz
e-schultz / state-service.ts
Created March 17, 2016 18:05
state-service
import {Injectable, Inject} from 'angular2/core';
import {BehaviorSubject} from 'rxjs/Rx';
@Injectable()
export default class StateService {
store: any;
_ngRedux: any;
constructor(@Inject('ngRedux') ngRedux) {
this.store = this.observableFromStore(ngRedux);
this._ngRedux = ngRedux;
import { is } from 'immutable'
let x = 0;
let tasksTest$ = this.stateService.select(state=> state.tasks, is).subscribe(n=> {
console.log('this is called... yeah',++x)
})