Skip to content

Instantly share code, notes, and snippets.

Takeru Chuganji chuganzy

Block or report user

Report or block chuganzy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chuganzy
chuganzy / gist:7409269
Last active Jan 17, 2019
Androidで要素の幅が勝手に狭まる http://blog.ganzy.jp/css/12
View gist:7409269
.../* 勝手に狭まる要素に対して */ {
background: url(data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH/C1hNUCBEYXRhWE1QAz94cAAh+QQFAAAAACwAAAAAAQABAEACAkQBADs=);
}
@chuganzy
chuganzy / testApp.h
Last active Jan 17, 2019
openFrameworks for iOSでデバイスの姿勢を取得する http://blog.ganzy.jp/cpp/64
View testApp.h
#import <CoreMotion/CoreMotion.h>
class testApp : public ofxiOSApp {
CMMotionManager *motionManager;
public:
void setup();
void update();
void draw();
void exit();
@chuganzy
chuganzy / gist:6cd5b915b759e60de389
Last active Jan 17, 2019
モーダルで開いたUIViewControllerを一気に閉じる http://blog.ganzy.jp/objective-c/133
View gist:6cd5b915b759e60de389
/* とにかくモーダルを全部閉じる */
// どこからでもOK
[[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:nil];
// もしくはこちら
[[UIApplication sharedApplication].delegate.window.rootViewController dismissViewControllerAnimated:YES completion:nil];
/* ある階層までのモーダルを閉じる */
@chuganzy
chuganzy / main.coffee
Last active Jan 17, 2019
ofxLibwebsocketsからHerokuに接続できない http://blog.ganzy.jp/javascript/146
View main.coffee
WebSocketServer = require("websocket").server
WebSocketClient = require("websocket").client
Http = require("http")
class ServerManager
constructor: ->
@server = {}
@webSocketServer = {}
startServer: ->
@chuganzy
chuganzy / gist:936e5fac1e00e49fdd85
Last active Jan 17, 2019
SDWebImageのcompleteBlockが呼ばれないことがある http://blog.ganzy.jp/objective-c/191
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(^{
@chuganzy
chuganzy / gist:ce9cd0e51f3022e07aff
Last active Jan 17, 2019
iOSプロジェクトの全ターゲットのバージョンを一気に上げる http://blog.ganzy.jp/objective-c/219
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
@chuganzy
chuganzy / gist:38c0b13068992ffe20e9
Last active Aug 29, 2015
OS X ServerでXcodeの設定をするとオフにしていても_xcsbuilddが勝手にログイン状態になる
View gist:38c0b13068992ffe20e9
sudo xcrun xcscontrol --reset
@chuganzy
chuganzy / gist:1f74224d7c62f01654ec
Last active Aug 29, 2015
xcdatamodeldからSwiftのコードをいい感じに吐く
View gist:1f74224d7c62f01654ec
#!/usr/bin/env ruby
require 'nokogiri'
require 'colorize'
require 'erubis'
class Manager
class SwiftConverter
def to_swift
raise 'Error: method `to_swift` is not implemented'
@chuganzy
chuganzy / gist:85743eee8609a80dd35a
Last active Sep 7, 2015
uuid_generate_time in Swift
View gist:85743eee8609a80dd35a
extension NSUUID {
class func timeBasedUUID() -> NSUUID {
let uuidSize = sizeof(uuid_t)
let uuidPointer = UnsafeMutablePointer<UInt8>.alloc(uuidSize)
uuid_generate_time(uuidPointer)
let uuid = NSUUID(UUIDBytes: uuidPointer)
uuidPointer.dealloc(uuidSize)
return uuid
}
}
View gist:649abb7aa6cea5af6d00
struct Person {
let name: String
func isValid() -> Bool {
return !name.characters.isEmpty
}
}
let validPerson = Person(name: "Tom")
let invalidPerson = Person(name: "")
You can’t perform that action at this time.