Skip to content

Instantly share code, notes, and snippets.

View yimajo's full-sized avatar
:octocat:

Yoshinori Imajo yimajo

:octocat:
View GitHub Profile
@tks2shimizu
tks2shimizu / HelloWorldScene.cpp
Last active October 13, 2015 18:38
card game 25 source code 1
#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"
using namespace cocos2d;
using namespace CocosDenshion;
using namespace std;
CCScene* HelloWorld::scene()
{
CCScene* scene = CCScene::create();
@laiso
laiso / AppDelegate.m
Last active August 29, 2015 14:04
UIViewController+ClassNameOverlay
#ifdef DEBUG
#import "UIViewController+ClassNameOverlay.h"
#endif
@chriseidhof
chriseidhof / swift.tex
Created October 8, 2014 13:44
Listings Swift config
\lstdefinelanguage{swift}
{
morekeywords={
func,if,then,else,for,in,while,do,switch,case,default,where,break,continue,fallthrough,return,
typealias,struct,class,enum,protocol,var,func,let,get,set,willSet,didSet,inout,init,deinit,extension,
subscript,prefix,operator,infix,postfix,precedence,associativity,left,right,none,convenience,dynamic,
final,lazy,mutating,nonmutating,optional,override,required,static,unowned,safe,weak,internal,
private,public,is,as,self,unsafe,dynamicType,true,false,nil,Type,Protocol,
},
morecomment=[l]{//}, % l is for line comment
@kaiinui
kaiinui / NSURLSession の挙動.md
Last active March 7, 2017 04:38
NSURLSession の挙動

語彙

  • NSURLSession: OS の NSURLSession Daemon とのコネクションを管理するインスタンス。大体アプリにつき一つ。Singleton で OK. Delegate はこいつに紐づく。
  • NSURLSessionTask: 「リクエスト一つ」に対応。ただし OS 直属の NSURLSession Daemon に管理が委ねられる。

動き

  1. NSURLSession を初期化
@eonist
eonist / TranslucentWin.swift
Created January 27, 2016 14:09
Translucent NSWindow Example
class TranslucentWin:NSWindow, NSApplicationDelegate, NSWindowDelegate{
/**
*
*/
override init(contentRect: NSRect, styleMask aStyle: Int, backing bufferingType: NSBackingStoreType, `defer` flag: Bool) {
super.init(contentRect: Win.sizeRect, styleMask: NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask|NSFullSizeContentViewWindowMask, backing: NSBackingStoreType.Buffered, `defer`: false)
self.contentView!.wantsLayer = true;/*this can and is set in the view*/
self.backgroundColor = NSColor.greenColor().alpha(0.2)
self.opaque = false
self.makeKeyAndOrderFront(nil)//moves the window to the front
@NinoScript
NinoScript / EnumNSCoding.swift
Last active December 2, 2019 10:47
NSCoding a Swift Enum
//: Playground - noun: a place where people can play
import Cocoa
enum Enum {
case SimpleCase
case AssociatedValue(String)
case AnotherAssociated(Int)
}
extension Enum {
@lattner
lattner / async_swift_proposal.md
Last active October 29, 2024 18:53 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@CollectiveHealth-gists
CollectiveHealth-gists / rxSwiftTask.swift
Created August 8, 2017 18:50
RxSwift Download Image from Url
URLSession.shared.rx
.response(imageURL)
// subscribe on main thread
.subscribeOn(MainScheduler.sharedInstance)
.subscribe(onNext: { [weak self] data in
// Update Image
self?.imageView.image = UIImage(data: data)
}, onError: {
// Log error
}, onCompleted: {
@sile
sile / rfc.md
Last active June 2, 2022 15:19
Rustの『RFC 2033: 実験的なコルーチン』の要約メモ
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {