Skip to content

Instantly share code, notes, and snippets.

View jigewxy's full-sized avatar

Cliff Wang jigewxy

  • Singapore
View GitHub Profile
@jigewxy
jigewxy / DemoHttpRequest
Created February 11, 2018 17:28
http request sample - java
import java.net.*;
import java.io.*;
public class DemoHttpRequest{
public static void main(String[] args) {
try{
String payload="{\"jsonrpc\":\"2.0\",\"method\":\"changeDetail\",\"params\":[{\"id\":11376}],\"id\":2}";
@jigewxy
jigewxy / MethodHiding.java
Created February 9, 2018 11:45
methodhiding on static method
package study.tonight;
class Animal {
public static void showlog(){
System.out.println("static: parent method invoked");
}
@jigewxy
jigewxy / cluster.js
Created February 9, 2018 11:40
Use cluster for master/child process communication
const cluster = require('cluster');
const app = require('express')();
const bodyParser = require('body-parser');
const cpus = 4;
var index = 0;
//next();
@jigewxy
jigewxy / child.js
Created February 9, 2018 09:54
node.js fork example --> parent/child process increment and interchange the count variable until >100
var count =Math.floor(Math.random()*100);
process.on('message', (msg)=>{
console.log("CHILD: message received from parent process", msg);
count = parseInt(msg) +1;
console.log("CHILD: +1 from child");
@jigewxy
jigewxy / gist:2d962f057395e919badabf6392915bfa
Created February 7, 2018 11:13
resizeable window using jquery.draggable
$(document).ready(function () {
setCurrentTabHeaderText();
// $("#ownedTaskSection").resizable();
var prevY = 0,
nextY =0,
offset = 0;
@jigewxy
jigewxy / gist:7684e50e24c4b26b2fa2879993606522
Created February 6, 2018 07:44
kendo chart, format percentage strings
$(chartId).kendoChart({
theme: 'bootstrap',
title: {
position: "bottom",
text: chartTitle,
color: "#ffffff",
fontSize: "22px"
},
legend: {
visible: false
@jigewxy
jigewxy / gist:3e6aa8ad3953eaf1c72d12c8afa23e7b
Created February 6, 2018 03:37
angular form validation
--js----
/** Basic input validator for input text field, it detect empty input and special characters */
app.directive('inputValidator', function() {
return {
require: 'ngModel', //ngModelController is required here
link: function(scope, element, attr, mCtrl) {
function myValidation(value) {
if (value.trim()!=="" && new RegExp(/[~`!@#\$%\^&*\/\\\|\?\.,:;"']/g).test(value)==false) {
mCtrl.$setValidity('charE', true);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">