Skip to content

Instantly share code, notes, and snippets.

View jarvisniu's full-sized avatar
🐱
Staying curious

Jarvis Niu jarvisniu

🐱
Staying curious
View GitHub Profile
@jarvisniu
jarvisniu / 01.hello-world.c
Last active December 22, 2019 12:34
opengl-step-by-step
// gcc 01.hello-world.c -o 01.hello-world && ./01.hello-world
#include <stdio.h>
int main(int argc, char ** argv) {
printf("Hello World!");
return 0;
}
@jarvisniu
jarvisniu / isFullWidth.js
Last active February 11, 2019 15:58
判断字符是否是全宽 Detect whether a char full width
// 判断字符是否是全宽(中日韩文字及符号)
function isFullWidth (char) {
// 【文档】
// Unicode区块查询: https://unicodelookup.com
// 字符到HEX: '!'.charCodeAt(0).toString(16)
// HEX到字符: String.fromCharCode('0xff58')
// 【易弄错半宽】
// 半宽中文标点1: (2013|–)~(201d|”)
// 半宽中文标点2(。)、半宽片假名katakana(ヲ)、半宽韩文字母hangul(ᄀ): (ff61|。)~(201d|”)
// 【全宽字符】
@jarvisniu
jarvisniu / client.js
Created January 26, 2018 08:01
socket.io 2.0 demo
var socket = require('socket.io-client')('http://localhost:3000');
socket.on('connect', function(){
console.log('Connection success!')
});
socket.on('event', function(data){
console.log('Recieved data: ', data)
});
socket.on('disconnect', function(data){
console.log('Connection closed, resean: ', data)
@jarvisniu
jarvisniu / 0876.txt
Created October 28, 2017 06:21
4 methods of javascript async programming
diamond!
@jarvisniu
jarvisniu / hello-gopher-lua.go
Created October 13, 2017 09:16
Hello gopher-lua
package main
import (
"github.com/yuin/gopher-lua"
)
func main () {
L := lua.NewState()
defer L.Close()
@jarvisniu
jarvisniu / hello-tensorflow.py
Created October 13, 2017 09:05
Hello world program for TensorFlow
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))