Skip to content

Instantly share code, notes, and snippets.

View alex-cellcity's full-sized avatar

Alex Yao Cheng alex-cellcity

  • CellCity Ltd.
  • Singapore
View GitHub Profile
@alex-cellcity
alex-cellcity / git build version
Created November 19, 2012 10:43
git version
#!/bin/bash
release=`git tag | tail -n 1`
if [ -n release ]; then
release="1.0"
fi
build=`git log --oneline HEAD | wc -l | awk '{print $1 }'`
# build=`git log -n1 --date=short --format="%ad (%h)"`
# Shows 2012-04-24 (5fb42cb)
@alex-cellcity
alex-cellcity / zoomToFitMapAnnotations.m
Created November 19, 2012 05:25
zoomToFitMapAnnotations
- (void)zoomToFitMapAnnotations:(MKMapView *)mapView {
if ([mapView.annotations count] == 0) return;
int i = 0;
MKMapPoint points[[mapView.annotations count]];
//build array of annotation points
for (id<MKAnnotation> annotation in [mapView annotations])
points[i++] = MKMapPointForCoordinate(annotation.coordinate);
@alex-cellcity
alex-cellcity / ipaddress+gcd.m
Created October 11, 2012 09:42
gcd get ipaddress
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
NSString *ipaddress = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://ifconfig.me/ip"] encoding:NSUTF8StringEncoding error:NULL];
dispatch_sync(dispatch_get_main_queue(), ^{
[response respondWith:ipaddress];
});
});
@alex-cellcity
alex-cellcity / UINavigationBar+Height.m
Created September 6, 2012 07:39
Customize UINavigationBar Height
#import "UINavigationBar+Height.h"
@implementation UINavigationBar (Height)
- (CGSize)sizeThatFits:(CGSize)size
{
CGSize newSize = CGSizeMake(self.frame.size.width, 70);
return newSize;
}
@alex-cellcity
alex-cellcity / NSDate+Age.h
Created August 7, 2012 07:25
Calculate age from NSDate
//
// NSDate+Age.h
//
// Created by Alex Yao on 7/8/12.
// Copyright (c) 2012 alex@thecellcity.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDate (Age)
@alex-cellcity
alex-cellcity / Gemfile
Created August 3, 2012 09:52
Gemfile for tnpfk api
source 'http://rubygems.org'
gem 'actionmailer', '2.3.8'
gem 'actionpack', '2.3.8'
gem 'activerecord', '2.3.8'
gem 'activeresource', '2.3.8'
gem 'activesupport', '2.3.8'
gem 'addressable', '2.2.6'
gem 'akami', '1.0.0'
gem 'apns', '0.9.0'
@alex-cellcity
alex-cellcity / ShareKit.podspec
Created July 30, 2012 04:53
Sharekit.podspec + Fix Twitter weak_framework
Pod::Spec.new do |s|
s.name = 'ShareKit'
s.version = '2.0'
s.platform = :ios
s.summary = 'Drop in sharing features for all iPhone and iPad apps.'
s.homepage = 'http://getsharekit.com/'
s.author = 'ShareKit Community'
s.source = { :git => 'https://github.com/ShareKit/ShareKit.git', :commit => 'b8129c7c229a383ea5926aaa7869aadbccb71e8f' }
s.license = { :type => 'MIT',
:text => %Q|Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n| +
@alex-cellcity
alex-cellcity / ShareKit.podspec
Created July 30, 2012 04:51
Sharekit.podspec + Fix Twitter weak_framework
twitter.source_files = 'Classes/ShareKit/Sharers/Services/Twitter/**/*.{h,m}'
twitter.weak_framework = 'Twitter'
twitter.dependency 'JSONKit'
@alex-cellcity
alex-cellcity / SVWebViewController.podspec
Created July 30, 2012 04:36
SVWebViewController.podspec MRC Version
Pod::Spec.new do |s|
s.name = 'SVWebViewController'
s.version = '0.1'
s.summary = 'A drop-in inline browser for your iOS app.'
s.homepage = 'https://github.com/samvermette/SVWebViewController'
s.author = { 'Sam Vermette' => 'http://samvermette.com' }
s.source = { :git => 'https://github.com/samvermette/SVWebViewController.git',
:commit => '3044698e210318cca7d9acf5b2ca3394ea389723' }
s.platform = :ios
s.source_files = 'SVWebViewController/*.{h,m}'
@alex-cellcity
alex-cellcity / league.json
Created April 3, 2012 10:43
example of League data
[
{
"team":"JSSL Walcott",
"pos":"1",
"P":"13",
"W":"11",
"D":"2",
"L":"0",
"GF":"74",
"GA":"3",