This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, ChangeDetectionStrategy, Output, EventEmitter } from '@angular/core'; | |
import { ListQuery, ListState, List } from '../state'; | |
import { Observable } from 'rxjs'; | |
import { ShopikaService } from '../state/shopika.service'; | |
import { ID } from '@datorama/akita'; | |
@Component({ | |
selector: 'app-list', | |
templateUrl: './list.component.html', | |
styleUrls: ['./list.component.css'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ListStore } from './shopika.store'; | |
import { List, Item } from './shopika.model'; | |
import { ID, update } from '@datorama/akita'; | |
export class ShopikaService { | |
constructor(private listStore: ListStore) { | |
} | |
addList(list: List) { | |
this.listStore.add(list); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs/index'; | |
import { List, Item } from './shopika.model'; | |
import { ID } from '@datorama/akita'; | |
import { of } from 'rxjs'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ShopikaDataService { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { QueryEntity } from '@datorama/akita'; | |
import { ListStore, ItemStore, ListState, ItemState } from './shopping-list.store'; | |
import { List, Item } from './shopping-list.model'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ListQuery extends QueryEntity<ListState, List> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { EntityState, EntityStore } from '@datorama/akita'; | |
import { List } from './shopping-list.model'; | |
import { config } from '@datorama/akita'; | |
export interface ListState extends EntityState<List> {} | |
export interface ItemState extends EntityState<List> {} | |
@Injectable({ | |
providedIn: 'root' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ID } from '@datorama/akita'; | |
export interface List { | |
name: string; | |
id: ID; | |
date: number | Date; | |
total: number; | |
items: (ID | Item)[]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: "ym-component", | |
template: `<div *ngIf="hasForm"></div>`, | |
changeDetection: ChangeDetectionStrategy.OnPush | |
}) | |
export class MyComponent { | |
form: any; | |
get hasForm(): boolean { | |
return this.form != null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pissWifeOff(req, res) { | |
let message = 'My husband is the best'; | |
for (let i = 0; i < 1001; i++) { | |
twilio.sendSMS('BEST HUSBAND EVER', message, wifeNumber) | |
.then( | |
success => { | |
if (i === 1000) { | |
res.send('Congrats, you are a dead man') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
encodeSpaces(text) { | |
const find = ' '; | |
const regex = new RegExp(find, 'g'); | |
return text.replace(regex, '\u00A0'); | |
}, | |
sendSMS(from, message, destination) { | |
return new Promise((resolve, reject) => { | |
const targetNumber = destination.substring(1); | |
client.messages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
const request = require("request"); | |
const path = require("path"); | |
const PORT = process.env.PORT || 5000; | |
const Firebase = require("./lib/firebase.init"); | |
const expense = require("./lib/expense"); | |
const user = require('./lib/checkUser'); | |
const total = require('./lib/total'); |