Skip to content

Instantly share code, notes, and snippets.

Carl X. Su bcbcarl

  • Taipei City, Taiwan
Block or report user

Report or block bcbcarl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vue.md

Functional Vue Architecture

Sam Xiao, Feb.18, 2019

Web 所面臨的挑戰

後端 MVC

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

@JoniJnm
JoniJnm / date-fns-date-adapter.ts
Created Jan 4, 2019
date-fns angular material adapter
View date-fns-date-adapter.ts
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 Feb 15, 2020
Simple Angular mask directive
View mask.md

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

View secret-es.mdown
@jherax
jherax / is-private-mode.js
Last active Feb 22, 2020
Detect if the browser is running in Private mode (Promise based)
View is-private-mode.js
/**
* 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 Jul 25, 2016
React CSSModules typings
View SomeComponent.tsx
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 Jan 31, 2020 — forked from Hais/workspace.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
View casesafe.sh
#!/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 Jan 28, 2015
Insertion Sort With Binary Search
View Insertion_Sort_With_Binary_Search.py
#! /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,
View bench_list_tuple.py
import time
n = range(50000)
def test_tuple():
data = ()
for i in n:
data += (1, 2) + (3, 4)
View bench_string.py
import time
j = range(100000)
def test_plus():
out = ''
for i in j:
out += 'a'
return out
You can’t perform that action at this time.