Skip to content

Instantly share code, notes, and snippets.

View ZZR-china's full-sized avatar
🏠
Working from home

magic-wind ZZR-china

🏠
Working from home
View GitHub Profile
@ZZR-china
ZZR-china / hapi_ext.js
Created December 2, 2016 11:05
hapi ext func
/**
* with hapi, you should catch request in his way
* I am going to build a web Permission System
* use hapi's ext func , I can catch req before it get in
* route
*/
server.ext('onRequest', function(request, reply) {
const JWT = require('jsonwebtoken');
const token = request.headers.authorization;
const path = request.path;
@ZZR-china
ZZR-china / websocket_broadcast.js
Last active December 1, 2016 05:26
websocket broadcast func , npm package use websocket (author theturtle32) and use timestamp as client uid
const PORT = parseInt(process.env.LEANCLOUD_APP_PORT || 3000);
app = express();
const server = require('http').createServer(app);
//WebSocket;
let clients = []; // list of currently connected clients (users)
const WebSocketServer = require('websocket').server;
const wsServer = new WebSocketServer({
httpServer: server,

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!