This file contains 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
// https://github.com/greetclock/parts/blob/d97018/libs/todos-data/src/lib/todos-data.service.ts | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class TodosDataService { | |
constructor( | |
private todosAdapter: TodosAdapterService, | |
private todosRepo: TodosRepository, | |
) {} |
This file contains 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
// https://github.com/greetclock/parts/blob/3eec90/libs/todos-data/src/lib/todos-adapter.service.ts | |
import { Observable } from 'rxjs' | |
import { Todo } from './types' | |
export type CreateTodoDto = Omit<Todo, 'uuid' | 'status'> | |
export class TodoNotFoundError extends Error {} | |
export abstract class TodosAdapterService { |
This file contains 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
// https://github.com/greetclock/parts/blob/3eec90/libs/todos-data/src/lib/todos-facade.service.ts | |
// that's a simplified gist of the original facade. Follow the link to see the whole thing. | |
import { todos$ } from './todos.repository' | |
import { TodosDataService } from './todos-data.service' | |
export class TodosFacadeService { | |
todos$: Observable<Todo[]> = todos$ | |
constructor( |
This file contains 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
// https://github.com/greetclock/parts/blob/3eec90/libs/todos-data/src/lib/types.ts | |
export interface Todo { | |
uuid: string | |
title: string | |
description?: string | |
status: 'pending' | 'done' | |
} |
This file contains 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
// Full example | |
// https://github.com/greetclock/parts/blob/3eec90/package.json#L81-L89 | |
{ | |
"lint-staged": { | |
// JS and TS files go through ESLint first and then through prettier | |
"**/*.{js,ts}": [ | |
"eslint --fix", | |
"prettier --write --ignore-unknown" | |
], | |
// other files in the project are unknown to ESLint, so we use prettier only. |
This file contains 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
// Author: Salvador Guerrero | |
'use strict' | |
const fs = require('fs') | |
// Project modules | |
const { CreateServer } = require('./server') | |
const SecurityUtils = require('./security-utils') |
This file contains 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 cookielib | |
import md5 | |
import re | |
import sys | |
import urllib | |
import urllib2 | |
def login(username, password, cookie_file): | |
'''login to otaku-streamers.com and save session cookies''' |