Skip to content

Instantly share code, notes, and snippets.

@Devcon4
Devcon4 / Ai-intro.md
Last active July 29, 2019 17:56
AI-intro

AI Group Primer


Goal

In the AI group we will learn why you would use deep learning, what are neural networks and how to use tools like Tensorflow, gym and Python.

Format

My goal for AI club is to be very project based with few lectures. I want people to build cool stuff and show other how they did it. There will be regular challenges where everyone builds the same thing and we compare afterwards what people learned.

Examples

{"lastUpload":"2019-07-20T19:25:54.246Z","extensionVersion":"v3.4.0"}
@Devcon4
Devcon4 / BehaviorSubjectSource.ts
Last active September 3, 2018 01:09
SubjectSource
export class BehaviorSubject<T> extends Subject<T> {
getValue(): T {}
}
@Devcon4
Devcon4 / SubscriberSource.ts
Last active September 3, 2018 00:05
SubscriberSource
/**
* Implements the {@link Observer} interface and extends the
* {@link Subscription} class. While the {@link Observer} is the public API for
* consuming the values of an {@link Observable}, all Observers get converted to
* a Subscriber, in order to provide Subscription-like capabilities such as
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
* implementing operators, but it is rarely used as a public API.
*
* @class Subscriber<T>
*/
@Devcon4
Devcon4 / CreateObservable.ts
Last active September 2, 2018 22:16
CreateObservable.ts
import { of, BehaviorSubject } from 'rxjs';
import { take, map } from 'rxjs/operators';
// Create observable.
const obs = of([1, 2, 3]);
const sub1 = obs.subscribe(console.log);
const sub2 = obs.pipe(take(1)).subscribe(console.log);
const sub3 = obs.pipe(map(arr => arr[0])).subscribe(console.log);
@Devcon4
Devcon4 / ObservableSource.ts
Last active September 2, 2018 22:53
ObservableSource
/**
* A representation of any set of values over any amount of time. This is the most basic building block
* of RxJS.
*/
export class Observable<T> implements Subscribable<T> {
constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic) { }
subscribe(observerOrNext?: PartialObserver<T> | ((value: T) => void),
error?: (error: any) => void,
complete?: () => void): Subscription;
public interface ISendEmail<in T>
{
void SendEmail(T param);
}
public interface ISendInApp<in T>
{
void SendInApp(T param);
}
export type Spied<T> = {
[K in keyof T]: T[K] extends Function ? jasmine.Spy : T[K] extends object ? Spied<T[K]> : T[K];
};
export function spyOnClass<T, U1 extends unknown[]>(type: new (...tArg1: U1) => T, ...arg1: U1) {
let spyOnFunctions = function <W>(obj: W): Spied<W> {
Object.keys(obj).forEach(p => {
if (!!obj && !arg1.some(a => obj[p] === a)) {
if (obj[p] instanceof Function) {
spyOn(obj, p as keyof W);
type funcPropNames<T> = {
[prop in keyof T]: T[prop] extends Function ? prop : never;
}[keyof T];
type FunctionProps<T> = Pick<T, funcPropNames<T>>;
export type Spied<T> = {
[k in keyof T]: k extends FunctionProps<T> ? jasmine.Spy : T;
};
export interface IActionable<T> {
state: T;
subject: BehaviorSubject<T>;
}
export class Action<T> {
_subject = new BehaviorSubject<T>(undefined);
public get state() : T {