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 java.util.List; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.stream.Collectors; | |
import java.util.Arrays; | |
public class MyClass { | |
public static void main(String args[]) { | |
List<String> values = List.of("1", "2", "3", "4", "5", "5", "2"); | |
Map<String, List<String>> map = values.stream() |
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 pg from "pg"; | |
import { item, user } from "./models"; | |
import { CONFIG } from "./pgenv"; | |
const to_item = (itemRow: pg.QueryResult<any>): item => { | |
return { | |
id: parseInt(itemRow["id"]), | |
task: itemRow["task"], | |
priority: parseInt(itemRow["priority"]), |
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 { readFileSync, writeFileSync } from "fs"; | |
import { item, user } from "./models"; | |
const ITEMS_SOURCE = "data/items.json"; | |
const USERS_SOURCE = "data/users.json"; | |
const load_items = (): Array<item> => { | |
const data = readFileSync(ITEMS_SOURCE, "utf-8"); | |
if (!data) { | |
return []; |
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 express from "express"; | |
import { router as item_router } from "./items"; | |
const app = express(); | |
const port = 3000; | |
app.use("/tdsvc/item", item_router); | |
app.listen(port, (err?) => { | |
if (err) { |
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 express from "express"; | |
const app = express(); | |
const port = 3000; | |
app.get("/", (req, res) => { | |
res.send("You are listening from express server"); | |
}); | |
app.listen(port, (err) => { | |
if (err) { |
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 React from "react"; | |
import AddItem from "./AddItem"; | |
import ToDoList, { Item } from "./ToDoList"; | |
const initialList = [ | |
{ | |
task: "Pick up Milk", | |
priority: 1, | |
}, | |
{ |
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 React from "react"; | |
import ToDoList, { Item } from "./ToDoList"; | |
const initialList = [ | |
{ | |
task: "Pick up Milk", | |
priority: 1, | |
}, | |
{ | |
task: "Buy Eggs", |
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 React from "react"; | |
import { Item } from "./ToDoList"; | |
const isValid = (item: Item): boolean => { | |
return item.task !== "" && item.priority !== -1; | |
}; | |
class AddItem extends React.Component<{ addItem: any }, Item> { | |
constructor(props: any) { | |
super(props); |
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 React from "react"; | |
export interface Item { | |
task: string; | |
priority: number; | |
} | |
const getTableStyleProps = (): {} => { | |
return { |
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
export interface Item { | |
task: string; | |
priority: number; | |
} |
NewerOlder