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
from collections import defaultdict | |
T = {'1' : ' payday', '2' : 'mayday mayday', '3' : 'day may'} | |
index = defaultdict(set) | |
# create 5-shingles | |
for k, v in T.items(): | |
for i in range(len(v) - 4): | |
index[v[i:i+5]].add(k) |
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
val s = List(1, 2, 3) map (_*2) reduce (_+_) |
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
final int s = ImmutableList.of(1, 2, 3) | |
.stream() | |
.map(x -> x * 2) | |
.reduce(0, (x, y) -> x + y); |
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 * as express from 'express'; | |
const app = express(); | |
const port = 3000; | |
app.get('/', (req, res) => res.send('Hello World!')); | |
app.listen(port, () => console.log(`Server started listening to port ${port}`)); |
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
{ | |
"name": "simple-express", | |
"version": "0.0.1", | |
"description": "A simple Express.js app", | |
"main": "src/main.ts", | |
"dependencies": { | |
"express": "^4.17.1" | |
}, | |
"devDependencies": { | |
"typescript": "^3.6.4" |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"outDir": "../dist", | |
"baseUrl": "", | |
"module": "commonjs" | |
} | |
} |
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
{ | |
"swagger": { | |
"basePath": "/api/v1", | |
"entryFile": "./src/main.ts", | |
"specVersion": 3, | |
"outputDirectory": "./api/dist", | |
"controllerPathGlobs": [ | |
"./src/controllers/**/*controller.ts" | |
] | |
}, |
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 { Controller, Get, Route } from 'tsoa'; | |
@Route('') | |
export class IndexController extends Controller { | |
@Get('') | |
public async index() { | |
return { msg: 'Hello World!' }; | |
} | |
@Get('/msg') |
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
{ | |
"compilerOptions": { | |
"experimentalDecorators": true, // this line | |
"outDir": "../dist", | |
"baseUrl": "", | |
"module": "commonjs" | |
} | |
} |
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 * as express from 'express'; | |
import { RegisterRoutes } from './routes/routes'; // here | |
const app = express(); | |
const port = 3000; | |
RegisterRoutes(app); // and here | |
app.listen(port, () => console.log(`Server started listening to port ${port}`)); |
OlderNewer