Skip to content

Instantly share code, notes, and snippets.

View Fullstop000's full-sized avatar
🎯
Focusing

Fullstop000 Fullstop000

🎯
Focusing
  • Hangzhou Zhejiang
View GitHub Profile
@Fullstop000
Fullstop000 / delay.js
Last active April 21, 2020 03:30
A synchonized delay js function
/**
* This delay function returns a Promise which will fullfill when the timer goes off
*/
export default function delay(fn, duration) {
return new Promise(resolve => setTimeout(() => { fn(); resolve()}), duration)
}
@Fullstop000
Fullstop000 / genesis_public_key
Last active February 22, 2018 04:47
genesis_public_key
04c0c0e476bd9f08980c6451372e78fa3accea476a6206b2219c3fe67fdf1bebdf0c7827f93e7f864f7ef778f83f053bb08c790977cc632cb81e987f6121cfe7a5
@Fullstop000
Fullstop000 / npmrc
Last active February 1, 2018 02:09
The npmrc file using npm taobao mirror
registry=https://registry.npm.taobao.org
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=http://cdn.npm.taobao.org/dist/phantomjs
electron_mirror=http://cdn.npm.taobao.org/dist/electron/
@Fullstop000
Fullstop000 / client.js
Last active September 30, 2017 06:50
Websocket client & server
const url = 'ws://localhost:1234'
let ws = new WebSocket(url,'test_protocol')
ws.onopen = () => {
console.log('Client connection opened')
ws.send('Hello Websocket')
}
ws.onmessage = (event) => {
console.log('Received message : '+ event.data)
}
public String triangleGenerator(int num, char letter ){
if(num%2==0){
num++
}
// int num = 21; // input num (assume odd)
// char letter = 'A'; // input char
int rows = (num+1)/2; // the amount of rows
String result = "";
int rowIdx = 1; // assume the idx of first row is 1