Skip to content

Instantly share code, notes, and snippets.

View oleersoy's full-sized avatar

Ole Ersoy oleersoy

  • Firefly Semantics Corporation
  • Chicago
View GitHub Profile
export type Book = {
id: string;
volumeInfo: {
title: string;
subtitle: string;
authors: string[];
publisher: string;
publishDate: string;
description: string;
averageRating: number;
constructor(private http: HttpClient) {
this.bookStore.observeQuery().pipe(filter(Boolean),
debounceTime(200),
distinctUntilChanged(),
tap(async (query: string) => {
const bo: Observable<Book[]> = this.searchAPI(query);
const books: Book[] = await bo.toPromise();
this.bookStore.reset();
this.bookStore.postA(books);
})
import { NgModule } from '@angular/core';
import {
MatInputModule,
MatCardModule,
MatButtonModule,
MatSidenavModule,
MatListModule,
MatIconModule,
MatToolbarModule,
const isActiveTodoInCollection$:Observable<boolean> =
combineLatest(active$,
collection$,
(a, c)=>{
if (getMapValue(central.active)) {
return collection.containsById(getMapValue(central.active));
}
return false;
});
@oleersoy
oleersoy / pt.ts
Last active November 12, 2019 19:29
import { Component, Input } from '@angular/core';
import { Book } from '../model/';
@Component({
selector: 'bc-book-authors',
template: `
<h5 mat-subheader>Written By:</h5>
<span>
{{ authors | bcAddCommas }}
</span>
@oleersoy
oleersoy / rxjs.ts
Last active November 12, 2019 01:29
ngAfterViewInit() {
// server-side search
fromEvent(this.input.nativeElement,'keyup')
.pipe(
untilDestroyed(this),
filter(Boolean),
debounceTime(150),
distinctUntilChanged(),
tap(async (event:KeyboardEvent) => {
console.log(`The input value is ${this.input.nativeElement.value}`);
import { Component, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'fs-toolbar',
template: `
<mat-toolbar color="primary">
<button mat-icon-button (click)="openMenu.emit()">
<mat-icon>menu</mat-icon>
</button>
<ng-content></ng-content>
const googleLogoURL =
"https://raw.githubusercontent.com/fireflysemantics/logo/master/Google.svg";
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
constructor (
@oleersoy
oleersoy / console.ts
Created October 12, 2019 16:30
console
export class Console {
textarea: HTMLTextAreaElement;
constructor(container: HTMLElement) {
this.textarea = document.createElement("textarea");
container.appendChild(this.textarea);
}
/**
* @param
*/
log(message: string, type?: string) {
@oleersoy
oleersoy / input.ts
Created September 29, 2019 05:54
input.ts
const postCategories: PostCategory[] = [
{
id: "iot",
name: "IOT",
summary: "Internet of Things Posts.",
posts: [
{
id: "thermostat",
title: "Thermostat",
content: "How to make it really cold fast!"