Skip to content

Instantly share code, notes, and snippets.

View scq000's full-sized avatar

Chason scq000

  • Bytedance
  • Shenzhen
View GitHub Profile
@scq000
scq000 / pubsub.js
Last active August 29, 2015 14:27 — forked from learncodeacademy/pubsub.js
Basic Javascript PubSub Pattern
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
/* Merge sort in C */
#include<stdio.h>
#include<stdlib.h>
// Function to Merge Arrays L and R into A.
// lefCount = number of elements in L
// rightCount = number of elements in R.
void Merge(int *A,int *L,int leftCount,int *R,int rightCount) {
int i,j,k;
@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
标题 Title
描述 Description
使用方式 Get Start
[ optional ] 链接(npm,website,wiki,git repo)
[ optional ] 作者(联系方式)
[ optional ] 测试脚本
[ optional ] demo 页
[ optional ] 代码说明,设计模式,维护须知
[ optional ] 更新历史
[ optional ] Troubleshooting
@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
function Product(name, price) {
this.name = name;
this.price = price;
}
// Object.defineProperty(Product.prototype, "discount", {
// get() {
// return 1;
// },
// set(value) {
@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 bind(obj, prop, element, config) {
if(config) {
Object.defineProperty(obj, prop, {
get: config.get,
set: config.set,
enumerable: true,
configurable: true
});
}else {
::-webkit-scrollbar {
overflow: visible;
width: 6px;
height: 16px
}
::-webkit-scrollbar-button {
width: 0;
height: 0
}