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
'use latest'; | |
import { fromExpress } from 'webtask-tools'; | |
import express from 'express'; | |
import logger from 'morgan'; | |
import cors from 'cors'; | |
import bodyParser from 'body-parser'; | |
import request from 'request'; | |
import rp from 'request-promise'; |
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
<img src="http://bank.example.com/withdraw?account=bob&amount=1000000&for=mallory"> |
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
// Tách thành function riêng | |
// Trim and upper case | |
function chimUp(input) { | |
// Có bug chỉ cần sửa 1 chỗ | |
return input.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
} | |
// Có thể dễ dàng dùng mà không cần copy paste | |
let input = chimUp('abd4%$#@#') |
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
// Code bỏ kí tự đặc biệt và viết hoa | |
let input = 'abd4%$#@#'; | |
input = input.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
// Đoạn code khác ... | |
// Copy lần 1 | |
const username = 'ahihi-de-em-di' | |
const trimmedUsername = username.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
// ...Copy tiếp logic qua đoạn khác |
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
// Đọc DB_CONNECTION từ biến môi trường hoặc file Config | |
const DB_CONNECTION = Config.Get('DB_CONNECTION') || env['DB_CONNECTION'] | |
const DB_CONNECTION_POLL = 4 // Dùng 4 vì lý do blah blah | |
const DB_NAME = 'db_codedao_blog' // Tách thành biên để biết đây là tên DB | |
DB.connect(DB_CONNECTION, DB_NAME, DB_CONNECTION_POLL) |
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
// Hard code DB Connection | |
const DB_CONNECTION = 'localhost://4090;username=hoangdeptrai;password=codedao' | |
// Magic number: 4 là gì, tại sao dùng 4 mà không phải số khác | |
DB.connect(DB_CONNECTION, 'db_codedao_blog', 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
List<Course> courses = new List<Course>(); | |
courses.Add(new Course | |
{ | |
ID = 1, | |
Subject = "LINQ Tutorials", | |
Rank = 5 | |
}); | |
courses.Add(new Course | |
{ | |
ID = 2, |
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
finishGame({ commit, state }) { | |
commit('removeLosers'); | |
// Đếm những quân xí ngầu thắng | |
var diceDic = countBy(state.dices, dice => dice); | |
for (const key in diceDic) { | |
const multiplier = diceDic[key] + 1; | |
const winners = Object.values(state.board[key]); | |
// Cộng điềm cho những người thắng |
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 store = new Vuex.Store({ | |
state: { | |
players: {}, | |
status: WAITING_FOR_BET, | |
dices: [1, 2, 3], | |
board: { | |
1: {}, | |
2: {}, | |
3: {}, | |
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
<div> | |
<div class="bc-table"> | |
<!-- Ảnh bầu cua --> | |
<img src="./../assets/baucua.jpg" alt class="image bc-image" /> | |
<div class="bc-overlay"> | |
<!-- 6 cells tương ứng với 6 con --> | |
<div class="boards" :key="key" v-for="(cell, key) in board"> | |
<transition-group | |
tag="div" | |
enter-active-class="animated bounceInDown" |
NewerOlder