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
const _ = require('lodash') | |
const crc = require('crc') | |
// RFU: Reserved for Future Use | |
// https://vietqr.net/portal-service/resources/icons/ABB.png | |
const range = (first, last) => _.range(first, last, 1).map(v => _.padStart(v, 2, '0')) | |
const bankLists = [ | |
{ | |
"id": 1, | |
"name": "Ngân hàng TMCP An Bình", |
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
function captureVideo(video) { | |
var canvas = document.createElement("canvas"); | |
canvas.width = video.videoWidth; | |
canvas.height = video.videoHeight; | |
var canvasContext = canvas.getContext("2d"); | |
canvasContext.drawImage(video, 0, 0); | |
const image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); | |
window.location.href=image; | |
} |
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
terminal: alias idea='open -a "`ls -dt /Applications/IntelliJ\ IDEA*|head -1`"' | |
use: idea . |
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
public void updateAudioDeviceState() { | |
ThreadUtils.checkIsOnMainThread(); | |
// Log.d(TAG, "--- updateAudioDeviceState: " | |
// + "wired headset=" + hasWiredHeadset + ", " | |
// + "BT state=" + bluetoothManager.getState()); | |
Log.d(TAG, "Device status: " | |
+ "available=" + audioDevices + ", " | |
+ "selected=" + selectedAudioDevice + ", " | |
+ "user selected=" + userSelectedAudioDevice); |
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
function lazy(className, threshold) { | |
var imgs = [], | |
offset = screen.height + threshold, | |
targetEvent = 'wheel', | |
body = document.getElementsByTagName("body")[0]; | |
var shownShow = function(img) { | |
var imgTop = img.getClientRects()[0].top, | |
viewportTop = -body.getClientRects()[0].top, | |
minDistance = viewportTop + offset, |
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
const removeAccents = (function () { | |
const dictionary = { | |
a: 'àáảãạăằắẳẵặâầấẩẫậ', e: 'èéẻẽẹêềếểễệ', i: 'ìíỉĩị', o: 'òóỏõọôồốổỗộơờớởỡợ', u: 'ùúủũụưừứửữự', d: 'đ', | |
A: 'ÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬ', E: 'ÈÉẺẼẸÊỀẾỂỄỆ', I: 'ÌÍỈĨỊ', O: 'ÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢ', U: 'UÙÚỦŨỤƯỪỨỬỮỰ', D: 'Đ' | |
} | |
const convertMap = {} | |
for (const key of Object.keys(dictionary)) { | |
for (const char of dictionary[key]) { | |
convertMap[char] = key | |
} |