Skip to content

Instantly share code, notes, and snippets.

wget https://nodejs.org/dist/v4.3.1/node-v4.3.1-linux-x64.tar.xz
xz -d node-v4.3.1-linux-x64.tar.xz
tar -xf node-v4.3.1-linux-x64.tar
rm node-v4.3.1-linux-x64.tar
mv node-v4.3.1-linux-x64/ node-4.3.1
ln -sf /opt/node-4.3.1/bin/node /usr/bin/node
ln -sf /opt/node-4.3.1/bin/npm /usr/bin/npm
@hoorace
hoorace / Anonymous.swift
Last active December 24, 2015 13:14
swift anonymous class example
protocol HelloListener {
func hello(title: String)
}
var list :[HelloListener] = [HelloListener]()
var parentsHello: HelloListener = {
class AnonymousClass: HelloListener {
func hello(title: String) {
print("My parents has son name is \(title)")
import UIKit
@objc class ClosureDispatch {
init(f:()->()) { self.action = f }
func execute() -> () { action() }
let action: () -> ()
}
var redBlueGreen:[String] = ["Red", "Blue", "Green"]
let buttons:[UIButton] = map(0..<redBlueGreen.count) { i in
//https://github.com/jketterl/memcachejs/blob/master/lib/pool.js
var Memcache = require('./memcache');
var exports = module.exports = function(options){
// default settings
Memcache.apply(this, {
maxConnections:10,
host:'localhost',
port:11211,
pool:[]
@hoorace
hoorace / gist:3023042
Created June 30, 2012 09:03
jredis pubsub
/*
* Copyright 2011 Jeanfrancois Arcand
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hoorace
hoorace / gist:1500110
Created December 20, 2011 03:32
.vimrc
" hoorace vimrc
set nocompatible
set fileencodings=usc-bom,utf-8,gbk
set mouse=a
set nobomb
set nowrap
set number