Skip to content

Instantly share code, notes, and snippets.

View bcbcarl's full-sized avatar

Carl X. Su bcbcarl

  • Taipei City, Taiwan
View GitHub Profile

Functional Vue Architecture

Sam Xiao, Feb.18, 2019

Web 所面臨的挑戰

後端 MVC

約在 2015 年,主流的 Web 開發架構仍以後端 MVC 為主:

@JoniJnm
JoniJnm / date-fns-date-adapter.ts
Created January 4, 2019 11:44
date-fns angular material adapter
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 = {
@gund
gund / mask.md
Last active March 20, 2024 09:21
Simple Angular mask directive

Simple Angular mask directive

This directive does not create it's own value accessor - it simply reuses whatever element is using already and just hooks in.

Also it is fully abstracted off of the HTML implementation and so can be safely used in WebWorker and server side environment.

Usage

@jherax
jherax / is-private-mode.js
Last active March 19, 2024 18:29
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* 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
*
@bezawislak
bezawislak / SomeComponent.tsx
Last active July 25, 2016 22:25
React CSSModules typings
declare module 'react-css-modules' {
interface Options {
allowMultiple?: boolean;
errorWhenNotFound?: boolean;
}
module CSSModules {
interface Props {
styles?: any;
styleName?: string;
@scottsb
scottsb / casesafe.sh
Last active January 16, 2024 08:47 — forked from Hais/workspace.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
#!/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}"
@RJHsiao
RJHsiao / Insertion_Sort_With_Binary_Search.py
Created January 28, 2015 08:04
Insertion Sort With Binary Search
#! /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