Sam Xiao, Feb.18, 2019
約在 2015 年,主流的 Web 開發架構仍以後端 MVC 為主:
| import {Injectable} from '@angular/core'; | |
| import {DateAdapter} from '@angular/material'; | |
| import {addDays, addMonths, addYears, format, getDate, getDaysInMonth, getMonth, getYear, parse, setDay, setMonth, toDate} from 'date-fns'; | |
| // CONFIG. Use environment or something for a dynamic locale and settings | |
| import {es as locale} from 'date-fns/locale'; | |
| const WEEK_STARTS_ON = 1; // 0 sunday, 1 monday... | |
| export const MAT_DATE_FNS_DATE_FORMATS = { |
https://tc39.github.io/ecma262/
Also block scoped, like let.
| /** | |
| * Lightweight script to detect whether the browser is running in Private mode. | |
| * @returns {Promise<boolean>} | |
| * | |
| * Live demo: | |
| * @see https://output.jsbin.com/tazuwif | |
| * | |
| * This snippet uses Promises. If you want to run it in old browsers, polyfill it: | |
| * @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js | |
| * |
| declare module 'react-css-modules' { | |
| interface Options { | |
| allowMultiple?: boolean; | |
| errorWhenNotFound?: boolean; | |
| } | |
| module CSSModules { | |
| interface Props { | |
| styles?: any; | |
| styleName?: string; |
| #!/bin/bash | |
| # --------------------------------------------------------- | |
| # Customizable Settings | |
| # --------------------------------------------------------- | |
| MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/casesafe}" | |
| VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.casesafe.dmg.sparseimage}" | |
| VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-casesafe}" | |
| VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-60g}" |
| #! /usr/bin/env python3 | |
| import random | |
| def BinarySearchInsertPoint(searchArray, searchKey): | |
| if len(searchArray) == 0: | |
| return 0 | |
| middleIndex = int(len(searchArray) / 2 - 0.5) | |
| print( | |
| "Target Array", | |
| searchArray, |
| import time | |
| n = range(50000) | |
| def test_tuple(): | |
| data = () | |
| for i in n: | |
| data += (1, 2) + (3, 4) |
| import time | |
| j = range(100000) | |
| def test_plus(): | |
| out = '' | |
| for i in j: | |
| out += 'a' | |
| return out |