Skip to content

Instantly share code, notes, and snippets.

keisuke hata Seasons7

View GitHub Profile
View 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 Jul 22, 2015
NSTask Sample for Swift
View nstask.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 Jul 11, 2015
Keychain codesign information
View sc_find.py
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')
View ccswift20150324.swift
import Foundation
class MainScene: CCNode {
let audio:OALSimpleAudio = OALSimpleAudio.sharedInstance()
override func onEnter() {
audio.playBg("bgm.mp3", loop: true)
}
}
View ccswift20150102.swift
import Foundation
class MainScene: CCNode {
let audio:OALSimpleAudio = OALSimpleAudio.sharedInstance()
override func onEnter() {
self.userInteractionEnabled = true
View ccswift20150101.swift
import Foundation
class MainScene: CCNode {
override func onEnter() {
self.userInteractionEnabled = true
super.onEnter()
}
View CCSwift20141231_02.m
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";
View ccswift20141231.swift
var chara = CCSprite(imageNamed: "images/image.png")
View ccswift20141228.swift
import Foundation
class MainScene: CCNode {
override func onEnter() {
var winSize = CCDirector.sharedDirector().designSize
var chara = CCSprite(imageNamed: "images/image.png")
self.addChild(chara)
View SwiftSpriteSample01.swift
import Foundation
class MainScene: CCNode {
override func onEnter() {
var sp = CCSprite(imageNamed: "iPhone.png")
self.addChild(sp)
sp.position = ccp(200,200)
You can’t perform that action at this time.