Skip to content

Instantly share code, notes, and snippets.

View akari0624's full-sized avatar

Morris-Chen akari0624

View GitHub Profile
/*!
* Socket.IO v4.5.3
* (c) 2014-2022 Guillermo Rauch
* Released under the MIT License.
*/
(function(global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.acyOfficialWebsiteUseIO = factory());
})(this, (function() {
@akari0624
akari0624 / index.html
Last active December 3, 2019 15:34
array.prototype.flatMap Set good usage scenario example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@akari0624
akari0624 / .eslintrc.json
Last active July 12, 2019 14:52
eslint for typescript
{
"env": {
"browser": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
let pFetch = fetch
if(!fetch){
pFetch = require('node-fetch')
}
const url = 'http://numbersapi.com'
//const url = 'https://api.tvmaze.com/search/shows?q=batman'
var paintLifeCircleOnMap = function(geojsonFilePath, errorCB) {
if (!EmbedMap) {
errorCB("地圖程式未正確載入!");
return;
}
if (geojsonFilePath) {
try {
EmbedMap.clearDrawing();
EmbedMap.addVector({
@akari0624
akari0624 / context.xml
Last active September 14, 2018 18:20
hikariCP JNDI datasource xml configuration
<?xml version="1.0" encoding="UTF-8"?>
<!-- (webapp)/META-INF/context.xml -->
<!-- use hikari connectionPool to init multiple dataSource -->
<!-- dependencies: HikariCP-3.1.0.jar, mssql-jdbc-6.4.0.jre8.jar, ojdbc6.jar they both implements JDBC 4.0-->
<Context>
<Resource
name="jdbc/hikariOracle"
auth="Container"
@akari0624
akari0624 / log4j.properties
Last active July 31, 2018 09:11
log4j.properties example
PatternLayoutConvension = %d{MM-dd HH:mm:ss} %-5p [%C{1}]: %m %n
PathToYourLogFile = ..../..../....../
# Root logger option
log4j.rootLogger= INFO, console, file
# seperated PatternLayout ConvensionPattern
log4j.logger.heaveyDebugger = INFO, heaveyDebugger
@akari0624
akari0624 / OrderService.js
Last active April 30, 2018 10:49
Node.js api end point, when do mongoDB query, promise or async/await example
/*
a node.js api end point , query 2 times via mongoose, first query by orderId that get OrderInfo, which incllude a vendorId,
then use vendorId to query VendorInfo, finally send OrderInfo and VendorInfo to client
*/
const Order = require('./Order');
const VendorModel = require('../Vendor');
@akari0624
akari0624 / FileTransportServlet.java
Created March 7, 2018 10:43
under a Servlet Context, send a request to another AP server , get the Binary response and add some text in the response header then send the response stream back to the original client ,
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException {
OutputStream os = null;
try {
URL url = new URL(urlStr);
URLConnection urlConnection = url.opervlet.nConnection();
@akari0624
akari0624 / dealByteArrayInputStream.java
Created March 7, 2018 10:26
get byteArrayAsStream from netWork , set into BufferedInputStream and fiil the buffer then out.flush again
// SWT裡不知道哪裡來 invoke了這裡,但這就像填空題, 你只要確保這個method out.flush出去的是正確的 byte array 後面的步驟就應該也是對的
public boolean createpdf(String filename) {
PostMethod post = null;
boolean result;
OutputStream os = null;
try {
/*