Skip to content

Instantly share code, notes, and snippets.

View sebastienwindal's full-sized avatar

Sebastien Windal sebastienwindal

View GitHub Profile
@sebastienwindal
sebastienwindal / htmlTemplate.html
Created September 20, 2012 02:10
My modified html template for the iA writer on the mac.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>__IAWRITER_DOCUMENT_TITLE__</title>
<meta name="author" content="__IAWRITER_USER_NAME__">
<meta name="generator" content="iA Writer for Mac __IAWRITER_BUNDLE_VERSION__">
<meta name="description" content="">
<meta name="keywords" content="">
@sebastienwindal
sebastienwindal / WGenServer.h
Created October 29, 2012 15:34
.h file example
//
// WGenServer.h
// WgenTestCommon
//
// Created by Sebastian Windal on 10/24/12.
// Copyright (c) 2012 Sebastian Windal. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "WGenPeer.h"
@sebastienwindal
sebastienwindal / WGenServer.m
Created October 29, 2012 15:35
.m file example
//
// WGenServer.m
// WgenTestCommon
//
// Created by Sebastian Windal on 10/24/12.
// Copyright (c) 2012 Sebastian Windal. All rights reserved.
//
#import "WGenServer.h"
#import "GCDAsyncSocket.h"
@sebastienwindal
sebastienwindal / msg.m
Created October 29, 2012 15:51
messages
// what do you get?
// compile error?
// compile warning?
// runtime crash?
// value X displayed on console.
// 1.
NSString *str1 = @"hello";
NSLog(@"%d", [str1 length]);
@sebastienwindal
sebastienwindal / gist:4125476
Created November 21, 2012 15:34
bad practire
- (IBAction)myButtonAction:(id)sender {
UIButton *myButton = (UIButton *) sender;
if (myButton.tag == 1) {
// do X
}
else if (myButton.tag == 2) {
// do Y
}
else if (myButton.tag == 3) {
@implementation MyView2
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
@implementation ViewController3
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
|I Want to:|init(s)|lazy loading|viewDidLoad|viewWillAppear|
|----------|-------|------------|-----------|--------------|
|Initialize obj-c objects (array, dictionaries, etc...)| X | | | |
|Initialize C stuff (C buffer, etc...)|X|||||
|Setup UI stuff in code that is not layout related (UILabel fonts, texts, etc...)|||X||
|Adjust layout of elements in code, reposition things around||||X|
+(void) DoNotUseNSLog_It:(NSString *)format, ...
{
// call AMPDebug or whatever...
AMPDebug(blah blah
}
+(void) DoNotUseNSLog_It:(NSString *)format, ... __attribute__ ((deprecated));
#define NSLog(s, ...) [YourLogginClass DoNotUseNSLog_It:(s, ##__VA_ARGS__)];
/* style 1 */
#myText {
background-color: red;
}
/* style 2 */
#myText:hover {
background-color: blue;
}