Skip to content

Instantly share code, notes, and snippets.

View colemancda's full-sized avatar
🏎️
Working with Swift on ARM

Alsey Coleman Miller colemancda

🏎️
Working with Swift on ARM
View GitHub Profile
@colemancda
colemancda / gist:5379790
Last active December 16, 2015 04:49
Init for NSViewController - Loads the XIB with the same name as the NSViewController's Class
- (id)init
{
self = [self initWithNibName:NSStringFromClass([self class]) bundle:nil];
if (self) {
}
return self;
}
@colemancda
colemancda / gist:5379799
Created April 13, 2013 19:52
Singleton Implementation
+ (<#Class#> *)shared<#short class name#>
{
static <#Class#> *shared<#short class name#> = nil;
if (!shared<#short class name#>) {
shared<#short class name#> = [[super allocWithZone:nil] init];
}
return shared<#short class name#>;
}
+ (id)allocWithZone:(NSZone *)zone
@colemancda
colemancda / gist:5379802
Created April 13, 2013 19:52
Store Singleton Implementation
+ (<#Class#> *)sharedStore
{
static <#Class#> *sharedStore = nil;
if (!sharedStore) {
sharedStore = [[super allocWithZone:nil] init];
}
return sharedStore;
}
+ (id)allocWithZone:(NSZone *)zone
@colemancda
colemancda / gist:5379814
Created April 13, 2013 19:54
UITableView Datasource - The two required methods to conform to UITableViewDataSource Protocol
#pragma mark - UITableView DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return <#Number of Rows#>
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
<#Table View Cell Class#> *cell = [tableView dequeueReusableCellWithIdentifier:<#Table View Cell Identifier#>];
@colemancda
colemancda / gist:5379818
Last active December 16, 2015 04:49
Exception for Init - Use when you created a new default inititalizer and dont want anyone to use the '-init' method
- (id)init
{
[NSException raise:@"Wrong initialization method"
format:@"You cannot use %@ with %@, you have to use %@",
NSStringFromSelector(_cmd),
self,
NSStringFromSelector(@selector(<#New Initializer#>))];
return nil;
}
#!/bin/bash
#
# Written by Tobias Lensing, http://tlensing.org
# For more information see http://blog.tlensing.org/2013/02/24/objective-c-on-linux-setting-up-gnustep-clang-llvm-objective-c-2-0-blocks-runtime-gcd-on-ubuntu-12-04/
#
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' curl | grep "install ok installed")
echo Checking for curl: $PKG_OK
if [ "" == "$PKG_OK" ]; then
sudo apt-get install curl -y
@colemancda
colemancda / wwdc15.md
Last active August 29, 2015 14:24 — forked from mackuba/wwdc15.md

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@colemancda
colemancda / SunXi.swift
Created June 7, 2016 05:25
SunXi Extensions for SwiftyGPIO
//
// SunXi.swift
//
//
// Created by Alsey Coleman Miller on 6/7/16.
// Copyright © 2016 ColemanCDA. All rights reserved.
//
public struct SunXiGPIO: CustomStringConvertible, Equatable {
@colemancda
colemancda / IoTLima-14-08-206.swift
Last active August 13, 2016 20:06
IoT, BLE, Swift y Linux Workshop
let title = "IoT, BLE, Swift y Linux"
// When
let date = "August 13th, 2016"
let city = "Lima, Peru"
let location = "Laboratoria Perú"
// Duration
let hours = 8