Skip to content

Instantly share code, notes, and snippets.

View scq000's full-sized avatar

Chason scq000

  • Bytedance
  • Shenzhen
View GitHub Profile
@scq000
scq000 / BigDecimal.js
Created October 27, 2017 03:31 — forked from xinlc/BigDecimal.js
JavaScript高精度计算
//除法函数,用来得到精确的除法结果
//说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
//调用:accDiv(arg1,arg2)
//返回值:arg1除以arg2的精确结果
function accDiv(arg1, arg2) {
var t1 = 0,
t2 = 0,
r1, r2;
try {
t1 = arg1.toString().split(".")[1].length
@scq000
scq000 / heroku
Last active May 18, 2017 07:58 — forked from dprabu17/heroku
Heroku 使用 部署 node应用
Heroku
install
https://toolbelt.heroku.com/
heroku login
#cd project folder
heroku create
@scq000
scq000 / webpack.config.js
Created May 18, 2017 07:01 — forked from yukhnevych/webpack.config.js
Webpack 2 config file: Hot reloading, split css, generate HTML, split vendor files.
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
// Path to project entry points.
entry: {
// replace it with your project related path.
@scq000
scq000 / .gitignore
Created May 18, 2017 06:26 — forked from smebberson/.gitignore
Express simple authentication example
node_modules
*.swp
@scq000
scq000 / 0_reuse_code.js
Created May 18, 2017 06:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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
/* 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 / 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]) {