Skip to content

Instantly share code, notes, and snippets.

View kingsley-einstein's full-sized avatar
🏠
Working from home

Kingsley Victor kingsley-einstein

🏠
Working from home
View GitHub Profile
import { Injectable } from '@angular/core';
import { User } from '../../models';
import { PostService } from '../post';
@Injectable()
export class UserService {
public db: User[] = [];
constructor(private postService: PostService) {}
insert(user: User) : void {
import { Post } from '../../../models';
export interface PostState {
data: Post | null;
posts: Post[] | null;
}
export const initialPostState: PostState = {
data: null,
posts: null
import { User } from './User';
export interface Post {
id: number;
title: string;
content: string;
createdAt: Date;
author: User
}
import { User } from '../../../models';
export interface UserState {
data: User | null;
users: User[] | null;
}
export const initialUserState : UserState = {
data: null,
users: null
import { User } from '../../../models';
export interface UserState {
data: User | null;
users: User[] | null;
}
export const initialUserState : UserState = {
data: null,
users: null
@kingsley-einstein
kingsley-einstein / TicTacToe.java
Created April 5, 2018 16:22
A command line Tic-Tac-Toe game implemented with the minimax algorithm
import java.util.*;
//The move class. This will be instantiated with a row and column argument passed based on user input
class Move {
int r;
int c;
Move(int r, int c) {
this.r=r;
this.c=c;