Skip to content

Instantly share code, notes, and snippets.

View scq000's full-sized avatar

Chason scq000

  • Bytedance
  • Shenzhen
View GitHub Profile
@scq000
scq000 / module-header.js
Created March 10, 2017 03:31
模块化
/* global module, define,*/
;(function (root, factory) {
'use strict'
if (typeof module === 'object' && typeof module.exports === 'object') {
/**
* @type {{then:function}}
*/
module.exports = factory()
} else if (typeof define === 'function' && define.amd) {
@scq000
scq000 / commafy-num.js
Last active May 18, 2017 06:20
数字千分位分隔加逗号
String.prototype.commafy = function () {
return this.replace(
/^(-?\d+)(\d{3}(\.\d+)?)$/,
function (_, a, b) {
return a.commafy() + ',' + b;
}
);
};
function toThousands(num) {
::-webkit-scrollbar {
overflow: visible;
width: 6px;
height: 16px
}
::-webkit-scrollbar-button {
width: 0;
height: 0
}
// 将元素属性和数据进行绑定
function bind(obj, prop, element, config) {
if(config) {
Object.defineProperty(obj, prop, {
get: config.get,
set: config.set,
enumerable: true,
configurable: true
});
}else {
@scq000
scq000 / ChinaUniom1.conf
Last active January 8, 2017 05:23
surge.conf
#!MANAGED-CONFIG http://surge.w3cboy.com/ChinaUnicom.conf interval=86400
#UPDATE: 2017-01-03 14:42:37
[General]
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
[Rule]
# Adblock
DOMAIN-KEYWORD,analytics,REJECT
function Product(name, price) {
this.name = name;
this.price = price;
}
// Object.defineProperty(Product.prototype, "discount", {
// get() {
// return 1;
// },
// set(value) {
@scq000
scq000 / railgun.py
Created October 11, 2016 09:03
add encodingUtils to railgun
# coding: UTF-8
# User: haku
# Date: 14-5-22
# Time: 4:01
# Modifier: scq000
__author__ = 'haku-mac'
from pattern import Pattern
标题 Title
描述 Description
使用方式 Get Start
[ optional ] 链接(npm,website,wiki,git repo)
[ optional ] 作者(联系方式)
[ optional ] 测试脚本
[ optional ] demo 页
[ optional ] 代码说明,设计模式,维护须知
[ optional ] 更新历史
[ optional ] Troubleshooting
@scq000
scq000 / TripleDESTest.java
Created April 16, 2016 05:08 — forked from newhavengill/TripleDESTest.java
Simple TripleDES Encrypt/Decrypt Test
import java.security.MessageDigest;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
/**
* Simple TripleDES Encrypt/Decrypt Test