Skip to content

Instantly share code, notes, and snippets.

View wangshijun's full-sized avatar

wangshijun wangshijun

View GitHub Profile
@wangshijun
wangshijun / quicksort.php
Created August 31, 2012 13:49
php: quick sort algorithm implemented in php
<?php
$data = array(55,41,59,26,53,58,97,93);
quicksort(0, sizeof($data)-1);
function quicksort($lower, $upper) {
global $data;
if ($lower >= $upper) {
return;
@wangshijun
wangshijun / create-asset.md
Created June 28, 2021 03:01
Persis data on ArcBlock blockchain

Create a simple js app that has @ocap/client and @ocap/wallet as dependency.

Then create a file called asset.js with following content:

const GraphqlClient = require('@ocap/client');
const { fromRandom } = require('@ocap/wallet');

const endpoint = 'https://beta.abtnetwork.io';
@wangshijun
wangshijun / Gesture.java
Created August 31, 2012 05:20
java: Continuous Recognition and Visualization of Pen Strokes and Touch-Screen Gestures
/*
* Continuous Recognition and Visualization of Pen Strokes and Touch-Screen Gestures
* Version: 2.0
*
* If you use this code for your research then please remember to cite our paper:
*
* Kristensson, P.O. and Denby, L.C. 2011. Continuous recognition and visualization
* of pen strokes and touch-screen gestures. In Procceedings of the 8th Eurographics
* Symposium on Sketch-Based Interfaces and Modeling (SBIM 2011). ACM Press: 95-102.
*
@wangshijun
wangshijun / index.js
Created July 11, 2019 23:17
forge recipers: transfer token from moderator to another account on
/* eslint-disable no-console */
const base64 = require('base64-url');
const { fromSecretKey, fromRandom } = require('@arcblock/forge-wallet');
const { bytesToHex, isHexStrict, fromTokenToUnit } = require('@arcblock/forge-util');
const GraphqlClient = require('@arcblock/graphql-client');
const endpoint = process.env.FORGE_API_HOST || 'http://127.0.0.1:8210'; // testnet
const client = new GraphqlClient(`${endpoint}/api`);
function ensureModeratorSecretKey() {
@wangshijun
wangshijun / exchange.js
Created May 5, 2019 08:33
forge-js grpc-client exchange example
/* eslint no-console:"off" */
/**
* This script demonstrates how to do exchange tx with grpc-client
* Since exchange tx requires multi-parti-signature, it's complicated
*
* How to do a multisig?
* First of all, for a tx that you received, generate a new structure `Multisig`.
* Add `signer` (the address of the signer) and `data` field
* (if no extra data, please keep it as default value - `nil`).
@wangshijun
wangshijun / keybase.md
Created June 11, 2018 06:16
keybase.md

Keybase proof

I hereby claim:

  • I am wangshijun on github.
  • I am wangshijun (https://keybase.io/wangshijun) on keybase.
  • I have a public key ASAWLSvdvkCKWKbgY1EgD90zt_f_44Ll2t3AZEVolHtZKwo

To claim this, I am signing this object:

{"sig":"2c79c4e48f8242c547cb534ed8f22a9d073329a89e250a35b660176100a7efa51267c81b3f004b1f9e17c83f54e0d6f0818877ff2d44871595e8a5b527c748600","msghash":"3878987a60e3d304de1c8ad35c6bbea03b1fedf6d832c82eb2dd06798f5f92e5"}
@wangshijun
wangshijun / markdownhere.css
Created October 22, 2017 23:58 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;
@wangshijun
wangshijun / detect_next.js
Created August 30, 2012 09:59
javascript: detect next page
/**
* 检测下一页javascript层面的实现, 支持html5形式,时间复杂度n
*
* @author wangshijun <wangshijun2010@gmail.com>
* @package default
* @subpackage default
* @copyright (c) wangshijun2010@gmail.com
* @todo Implement this in a OOP style
*/
@wangshijun
wangshijun / fake-referrer.casper.js
Created April 25, 2016 06:27 — forked from papoms/fake-referrer.casper.js
Fake Referrer with CasperJS
var fakeReferrer = "http://porzky.com"
var targetUrl = "http://keyworddomains.com"
var casper = require('casper').create();
casper.start(fakeReferrer, function() {
this.echo(this.getCurrentUrl());
});
casper.then(function(){