Skip to content

Instantly share code, notes, and snippets.

View zjhiphop's full-sized avatar
🎯
Focusing

newboy zjhiphop

🎯
Focusing
  • cloud-tea
  • USA
View GitHub Profile
@zjhiphop
zjhiphop / the-scratch.conf
Created July 4, 2018 07:02 — forked from korczis/the-scratch.conf
Nginx Node.js Proxy with caching, websockets, gzip
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_the_scratch {
server 127.0.0.1:3000 weight=1 fail_timeout=60s;
}
# the nginx server instance
server {
@zjhiphop
zjhiphop / WebGL-frameworks-libraries.md
Created January 24, 2018 07:33 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL frameworks and libraries

A non-exhaustive list of WebGL frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are outdated/not maintained anymore.

Engines and libraries

  • three.js: JavaScript 3D library
  • stack.gl: an open software ecosystem for WebGL, built on top of browserify and npm.
  • PixiJS: Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
  • Pex: Pex is a javascript 3d library / engine allowing for seamless development between Plask and WebGL in the browser.
  • Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL
  • SceneJS: An extensible WebGL-based engine for high-detail 3D visualisation
  • Blend4Web: a tool for interactive 3D visualization on the Internet
@zjhiphop
zjhiphop / tcp-socketio-sample.js
Created September 18, 2017 07:09 — forked from maripiyoko/tcp-socketio-sample.js
Node.js Tcp server & Socket.io
// socket io
var app = require('http').createServer(handler),
io = require('socket.io').listen(app),
fs = require('fs');
app.listen(3000, function() {
console.log('Socket IO Server is listening on port 3000');
});
function handler(req, res) {
@zjhiphop
zjhiphop / RestServer.php
Created August 30, 2017 06:12 — forked from jasdeepkhalsa/RestServer.php
Simple PHP REST / JSON Server with example.php by Jake Sankey (http://jakesankey.com/blog/2012/09/php-simple-rest-server/)
<?php
class RestServer
{
public $serviceClass;
public function __construct($serviceClass)
{
$this->serviceClass = $serviceClass;
}
@zjhiphop
zjhiphop / gist:872ec0cd0ccaf6b5ac7d5bc880f8ab13
Created April 20, 2017 08:27 — forked from Faithree/gist:f8b84de4a300a6a42c2f4a1a46a08872
关于vue+node前后端分离,前端跨域的方案
昨天在做登陆请求的时候,脑子一抽,想试试原生的ajax来请求后台,这时候我就写下了下面的代码,
```
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304) {
console.log(xhr.responseText)
} else {
//错误处理
@zjhiphop
zjhiphop / avoiding-exceptions.js
Created February 5, 2017 02:54 — forked from eiriklv/avoiding-exceptions.js
Exception free JavaScript?
/**
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-(
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go
*/
/**
* Wrap an "unsafe" promise
*/
function safePromise(promise) {
return promise
@zjhiphop
zjhiphop / nginx_config.md
Created November 7, 2016 10:17 — forked from Mioke/nginx_config.md
Mac OS下安装及配置nginx
@zjhiphop
zjhiphop / es6.md
Created November 2, 2016 09:38
ES6 练习
# Reference:
https://www.cloudgear.net/blog/2015/5-minutes-kubernetes-setup/
# install homebrew and cask
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install virtualbox
brew cask install virtualbox
# install dockertoolbox
❯ rollup --version
rollup version 0.25.3
❯ time rollup -c ./rollup.js
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total
❯ time webpack
Hash: ebb00bbccd954c114d3c
Version: webpack 2.0.7-beta
Time: 3623ms