This file contains hidden or 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
| // SERVER CODE | |
| import io from "socket.io"; | |
| import { IGb, model as Gb } from "../models/gb"; // My mongoose schema | |
| const server = io.listen(8000); | |
| /** | |
| * Server auth using username and password of Gb | |
| */ |
This file contains hidden or 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
| class Book { | |
| function getTitle() { | |
| return "Book Name"; | |
| } | |
| function getAuthor() { | |
| return "Author Name"; | |
| } | |
This file contains hidden or 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
| interface BookStyle { | |
| function pageStyle(): string; | |
| } | |
| class Book implements Bookstyle { | |
| function getTitle() { | |
| return "A Great Book"; |
This file contains hidden or 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
| interface BookStyle { | |
| function pageStyle(): string; | |
| } | |
| class Book implements Bookstyle { | |
| function getTitle() { | |
| return "A Great Book"; |
This file contains hidden or 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
| class PasswordReminder { | |
| private dbConnection; | |
| constructor(MySQLConnection dbConnection) { | |
| this.dbConnection = dbConnection; | |
| } | |
| } |
This file contains hidden or 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
| class MySQLConnection implements DBConnectionInterface { | |
| public function connect() { | |
| return "Connection" | |
| } | |
| } | |
| class PasswordReminder { | |
| private dbConnection; | |
| constructor(DBConnectionInterface dbConnection) { | |
| this.dbConnection = dbConnection; |
This file contains hidden or 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, { useEffect } from 'react'; | |
| function Simple() { | |
| useEffect(() => { | |
| console.log("Use Effect!") | |
| }) | |
| return ( | |
| <div> |
This file contains hidden or 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, { useState } from 'react'; | |
| import Simple from './simple' | |
| function Wrapper() { | |
| const [count, setCount] = useState(0); | |
| const updateCount = () => setCount(count + 1); | |
| return ( | |
| <div> |
This file contains hidden or 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, { useState } from 'react'; | |
| import Simple from './simple' | |
| function Wrapper() { | |
| const [count, setCount] = useState(0); | |
| const updateCount = () => setCount(count + 1); | |
| return ( | |
| <div> |
This file contains hidden or 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, { useEffect } from 'react'; | |
| function Simple() { | |
| useEffect(() => { | |
| console.log("Use Effect!") | |
| return () => { | |
| console.log("Unmount") | |
| } | |
| }) |
OlderNewer