Skip to content

Instantly share code, notes, and snippets.

@Seasons7
Seasons7 / CCBReader.m
Created November 7, 2015 14:36
CCBReader.m
Class class = NSClassFromString(className);
if (!class)
{
// Class was not found. Maybe it's a Swift class?
// See http://stackoverflow.com/questions/24030814/swift-language-nsclassfromstring
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *classStringName = [NSString stringWithFormat:@"_TtC%lu%@%lu%@", (unsigned long)appName.length, appName, (unsigned long)className.length, className];
class = NSClassFromString(classStringName);
}
if (!class)
@Seasons7
Seasons7 / nstask.swift
Created July 22, 2015 19:21
NSTask Sample for Swift
import Cocoa
import Foundation
var str = "Hello, playground"
var task:NSTask = NSTask()
var pipe:NSPipe = NSPipe()
task.launchPath = "/bin/ls"
task.arguments = ["-la"]
@Seasons7
Seasons7 / sc_find.py
Created July 11, 2015 06:44
Keychain codesign information
import commands
import re
def get_codesign_entries_from_keychain():
cm = 'security find-identity -v -p codesigning'
result = commands.getoutput(cm)
entries = []
if result:
items = result.split('\n')
@Seasons7
Seasons7 / ccswift20150324.swift
Created March 23, 2015 17:04
ccswift20150324
import Foundation
class MainScene: CCNode {
let audio:OALSimpleAudio = OALSimpleAudio.sharedInstance()
override func onEnter() {
audio.playBg("bgm.mp3", loop: true)
}
}
@Seasons7
Seasons7 / ccswift20150102.swift
Created January 2, 2015 14:37
ccswift20150102
import Foundation
class MainScene: CCNode {
let audio:OALSimpleAudio = OALSimpleAudio.sharedInstance()
override func onEnter() {
self.userInteractionEnabled = true
@Seasons7
Seasons7 / ccswift20150101.swift
Created December 30, 2014 21:25
ccswift20150101
import Foundation
class MainScene: CCNode {
override func onEnter() {
self.userInteractionEnabled = true
super.onEnter()
}
@Seasons7
Seasons7 / CCSwift20141231_02.m
Created December 30, 2014 17:57
CCSwift20141231_02
NSString * const CCFileUtilsSuffixDefault = @"default";
NSString * const CCFileUtilsSuffixiPad = @"ipad";
NSString * const CCFileUtilsSuffixiPadHD = @"ipadhd";
NSString * const CCFileUtilsSuffixiPhone = @"iphone";
NSString * const CCFileUtilsSuffixiPhoneHD = @"iphonehd";
NSString * const CCFileUtilsSuffixiPhone5 = @"iphone5";
NSString * const CCFileUtilsSuffixiPhone5HD = @"iphone5hd";
NSString * const CCFileUtilsSuffixMac = @"mac";
NSString * const CCFileUtilsSuffixMacHD = @"machd";
@Seasons7
Seasons7 / ccswift20141231.swift
Created December 30, 2014 17:51
ccswift20141231_01
var chara = CCSprite(imageNamed: "images/image.png")
@Seasons7
Seasons7 / ccswift20141228.swift
Created December 27, 2014 16:48
ccswift20141228
import Foundation
class MainScene: CCNode {
override func onEnter() {
var winSize = CCDirector.sharedDirector().designSize
var chara = CCSprite(imageNamed: "images/image.png")
self.addChild(chara)
@Seasons7
Seasons7 / SwiftSpriteSample01.swift
Last active August 29, 2015 14:12
SwiftSpriteSample01
import Foundation
class MainScene: CCNode {
override func onEnter() {
var sp = CCSprite(imageNamed: "iPhone.png")
self.addChild(sp)
sp.position = ccp(200,200)