Skip to content

Instantly share code, notes, and snippets.

View vitonzhangtt's full-sized avatar
😴
Be sleeping in the winter

vitonzhangtt

😴
Be sleeping in the winter
View GitHub Profile
@vitonzhangtt
vitonzhangtt / openssl-build.sh
Created November 9, 2018 10:21 — forked from foozmeat/openssl-build.sh
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@vitonzhangtt
vitonzhangtt / GCD_group.m
Last active August 20, 2018 15:08
How to use GCD group?
- (void)test_group {
dispatch_queue_t queue = dispatch_queue_create("diamond-queue", DISPATCH_QUEUE_CONCURRENT);
dispatch_group_t group = dispatch_group_create();
for (int i = 0; i < 10; i++) {
// dispatch_group_enter(group);
dispatch_sync(queue, ^{
dispatch_group_enter(group);
NSLog(@"i: [%@]__LINE__: %@", @(i), @(__LINE__));
@class TTUserObject;
@interface TTFriendsCollection : NSObject
- (void)addFriend:(TTUserObject *)user;
- (void)removeFriend:(TTUserObject *)user;
@end
@vitonzhangtt
vitonzhangtt / TTUserObject.h
Last active January 5, 2018 03:56
NSNotification
#import <Foundation/Foundation.h>
@interface TTUserObject : NSObject
- (void)postNicknameDidChangedNotification;
@end
@vitonzhangtt
vitonzhangtt / TTCounter.c
Last active January 5, 2018 03:14
Static variable definition in Header file
#include "TTCounter.h"
#include "TTDislikeCounter.h"
#include "TTLikeCounter.h"
void printTotalCounter() {
printf("total counter: %d", totalCounter);
}
int main(int argc, char *argv[]) {
addDislikeToTotalCounter();