Skip to content

Instantly share code, notes, and snippets.

View linktoming's full-sized avatar

Mingming Wang linktoming

  • Singapore
View GitHub Profile

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

#!/bin/sh
# Script for managing build and version numbers using git and agvtool.
# Change log:
# v1.0 18-Jul-11 First public release.
# v1.1 29-Sep-12 Launch git, agvtool via xcrun.
version() {
#!/bin/bash
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)
# remember to run chmod +x on it
CATALINA_HOME=/Users/username/tomcat
function shutdown() {
date
echo "Shutting down Tomcat"

UIStatusBarStyle in iOS 7

  • The status bar in iOS 7 is transparent, the view behind it shows through.

  • The style of the status bar refers to the appearances of its content. In iOS 7, the status bar content is either dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent). Both UIStatusBarStyleBlackTranslucent and UIStatusBarStyleBlackOpaque are deprecated in iOS 7.0. Use UIStatusBarStyleLightContent instead.

How to change UIStatusBarStyle

  • If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (UINavigationBar.barStyle):
@linktoming
linktoming / KeyboardHandler.m
Last active August 29, 2015 14:14 — forked from philipmcdermott/KeyboardHandler.m
How to use keyboard notification to adjust view when keyboard is about to show or hide
- (void)viewDidAppear:(BOOL) animated {
[super viewDidAppear:animated];
// Register notification when the keyboard will be show
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
// Register notification when the keyboard will be hide
@linktoming
linktoming / gist:1479712
Created December 15, 2011 03:33
Gesture Recognition
/********************************************************************
* Add Recognizer to view
*
* UITapGestureRecognizer
* UISwipeGestureRecognizer
* UIPinchGestureRecognizer
* UIRotationGestureRecognizer
* UIPanGestureRecognizer
* UILongPressGestureRecognizer
*/
@linktoming
linktoming / SCAppUtils.h
Created December 15, 2011 04:24 — forked from scelis/SCAppUtils.h
Add a background image to your UINavigationBar.
#import <UIKit/UIKit.h>
#define kSCNavigationBarBackgroundImageTag 6183746
#define kSCNavigationBarTintColor [UIColor colorWithRed:0.54 green:0.18 blue:0.03 alpha:1.0]
@interface SCAppUtils : NSObject
{
}
+ (void)customizeNavigationController:(UINavigationController *)navController;
@linktoming
linktoming / gist:1486599
Last active September 28, 2015 19:38
Git Command
1. To Setup Git:
$git --version
$git config --global user.name "Your Name"
$git config --global user.email "Your Email Address"
$git config --global color.ui "auto"
$git config --global alias.co checkout
$git config --global core.editor "mate -w"
2. To Generate SSH Key for SSH Connection:
@linktoming
linktoming / gist:1495829
Created December 19, 2011 07:10
UIResponder's Touch Handling
#pragma mark -
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
messageLabel.text = @"Touches Began";
[self updateLabelsFromTouches:touches];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
messageLabel.text = @"Drag Detected";
[self updateLabelsFromTouches:touches];
@linktoming
linktoming / gist:1497555
Created December 19, 2011 14:56
Rename Files in Python
import os
i=1
for file in os.listdir("/Users/****/Downloads/Episode1"):
if os.path.splitext(file)[1] == ".gif":
os.rename(file, "2011_11_"+str(i)+".gif")
i+=1