Skip to content

Instantly share code, notes, and snippets.

View imnemo's full-sized avatar
🎯
focusing on preparing magicjs

imnemo imnemo

🎯
focusing on preparing magicjs
  • Chengdu in Sichuan of China
View GitHub Profile
@imnemo
imnemo / lazy.ts
Created August 26, 2020 09:57 — forked from kingfolk/lazy.ts
typescript lazy decorator
function Lazy<T>(initializer: () => T) {
// the return type of a property decorator function must be either 'void' or 'any'
return function lazy(target, name): any {
function set(value, that = this) {
Object.defineProperty(that, name, {
enumerable: true,
configurable: false,
writable: false,
value: value,
});
@imnemo
imnemo / net.js
Created May 21, 2019 08:09 — forked from sid24rane/net.js
Simple TCP Client and Server in Node.js (Covering all useful Properties & Methods)
var net = require('net');
// creates the server
var server = net.createServer();
//emitted when server closes ...not emitted until all connections closes.
server.on('close',function(){
console.log('Server closed !');
});
@imnemo
imnemo / Clang-format Comparison.md
Created April 28, 2019 09:27 — forked from andrewseidl/ Clang-format Comparison.md
Clang-format style comparison

This is a comparison of the different formatting styles including with clang-format.

Generated via:

styles=( LLVM Google Chromium Mozilla WebKit )
for style in $styles
do
  clang-format -style=$style ChLcpIterativeAPGD.h > ChLcpIterativeAPGD.$style.h

done

@imnemo
imnemo / emfile.js
Created August 29, 2013 10:07 — forked from joshkehn/emfile.js
var exec = require('child_process').exec,
spawn = require('child_process').spawn;
function create_path (basename, y, m, d, callback) {
var path = [basename, y, m, d].join('/'), mkdir;
mkdir = spawn('mkdir', ['-p', path], function (err, out, err_out) {
if (err) throw err;
callback(path, {stdout: out, stderr: err_out});
});
@imnemo
imnemo / rAF.js
Created May 15, 2013 02:19 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@imnemo
imnemo / mouse.js
Created December 3, 2012 07:01 — forked from rhiokim/mouse.js
Read Linux mouse(s) in node.js
/**
* Read Linux mouse(s) in node.js
* Author: Marc Loehe (marcloehe@gmail.com)
*
* Adapted from Tim Caswell's nice solution to read a linux joystick
* http://nodebits.org/linux-joystick
* https://github.com/nodebits/linux-joystick
*/
var fs = require('fs'),
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3