Skip to content

Instantly share code, notes, and snippets.

View ghostwolf90's full-sized avatar

LaiBit ghostwolf90

  • Ubitech Inc.
  • Taiwan
View GitHub Profile
@erinlin
erinlin / objective-c.md
Created December 17, 2013 07:45
Objective-C學習筆記

Objective-C note

初始化 function

-(id) 就是 Objective-C 中的 object, 本身就是帶一個 pointer 所以不用再加 *

-(id)initWithName:(NNString *)name andAge:(int)age{
    id result = [super init];
    if(result){
        self.name = name;

self.age = age;

@v5tech
v5tech / Swift.md
Last active August 29, 2015 14:02
Swift Code 碎片整理

Swift Code 碎片整理

1. NSURLConnection

var url = NSURL(string: "http://www.stackoverflow.com")
var request = NSURLRequest(URL: url)

NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue(), completionHandler: {(response: NSURLResponse!, data: NSData!, error: NSError!) in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
@dethell
dethell / viewWillDisappear
Last active August 29, 2015 14:04
Swift version of viewWillDisappear needed for custom storyboard back button behavior
override func viewWillDisappear(animated:Bool) {
if let currentViewControllers = self.navigationController.viewControllers as? [UIViewController] {
if let found = find(currentViewControllers, self) {
// Do nothing if the current controller is still in the stack. This means we're going forward, not back
}
else {
self.performSegueWithIdentifier("unwindToLogin", sender:self)
}
}
super.viewWillDisappear(animated)
@cromandini
cromandini / universal-framework.sh
Last active February 12, 2024 12:13 — forked from cconway25/gist:7ff167c6f98da33c5352
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@attictv
attictv / attictv.ios.zh.md
Last active August 29, 2015 14:26
AtticTV 正在募集 iOS全職,兼職開發人員以及自由接案人員。你可以隨時隨地、自由自在地工作。詳細資料如下!

誠徵:iOS開發人員

職位:全職/兼職/自由接案人員

  • 職務:iOS開發人員
  • 若合作愉快,有機會轉正職!

責任:協助我們打造東南亞及亞太地區最棒的新聞應用程式!

@gradyzhuo
gradyzhuo / gist:be9b5f32fbc14b86ef7d
Last active August 29, 2015 14:27
parkingData
//
// parkingDate.swift
// stopTest
//
// Created by Laibit on 2015/7/28.
// Copyright (c) 2015年 Laibit. All rights reserved.
//
import UIKit
@xareelee
xareelee / NSObject+PropertyName.h
Last active May 2, 2019 13:43
Objective-C property name to a string with autocompletion and compile-time check
// Release under MIT
// Copyright (C) 2015 Xaree Lee
#import <Foundation/Foundation.h>
/* Get property name for the class (C string or NSSting). */
#define keypathForClass(Klass, PropertyName) \
(((void)(NO && ((void)[Klass _nullObjectForCheckingPropertyName].PropertyName, NO)), # PropertyName))
#define keypathStringForClass(Klass, PropertyName) \
@keypathForClass(Klass, PropertyName)
@dolphinSuPixnet
dolphinSuPixnet / TestCPU.swift
Created September 2, 2015 09:39
Test Your CPU using Swift
#!/usr/bin/env swift
import Foundation
func oneLoop() -> Double{
var sumValue = 0
let startTime = NSDate().timeIntervalSince1970
for i in 1...100000000 {
if (i % 2 == 1) {
sumValue++
} else {
@kevinkindom
kevinkindom / Python Socket 编程详细介绍.md
Last active July 25, 2024 08:20
Python Socket 编程详细介绍

Python Socket 编程详细介绍

Python 提供了两个基本的 socket 模块:

  • Socket 它提供了标准的BSD Socket API。
  • SocketServer 它提供了服务器重心,可以简化网络服务器的开发。

下面讲解下 Socket模块功能。

Socket 类型

NSOperationQueue *queue = [[NSOperationQueue alloc] init];
queue.maxConcurrentOperationCount = 1;
NSInteger inputValue = 5;
NSMutableArray<NSOperation *> *operations = [NSMutableArray<NSOperation *> array];
for (NSInteger i=0; i<inputValue; i++){
NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
NSLog(@".Running operation %d", i);
[NSThread sleepForTimeInterval:1];
}];