Skip to content

Instantly share code, notes, and snippets.

Cliff Wang jigewxy

  • Singapore
Block or report user

Report or block jigewxy

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
View gist:505fa29efe92e95059ab6dc8fdb3b10d
<div class="about">
<div class="player">
<iframe width="100%" height="100%"
src="" frameborder="0" allowfullscreen></iframe>
<div class="analyzer">
<iframe width="100%" height="780"
src=",keywords,annotations" frameborder="0" allowfullscreen></iframe>
View gist:32ab057e4cd734c58cdc753359d62327
function sleep(ms){
return new Promise(function(resolve){
resolve('sleep for '+ ms + 'ms');
}, ms);
jigewxy / DecoratorDemo
Created Feb 17, 2018
Decorator design pattern
View DecoratorDemo
interface Shape{
void draw();
class Circle implements Shape{
jigewxy /
Created Feb 17, 2018
Observable Class and Observer Interface
import java.util.Observable;
import java.util.Observer;
class ObservableObj extends Observable{
private int watched;
ObservableObj (int watched){
jigewxy / index.js
Created Feb 14, 2018
Async method - promise.js
View index.js
const fs = require('fs');
const Promise = require('promise');
const assert = require('assert');
var p1 = new Promise(function(reject, resolve){
//let result= fs.readFileSync('./index.html');
let result= fs.readFileSync('./main.html');
jigewxy / index.js
Created Feb 14, 2018
ASYNC method - async.forEachOf
View index.js
const async = require('async');
var arr =[5,4,3,2,1];
async.forEachOf(arr, (index,i, callback)=>{
setTimeout(()=>{console.log(`Wait for ${index} seconds`); callback(null);}, index*1000);
}, function(err){
jigewxy / index.js
Created Feb 13, 2018
View index.js
const thumb = require('node-thumbnail').thumb;
source: './img', //can be directory
destination: './pics', // can be directory
width: 50
}, (files, err, stdout, stderr)=> console.log('all done!'));
jigewxy /
Created Feb 12, 2018
lambda function with pre-defined interface (RequestHandler <Request, Response> )
public class EchoHello implements RequestHandler <Request, Response> {
public Response handleRequest(Request request, Context context) {
String greetingString = String.format("Hello %s %s.", request.firstName, request.lastName);
return new Response(greetingString);
jigewxy / DemoHttpRequest
Created Feb 11, 2018
http request sample - java
View DemoHttpRequest
public class DemoHttpRequest{
public static void main(String[] args) {
String payload="{\"jsonrpc\":\"2.0\",\"method\":\"changeDetail\",\"params\":[{\"id\":11376}],\"id\":2}";
jigewxy /
Created Feb 9, 2018
methodhiding on static method
package study.tonight;
class Animal {
public static void showlog(){
System.out.println("static: parent method invoked");
You can’t perform that action at this time.