Skip to content

Instantly share code, notes, and snippets.

@dtanphat9388
dtanphat9388 / .mongodb
Last active April 21, 2022 07:59
mongodb excecises
use('test');
const aggregation = [
// 32. Write a MongoDB query to find the restaurant name, borough, longitude and latitude and cuisine for those restaurants which contain 'Mad' as first three letters of its name. Go to the editor
// 31. Write a MongoDB query to find the restaurant name, borough, longitude and attitude and cuisine for those restaurants which contains 'mon' as three letters somewhere in its name. Go to the editor
// 30. Write a MongoDB query which will select the restaurant Id, name and grades for those restaurants which returns 0 as a remainder after dividing the score by 7. Go to the editor
@dtanphat9388
dtanphat9388 / process.js
Created December 11, 2018 09:39
draw circle process indicator by canvas
let canvas = document.querySelector('#canvas'); // id of canvas element
let ctx = canvas.getContext('2d')
ctx.lineWidth = 10;
ctx.lineCap = "round"
let process = 0
let middle = canvas.width * 0.5;
function draw(process) {
console.log(process)

diagram

  1. tạo payment request
    let paymentReq = new PaymentRequest([paymentMethod], details, options)
    • paymentMethod: app defined
    • details: popup for user select
    • options: app defined
/*
USE LIBRARY
*/
// b1: use library LiquidCrystal
#import <LiquidCrystal.h>
// b2: khởi tạo biến chứa thông tin các pin
// chọn 1 trong các khởi tạo sau:
@dtanphat9388
dtanphat9388 / Electron-Request.js
Last active April 27, 2018 05:43
Request data in Electron
import {app, BrowserWindow, net} from 'electron';
function _setup() {
// ...
/** get data for app */
let _strResult = '';
let jsonResult;
let req = net.request({url: 'https://jsonplaceholder.typicode.com/users'})
.on('response', res => {
@dtanphat9388
dtanphat9388 / commands.txt
Last active April 22, 2018 02:58
generate ssl keys
openssl req -sha256 -nodes -newkey rsa:2048 -nodes -keyout myserver.key -out server.csr -subj "/C=GB/ST=Yorks/L=York/O=MyCompany Ltd./OU=IT/CN=mysubdomain.mydomain.com"
@dtanphat9388
dtanphat9388 / cloudSettings
Last active May 1, 2021 20:02
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-05-01T20:02:30.246Z","extensionVersion":"v3.4.3"}