Skip to content

Instantly share code, notes, and snippets.

@giscafer
giscafer / identityCodeValid.js
Last active February 21, 2020 14:30
身份证合法校验
var identityCodeValid = function (code) {
var city = {
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
# Other ts_library rules will use this custom compiler, which calls the
# TypeScript APIs to act like tsc, but adds capabilities like Bazel workers.
nodejs_binary(
name = "tsc_wrapped_bin",
data = [
":tsc_wrapped",
"@//:node_modules",
"@bytebuffer//:pkg",
"@protobufjs//:pkg",
"@long//:pkg",
@agentsim
agentsim / highsierra_bootable.sh
Created June 10, 2017 02:23
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
@thehig
thehig / aggregateDebounce.js
Last active December 7, 2020 07:37
js: Aggregate Debounce
/*
Client wishes to emit a number of actions
Actions are identical RSAAs, with varying meta properties (usually the ID to request)
Ideal scenario
* Numerous actions are taken in within a timeout/debounce window
* After the timeout has expired, the actions are aggregated into a single API call
dispatch({
type: "SOME_FETCH_REQUEST",
@julianxhokaxhiu
julianxhokaxhiu / create-iso.sh
Created September 24, 2016 21:46
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@tonyc726
tonyc726 / verify_id_card.js
Created February 16, 2016 02:36
客户端身份证验证
// 验证身份证号码
function verify_id_card(value) {
// 转换字母为大写,增加大小写X的容错能力
var id_card = value.toUpperCase();
//检查号码是否符合规范,包括长度,类型
var isCardNo = function(obj) {
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/;
if (reg.test(obj) === false) {
@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing