View main.coffee
WebSocketServer = require("websocket").server | |
WebSocketClient = require("websocket").client | |
Http = require("http") | |
class ServerManager | |
constructor: -> | |
@server = {} | |
@webSocketServer = {} | |
startServer: -> |
View gist:936e5fac1e00e49fdd85
// どこかでNotificationを受け取れるようにする | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(hc_sdWebImageDownloadStopNotification:) | |
name:SDWebImageDownloadStopNotification | |
object:nil]; | |
// 通知を受け取る | |
- (void)hc_sdWebImageDownloadStopNotification:(NSNotification *)notification { | |
dispatch_main_async_safe(^{ |
View gist:ce9cd0e51f3022e07aff
#!/usr/bin/env ruby | |
require 'xcodeproj' | |
require 'plist' | |
class UpdateVersionManager | |
def initialize | |
path = File.expand_path("#{__dir__}/../") # absolute path to your project file | |
projects = Xcodeproj::Project.open(*Dir.glob("#{path}/*.xcodeproj")) | |
@base_path = path |
View gist:6cd5b915b759e60de389
/* とにかくモーダルを全部閉じる */ | |
// どこからでもOK | |
[[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:nil]; | |
// もしくはこちら | |
[[UIApplication sharedApplication].delegate.window.rootViewController dismissViewControllerAnimated:YES completion:nil]; | |
/* ある階層までのモーダルを閉じる */ |
View testApp.h
#import <CoreMotion/CoreMotion.h> | |
class testApp : public ofxiOSApp { | |
CMMotionManager *motionManager; | |
public: | |
void setup(); | |
void update(); | |
void draw(); | |
void exit(); |
View gist:7409269
.../* 勝手に狭まる要素に対して */ { | |
background: url(data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH/C1hNUCBEYXRhWE1QAz94cAAh+QQFAAAAACwAAAAAAQABAEACAkQBADs=); | |
} |
View APIKit+Rx.swift
import Foundation | |
import APIKit | |
import RxSwift | |
extension Session { | |
func rx_sendRequest<T: RequestType>(request: T) -> Observable<T.Response> { | |
return Observable.create { observer in | |
let task = self.sendRequest(request) { result in | |
switch result { | |
case .Success(let res): |
View RxCaptureMetadataOutputObjectsDelegateProxy.swift
import Foundation | |
import AVFoundation | |
import RxSwift | |
import RxCocoa | |
private let associatedkey = UnsafePointer<Void>(malloc(1)) | |
class RxCaptureMetadataOutputObjectsDelegateProxy: DelegateProxy, DelegateProxyType, AVCaptureMetadataOutputObjectsDelegate { | |
static func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { | |
(object as! AVCaptureMetadataOutput) |
View shuffle_lunch.coffee
# Description: | |
# シャッフルランチの管理をします | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
View NSString+Surrogate.swift
import Foundation | |
extension NSString { | |
func utf16IndexForIndex(index: Int) -> Int { | |
var index = index | |
var result = 0 | |
while result < index { | |
if result + 1 < self.length && | |
CFStringIsSurrogateHighCharacter(self.characterAtIndex(result)) && | |
CFStringIsSurrogateLowCharacter(self.characterAtIndex(result + 1)) { |
NewerOlder