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 / 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 / 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 / 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 / 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 / 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 / plist_to_csv.rb
Created January 4, 2013 10:34
branches plist to csv
#!/usr/bin/env ruby
require 'plist'
require 'json'
require 'csv'
header = ['city_name', 'type', 'address', 'branch_name', 'lat', 'lon', 'phone']
csv = CSV.open('branches.csv', 'w', {force_quotes: true}) do |csv|
csv << header
@alex-cellcity
alex-cellcity / cipa.sh
Created January 8, 2013 09:08
search udid inside .ipa file
#!/bin/bash
if [ $# == 1 ]
then
echo "UDIDs inside IPA: $1"
unzip -p "$1" Payload/\*.app/embedded.mobileprovision | grep -a "[a-z0-9]\{40\}"
elif [ $# == 2 ]
then
echo "Searching UDID: '$2' inside: '$1'"
unzip -p "$1" Payload/\*.app/embedded.mobileprovision | grep -a "[a-z0-9]\{40\}" | tr -d ' ' | grep "$2"
@alex-cellcity
alex-cellcity / UIMenuItem-CXAImageSupport.podspec
Created January 9, 2013 09:40
UIMenuItem-CXAImageSupport
Pod::Spec.new do |s|
s.name = 'UIMenuItem-CXAImageSupport'
s.version = '0.0.1'
s.license = 'MIT'
s.summary = 'UIMenuItem with Image Support.'
s.homepage = 'https://github.com/cxa/UIMenuItem-CXAImageSupport'
s.author = 'cxa'
s.source = { :git => 'https://github.com/cxa/UIMenuItem-CXAImageSupport.git', :commit => 'a785911a' }
s.source_files = 'UIMenuItem+CXAImageSupport.{h,m}'
s.requires_arc = true
@alex-cellcity
alex-cellcity / NVSlideMenuController.podspec
Created January 14, 2013 09:10
NVSlideMenuController.podspec
#
# Be sure to run `pod spec lint NVSlideMenuController.podspec' to ensure this is a
# valid spec.
#
# Remove all comments before submitting the spec. Optional attributes are commented.
#
# For details see: https://github.com/CocoaPods/CocoaPods/wiki/The-podspec-format
#
Pod::Spec.new do |s|
s.name = "NVSlideMenuController"