Skip to content

Instantly share code, notes, and snippets.

View fillano's full-sized avatar

Hsu Ping Feng fillano

View GitHub Profile
test10();
// 一般階乘
function test1() {
console.log(fact(5));
function fact(n) {
return n < 2 ? 1 : n * fact(n-1);
}
}
@fillano
fillano / index.js
Created August 13, 2020 01:31
convert xml to simple json
const xmlrun = require('xmlrun');
const fs = require('fs');
const args = require('minimist')(process.argv.slice(2));
main(args);
function main(args) {
if(args._.length > 0) {
fs.readFile(args._[0], 'utf8', (err, data) => {
if(!!err) return console.log(err);
@fillano
fillano / index.html
Created August 7, 2020 09:16
zip file parser in js (with inflate provided by pako)
<!DOCTYPE html>
<html>
<head>
<title>file reader</title>
<style>
.dropable {
width: 100%;
height: 100px;
background-color: #369;
@fillano
fillano / xmlrun.js
Last active August 6, 2020 08:53
poc to build an object tree then run.
const args = require('minimist')(process.argv.slice(2));
const DOMParser = require('xmldom').DOMParser;
const fs = require('fs');
main(args);
function main(args) {
if(args._.length > 0) {
read(args._[0])
.then(body => {
1. 什麼是Serverless
2. 簡介AWS Lambda服務
3. 用API Gateway架構API服務
4. 資料儲存的考量
5. 靜態頁面的考量
6. 使用S3
7. 開始架構
8. IAM
9. 存放在Lambda的node.js環境
10. 撰寫程式的要點
@fillano
fillano / test001.php
Last active September 11, 2018 09:28
a simple event facilities test.
<?php
class Event {
private static $events = [];
public static function Regist($eventName, Callable $callback) {
if(!is_callable($callback)) return false;
if(!array_key_exists($eventName, self::$events)) {
self::$events[$eventName] = [];
}
self::$events[$eventName][] = $callback;
return true;
@fillano
fillano / mod1.js
Created June 8, 2017 09:35
create class with readonly attribute.
const t = Symbol('ttt');
module.exports = class {
constructor(name) {
this[t] = name;
}
get name() {
return this[t];
}
sayHello() {
@fillano
fillano / pptx_data_structure.md
Last active January 4, 2017 06:26
simple pptx data structure reference

Required Classes for PowerPoint

Under DocumentFormat.OpenXml.Packaging(Assembly: DocumentFormat.OpenXml, DocumentFormat.OpenXml.dll)

PresentationDocument

  • Properties
    1. DocumentType
  1. PresentationPart