Skip to content

Instantly share code, notes, and snippets.

View loic-combis's full-sized avatar

Loïc Combis loic-combis

View GitHub Profile
const myString = 'My Non Empty String';
const myObject = {
prop: 'A prop',
prop2: 0
}
if (!undefined && myString && myObject.prop && !myObject.prop2) {
console.log('This expression is truthy!!');
}
const nonBooleanVariable = 'A String';
if (nonBooleanVariable) {
console.log('A non-empty string is truthy.');
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { FormsModule } from '@angular/forms';
import { TodoService } from './todo.service';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [AppComponent],
* {
box-sizing: border-box;
padding: 0;
margin: 0;
outline: none;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
.todo {
&__header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 160px;
display: flex;
align-items: center;
padding-left: 16px;
<div class="todo">
<header class="todo__header">
<h1>Fantastic TODO</h1>
</header>
<div class="todo__content">
<ul class="todo__list">
<li
*ngFor="let todo of todos"
class="todo__item">
<div>
import { Component, OnInit } from '@angular/core';
import { Todo } from './todo.interface';
import { TodoService } from './todo.service';
@Component({
selector: 'groundwork-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
export interface Todo {
id?: string;
title: string;
description: string;
}
import { Injectable } from "@angular/core";
import { HttpClient } from '@angular/common/http';
import { Observable } from "rxjs";
import { Todo } from "./todo.interface";
@Injectable({ providedIn: 'root' })
export class TodoService {
private readonly baseUrl: string = 'http://localhost:3333/api';
constructor(private http: HttpClient) {}
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
import { DBHelper } from './app/helper/db.helper';
import { TodoService } from './app/todo/todo.service';
const app = express();
app.use(cors())