Skip to content

Instantly share code, notes, and snippets.

View tridungle's full-sized avatar

Trí Dũng Lê tridungle

  • Independent
  • Ho Chi Minh
View GitHub Profile
import React, { Component, Fragment } from 'react';
import { Link } from 'react-router-dom';
import { Prompt } from 'react-router';
import { Form, Icon } from 'antd';
import { I18n } from 'react-i18next';
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import {
GetMedications,
CompleteReport,
ChangeReportStatus,
@tridungle
tridungle / usePushNotification.js
Created October 2, 2019 01:12 — forked from Spyna/usePushNotification.js
React custom Hook to handle push notification
import { useState, useEffect } from "react";
import http from "./utils/http";
//the function to call the push server: https://github.com/Spyna/push-notification-demo/blob/master/front-end-react/src/utils/http.js
import {
isPushNotificationSupported,
askUserPermission,
registerServiceWorker,
createNotificationSubscription,
getUserSubscription
@tridungle
tridungle / GMO Payment Gateway Magento 2
Created December 10, 2019 03:28 — forked from mrkhoa99/GMO Payment Gateway Magento 2
The API does not return error messages, so I translated these from the example english-like messages in the GMO documentation
#Resource reference: https://docs.omniref.com/github/veracross/active_merchant/HEAD/symbols/ActiveMerchant::Billing::GmoGateway#line=46
# The API does not return error messages, so I translated these from the
# example english-like messages in the GMO documentation
ERROR_CODES = {
'E01010001' => 'Shop ID not specified',
'E01010008' => 'Shop ID contains invalid characters or is too long',
'E01010010' => 'Shop ID is invalid',
'E01020001' => 'Shop Password not specified',
'E01020008' => 'Shop Password contains invalid characters or is too long',
'E01030002' => 'Shop ID and Password are invalid',
@tridungle
tridungle / gmo_setting.md
Created December 10, 2019 03:55 — forked from kkeeth/gmo_setting.md
GMOPGの設定

案外知られていないGMOの設定方法をメモ。

1.アカウント取得

まずは下記のURLから、アカウントを作成。 https://service.gmo-pg.com/cyllene/entry/trialStart.htm

2.登録完了メールの確認

アカウント登録が完了すると、下記のようなメールが飛んでくる。

export function randomString(size) {
if (size === 0) {
throw new Error('Zero-length randomString is useless.');
}
let chars = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz' +
'0123456789');
let objectId = '';
let bytes = randomBytes(size);
for (let i = 0; i < bytes.length; ++i) {
export const errorCodes = {
'E00000000': 'This is for communication confirmation, so no action is required. ',
'E00000001': 'An error corresponding to HTTP status code 405. HTTP method is not POST. ',
'E00000002': 'An error corresponding to HTTP status code 406. Accept related items of HTTP request header are not correct. ',
'E00000003': 'An error corresponding to HTTP status code 415. The Content-type item in the HTTP request header is incorrect. ',
'E00000010': 'HTTP content is empty or malformed. ',
'E01010001': 'Shop ID is not specified. ',
'E01010008': 'The shop ID contains non-alphanumeric characters or exceeds 13 characters. ',
'E01010010': 'Shop ID does not match. ',
@tridungle
tridungle / rename_js_files.sh
Created December 16, 2019 07:46 — forked from afternoon/rename_js_files.sh
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@tridungle
tridungle / RouterApp.js
Created January 7, 2020 09:07 — forked from VesperDev/RouterApp.js
Sider menu + ant-design + react-router-dom
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Layout, Menu, Icon } from 'antd';
import Dashboard from './containers/Dashboard/Dashboard';
import Meseros from './containers/Meseros/Meseros';
const { Header, Content, Footer, Sider } = Layout;
const SubMenu = Menu.SubMenu;