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
const express = require("express"); | |
const app = express(); | |
const mongoose = require("mongoose"); | |
const bodyParser = require("body-parser"); | |
const session = require("express-session"); | |
const flash = require("connect-flash"); | |
const moment = require("moment"); | |
const seedDB = require("./seed"); | |
const removeUsers = require("./remove"); |
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
const mongoose = require('mongoose') | |
const {model,Schema} = require('mongoose') | |
mongoose.connect('mongodb://localhost:27017/myapp',{useNewUrlParser:true}); | |
const app = require('express')() | |
const DepartmentSchema = new Schema({ | |
name: String, | |
location: String | |
} | |
) |
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
const forLoop = async _ => { | |
console.log('start'); | |
for (let index = 0; index < fruitsToGet.length; index ++) { | |
const fruit = fruitsToGet[index]; | |
const numFruit = await getNumFruit(fruit); | |
console.log(numFruit); | |
} | |
console.log('End') | |
} |
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
exports.addNewClass = async (req, reply) => { | |
try { | |
let classname = new class_name(req.body) | |
const className = req.body | |
console.log(className.class_name) | |
const duplicateData = await class_name.findOne({"class_name":className.class_name}) | |
console.log("duplicateData:"+duplicateData) | |
if(!duplicateData){ | |
let newclass = await classname.save() | |
return newclass |
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
package mycat; | |
public class Cat { | |
private String name; | |
private String weight; | |
// Getter | |
public String getName() { | |
return name; | |
} |
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 sys | |
import os | |
import time | |
import platform | |
try: | |
name = sys.argv[1] | |
except: | |
print('Type python3 dancing_bob.py [Name]') | |
exit(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
# V Read every line in application.config | |
# V split each line using equal operator | |
# --- | |
# write to excel: | |
# Put key value to excel specified field | |
# & default value already wriien in excel | |
# --- | |
# [Note] | |
# Check it ... |
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
// npm install react-csv --save; | |
// npm install papaparse | |
import React, { useState } from "react"; | |
import { CSVLink } from "react-csv"; | |
import Papa from "papaparse"; | |
const App = () => { | |
const [tableRows, setTableRows] = useState([]); |
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
class TrieNode: | |
def __init__(self): | |
self.childen = {} | |
self.isEnd = False | |
self.refs = 0 | |
def addWord(self,word): | |
cur = self | |
# cur.ref += 1 | |
for w in word: |
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
REF: https://kentcdodds.com/blog/stop-being-a-junior |