Skip to content

Instantly share code, notes, and snippets.

vitrum.zhu vitrum

Block or report user

Report or block vitrum

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AppDelegate.swift
// AppDelegate.swift
// pushtest
// Created by sawapi on 2014/06/08.
// Copyright (c) 2014年 sawapi. All rights reserved.
// iOS8用
import UIKit
View gist:dc964ef3b00d766706bc


We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.


View angular-loadscript-with-documentwrite.js
* This module is a variant which supports document.write. If you need document.write use this instead
* Author: Deepak Subramanian @subudeepak(
* Distributed under MIT License
/*global angular */
(function (ng) {
'use strict';
app.directive('script', function() {
return {
# Copyright (c) 2013 KimSia Sim
# Ubuntu 12.10 based install jenkins and other related plugins
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
# bash -c "$(curl -fsSL"
View nodejs tcp
var net = require('net');
net.createServer(function (stream) {
stream.on('end', function () {
View nodejs http server
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
View gist:8876191
function getTransform(el) {
var results =\(\d+(?:, \d+)*(?:, (\d+))(?:, (\d+))(?:, (\d+)), \d+\)|\(\d+(?:, \d+)*(?:, (\d+))(?:, (\d+))\))/)
if(!results) return [0, 0, 0];
if(results[1] == '3d') return results.slice(2,5);
return results.slice(5, 8);
View html5-video-streamer.js
* Inspired by:
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
View jsbin..html
<!DOCTYPE html>
<meta charset=utf-8 />
<title>JS Bin</title>
You can’t perform that action at this time.