Skip to content

Instantly share code, notes, and snippets.

View neolee's full-sized avatar

Neo Lee neolee

View GitHub Profile
@neolee
neolee / Equity.md
Last active August 29, 2015 14:10 — forked from isaacsanders/Equity.md

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@neolee
neolee / gist:1167540
Created August 24, 2011 08:04
parseQueryString
- (NSDictionary *)parseQueryString:(NSString *)query {
NSMutableDictionary *dict = [[[NSMutableDictionary alloc] initWithCapacity:6] autorelease];
NSArray *pairs = [query componentsSeparatedByString:@"&"];
for (NSString *pair in pairs) {
NSArray *elements = [pair componentsSeparatedByString:@"="];
NSString *key = [[elements objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *val = [[elements objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[dict setObject:val forKey:key];
@neolee
neolee / NSDictionary+QueryStringBuilder.h
Created August 24, 2011 08:02 — forked from mramsden/NSDictionary+QueryStringBuilder.h
Creating a query string from an NSDictionary.
#import <Foundation/Foundation.h>
@interface NSDictionary (QueryStringBuilder)
- (NSString *)queryString;
@end
@neolee
neolee / hack.sh
Created March 31, 2012 11:02 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@neolee
neolee / gist:3403044
Created August 20, 2012 10:40
Homebrew on Mac OS X 10.8: Error building SBCL
Error log:
WARNING! Some of the contrib modules did not build successfully or pass
their self-tests. Failed contribs:"
sb-concurrency
==> Exit Status: 1
https://github.com/mxcl/master/blob/master/Library/Formula/sbcl.rb#L78
==> Build Environment
HOMEBREW_VERSION: 0.9.2
HEAD: ed127082d8e11debdba4c17fb63ea72e9a14c4ad
@neolee
neolee / primes
Created March 23, 2013 14:15
Lazy primes generator by using a map, a Sieve of Eratosthenes modified by Christophe Grand (co-author of the great book 'Clojure Programming').
(defn primes []
(letfn [(enqueue [sieve n step]
(let [m (+ n step)]
(if (sieve m)
(recur sieve m step)
(assoc sieve m step))))
(next-sieve [sieve candidate]
(if-let [step (sieve candidate)]
(-> sieve
(dissoc candidate)
function runClojureDocsOrg(redis) {
var assert = require('better-assert');
var request = require('request');
var jsdom = require('jsdom');
// URL for web scrapping
var siteUrl = 'http://clojuredocs.org';
var category = 'clojure_core';
var pageUrl = siteUrl + '/' + category;
@neolee
neolee / cheerio.js
Created May 17, 2013 13:45
Using cheerio and request to scrape clojure.github.io/clojure
function runClojureOrg(redis) {
var request = require('request');
var cheerio = require('cheerio');
var urlClojureAPI = 'http://clojure.github.io/clojure/';
console.log('Start scrapping index: ' + urlClojureAPI);
redis.flushdb();
@neolee
neolee / TeXIt.tex
Created May 3, 2012 10:46
XeLaTeX Sample
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% 以上设定默认使用 XeLaTeX 编译,并指定 Unicode 编码,供 TeXShop 自动识别
% XeLaTeX 示例
\documentclass[12pt]{article}
% XeTeX 配合 fontspec 可以非常方便的设置字体
import Foundation
func randomDouble() -> Double {
return Double(arc4random_uniform(UInt32.max)) / Double(UInt32.max)
}
struct CalculatorBrain {
var numberFormatter: NumberFormatter?