Skip to content

Instantly share code, notes, and snippets.

// 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,
) {}
// 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 {
// 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(
// 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'
}
// 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.
@greetclock
greetclock / app.js
Created December 15, 2020 14:03 — forked from ObjSal/app.js
Posting form data in 3 ways to a Node.js server without third-party libraries - application/json, application/x-www-form-urlencoded, and multipart/form-data
// Author: Salvador Guerrero
'use strict'
const fs = require('fs')
// Project modules
const { CreateServer } = require('./server')
const SecurityUtils = require('./security-utils')
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'''