Skip to content

Instantly share code, notes, and snippets.

View muukii's full-sized avatar
✈️
We live in a twilight world.

Hiroshi Kimura muukii

✈️
We live in a twilight world.
View GitHub Profile
private struct FavoritesModelConnectingType: RawOptionSetType {
private var value: UInt = 0
init(_ value: UInt) {
self.value = value
}
// MARK: RawOptionSetType
static func fromMask(raw: UInt) -> FavoritesModelConnectingType {
return self(raw)
}
@muukii
muukii / UserDefaults.swift
Created February 1, 2015 15:23
UserDefaults
// UserDefaults.swift
//
// Copyright (c) 2015 muukii
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@muukii
muukii / fixOrientation.swift
Created September 8, 2015 00:59
fix orientation
extension UIImage {
func fixOrientation () -> UIImage {
if self.imageOrientation == .Up {
return self
}
var transform = CGAffineTransformIdentity
let width = self.size.width
let height = self.size.height
switch (self.imageOrientation) {
@muukii
muukii / GLKCIImageView.swift
Created September 28, 2015 05:39
CIImageView (Using GLKit)
//
// GLKCIImageView.swift
// Fil
//
// Created by Muukii on 9/1/15.
// Copyright © 2015 muukii. All rights reserved.
//
import Foundation
import GLKit
@muukii
muukii / abc.js
Created December 6, 2013 15:43
test.js
console.log('abc');
extension Realm {
public var queue: NSOperationQueue {
get {
if let queue = objc_getAssociatedObject(self, &StoredPropaties.queue) as? NSOperationQueue {
return queue
}
let queue = self.createDefaultQueue()
self.queue = queue
// MainStore: Realm
MainStore.writeBackground(
{ (store: Realm) in
let photos: [Photo] = json.arrayValue.map { json in
let photo = Photo()
photo.update(json)
return photo
}
store.add(photos, update: true)
// App Module
class MyAppClass {
class NestedClass { }
}
// Module
class MyModuleClass {
class NestedClass {}
}
public protocol Instantiatable: class {
static func instantiate() -> Self
}
public protocol InstantiatableFromXIB: Instantiatable {
}
public protocol InstantiatableFromStoryboard: Instantiatable {
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#