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 mwm = require('pico-mw-mgr') | |
| mwm( | |
| 'forAdmin', | |
| [user.updateForAdmin, 'user', 'input'], | |
| [merchant.updateForAdmin, 'user', 'input', 'output'], | |
| [output, 'ctx', 'output', null] | |
| ) | |
| mwm( |
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
| <textarea id=html><p>Hello</p></textarea> | |
| <textarea id=css>p{color:red}</textarea> | |
| <textarea id=js>document.addEventListener('click', console.log)</textarea> | |
| <iframe src="./preview.html" sandbox="allow-forms allow-modals allow-pointer-lock allow-popups allow-same-origin allow-scripts" allowfullscreen="true" allowtransparency="true" allowpaymentrequest="true"></iframe> | |
| <button id=refresh>refresh</button> | |
| <script src=./main.js></script> |
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
| /* | |
| * construct an url path from a template and a dictionary | |
| * example 1: | |
| * Input: "https://api.com/users/:groupId/:userId" and {"userId": 12, "groupId: 1} | |
| * Output: "https://api.com/users/1/12" | |
| * | |
| * example 2: | |
| * Input: "https://api.com/parcel/:merchantId/:productId" and {"merchantId": "BLU-123", "productId": "LG-NOTE-637"} | |
| * Output: "https://api.com/parcel/BLU-123/LG-NOTE-637" | |
| */ |
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
| /** | |
| #Objective: | |
| write a function to calculate the expiry datetime. The expiry datetime is 3 WORKING hours from the "now" input parameter. | |
| the working hours is defined in the "schedule" input parameter. | |
| You should write the function in any programming language. | |
| @param {Date} now - current datetime. e.g: '2019-10-11T08:13:07+0800' | |
| @param {Array} schedule - an array of objects. which specified the day open or close and also the start and end of working hours | |
| [ | |
| {"open": false, "open_at": "", close_at: ""}, // sunday |
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 model = require('./model'); | |
| const {InvErrors} = require('./errors'); | |
| const constants = require('./const'); | |
| /* table schemas | |
| properties { | |
| id: bigint, | |
| metadata: json | |
| } |
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 Koa = require('koa'); | |
| const app = module.exports = new Koa(); | |
| // look ma, error propagation! | |
| app.use(async function(ctx, next) { | |
| try { | |
| await next(); | |
| } catch (err) { | |
| // some errors will have .status |
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 crypto = require('crypto') | |
| const util = require('picos-util') | |
| const {app_key, app_secret, access_token} = require('./app.json') | |
| const endpoints = { | |
| vn: 'https://api.lazada.vn/rest', | |
| sg: 'https://api.lazada.sg/rest', | |
| th: 'https://api.lazada.co.th/rest', | |
| id: 'https://api.lazada.co.id/rest', | |
| ph: 'https://api.lazada.com.ph/rest', | |
| my: 'https://api.lazada.com.my/rest', |
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
| <script src="dist/amazon-cognito-identity.min.js"></script> | |
| <script src="dist/aws-sdk.min.js"></script> | |
| <script> | |
| var authenticationData = { | |
| Username : 'test', | |
| Password : 'password', | |
| }; | |
| var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData); | |
| var poolData = { | |
| UserPoolId : 'ap-southeast-1_xxxxxxx', |
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
| <!DOCTYPE html> | |
| <html lang=en> | |
| <head> | |
| <meta charset=utf-8> | |
| <meta name=description content="POJS Unit Test"> | |
| <meta name=viewport content=width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1> | |
| <meta name=app-version content=0.0.1> | |
| <meta name=app-support-native content=1> | |
| <link rel="shortcut icon" href=data:;base64,iVBORw0KGgo=> | |
| <title>POJS: Demo</title> |
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 Rand = Math.random | |
| const Ceil = Math.ceil | |
| const knex = require('knex-pg-rr')({ | |
| client: 'pg', | |
| connection:{ | |
| host: 'PG_BOUNCER_HOST', | |
| port: xxxx, | |
| user:"USER_NAME", | |
| password:"PASSWORD", | |
| database: "DB_NAME" |
NewerOlder