Skip to content

Instantly share code, notes, and snippets.

View lancetw's full-sized avatar
🐈

Hsin-lin Cheng lancetw

🐈
View GitHub Profile
@lancetw
lancetw / hmmh.py
Last active December 19, 2018 15:27
Mackay memorial hospital Hsinchu branch ER board. (updated 20181219)
# !/usr/bin/env python
# coding:UTF-8
import requests, json, re
from datetime import datetime
requests.packages.urllib3.disable_warnings()
html = requests.get('https://wapps.mmh.org.tw/WebEMR/WebEMR/Default.aspx?a=HC', verify=False)
keys = ['pending_doctor', 'pending_bed', 'pending_ward', 'pending_icu']
@lancetw
lancetw / hcgh.py
Created December 3, 2016 08:16
Cathay general hospital Hsinchu branch ER board. (updated 20161203)
# !/usr/bin/env python
# coding:UTF-8
import requests, json, re
from datetime import datetime
html = requests.get('http://med.cgh.org.tw/unit/branch/Pharmacy/ebl/RealTimeInfoHC.html', verify=False)
keys = ['pending_doctor', 'pending_bed', 'pending_ward', 'pending_icu']
pending0 = re.findall(r"<td(.*?)>(.+?)</td>", html.text)
@lancetw
lancetw / hch.py
Last active December 4, 2016 13:41
NTU hospital hsin-chu branch ER board. (updated 20161203)
# !/usr/bin/env python
# coding:UTF-8
import requests, json, re
from datetime import datetime
html = requests.get('http://reg.ntuh.gov.tw/EmgInfoBoard/NTUHEmgInfoT4.aspx', verify=False)
keys = ['pending_doctor', 'pending_ward', 'pending_icu', 'pending_bed']
pending0 = re.findall(r"<td(.*?)>(.+?)</td>", html.text)
@lancetw
lancetw / excel.txt.vba
Last active October 2, 2016 07:04
勤務派遣科 出勤效率 Excel 公式
=(
(DATEVALUE(
TEXT(
DATE(
MID(TRIM(J5),1,3)+1911,
MID(TRIM(J5),5,2),
MID(TRIM(J5),9,2))
,"YYYY-MM-DD")
)
+
// borrow from react-redux-starter-kit
// https://github.com/davezuko/react-redux-starter-kit
export function createConstants (...constants) {
return constants.reduce((acc, constant) => {
return Object.assign({}, acc, { [constant]: constant })
}, {})
}
export function createReducer (initialState, reducerMap) {
#include <iostream>
/* C++ 14 */
int main(void) {
auto add = [](auto x, auto y) {return x + y;};
printf("%d", add(1,2));
}
export function login (form) {
return async dispatch => {
dispatch({ type: AUTH_USER_STARTED })
try {
const res = await auth(form)
if (res && res.token) {
setToken(res.token)
return dispatch({
type: AUTH_USER_COMPLETED,
token: res.token
export async function auth (form) {
return new Promise((resolve, reject) => {
request
.post('/api/v1/login')
.set('Accept', 'application/json')
.auth(form.email, form.password)
.end(function (err, res) {
if (!err && res.body) {
resolve(res.body)
} else {
import request from 'superagent'
import {
SIGNUP_USER_STARTED,
SIGNUP_USER_COMPLETED,
SIGNUP_USER_FAILED
} from 'shared/constants/ActionTypes'
import { auth } from 'shared/actions/AuthActions'
export function submit (form) {
return async dispatch => {
原文
ループが書けなくなる(或いは再帰依存症)レベル10
http://d.hatena.ne.jp/yuki_neko_nyan/20090217/1234850409
level 0
不會寫遞迴,也沒辦法用遞迴思考。只覺得用迴圈寫就好了。
level 1
開始學習遞迴,但只要一用遞迴思考就覺得煩。有時還會忘了寫終止條件。覺得實在太麻煩了還是想寫迴圈就好。