Skip to content

Instantly share code, notes, and snippets.

wangshijun wangshijun

Block or report user

Report or block wangshijun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wangshijun
wangshijun / index.js
Created Jul 11, 2019
forge recipers: transfer token from moderator to another account on
View index.js
/* 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
forge-js grpc-client exchange example
View exchange.js
/* 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`).
View 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:

View press.one
{"sig":"2c79c4e48f8242c547cb534ed8f22a9d073329a89e250a35b660176100a7efa51267c81b3f004b1f9e17c83f54e0d6f0818877ff2d44871595e8a5b527c748600","msghash":"3878987a60e3d304de1c8ad35c6bbea03b1fedf6d832c82eb2dd06798f5f92e5"}
View markdownhere.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;
View fake-referrer.casper.js
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(){
@wangshijun
wangshijun / blog-webpack-2.md
Created Feb 28, 2016 — forked from xjamundx/blog-webpack-2.md
From Require.js to Webpack - Part 2 (the how)
View blog-webpack-2.md

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

View gist:221bdea1970e7fd3967e
// Requires jQuery from http://jquery.com/
// and jQuerySparklines from http://omnipotent.net/jquery.sparkline
// AngularJS directives for jquery sparkline
angular.module('sparkline', []);
angular.module('sparkline')
.directive('jqSparkline', [function () {
'use strict';
return {
View gulpfile-express.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
View angularjs-fuzzy-filter.js
'use strict';
/*
IMPORTANT: requires Underscore.js (http://underscorejs.org)
Usage: ng-repeat="item in items | fuzzyFilter: searchText"
*/
var app = angular.module('app', []);
You can’t perform that action at this time.