This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quick - utility class | |
public class Quick { | |
// Map | |
public interface IMapper<V, T> { | |
T each(V i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GCMCourier(apiKey) { | |
this.apiKey = apiKey; | |
this.push = function(notification, callback) { | |
var xhttp = new XMLHttpRequest(); | |
xhttp.onreadystatechange = function() { | |
if (xhttp.readyState==4) { | |
if (xhttp.status == 200) { | |
var output = xhttp.responseText; | |
callback && callback(true, output); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BATCH = function(options) { | |
var args = options.args, // arguments for method without callback | |
method = options.method, // method to be invoked | |
done = options.done, | |
each = options.each; | |
// validate options | |
if ( ! args || ! Array.isArray(args)) { | |
throw 'args is required and must be array'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic.swift | |
func setTimeout(delay:NSTimeInterval, block:()->Void) -> NSTimer { | |
return NSTimer.scheduledTimerWithTimeInterval(delay, target: NSBlockOperation(block: block), selector: #selector(NSOperation.main), userInfo: nil, repeats: false) | |
} | |
func setInterval(interval:NSTimeInterval, block:()->Void) -> NSTimer { | |
return NSTimer.scheduledTimerWithTimeInterval(interval, target: NSBlockOperation(block: block), selector: #selector(NSOperation.main), userInfo: nil, repeats: true) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImage { | |
var greyScaled:UIImage? { | |
let width = self.size.width | |
let height = self.size.height | |
let rect = CGRectMake(0, 0, width, height) | |
let colorSpace = CGColorSpaceCreateDeviceGray() | |
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.None.rawValue) | |
let context = CGBitmapContextCreate(nil, Int(width), Int(height), 8, 0, colorSpace, bitmapInfo.rawValue) | |
CGContextDrawImage(context, rect, self.CGImage!) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
func snapshot() -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(self.bounds.size, true, UIScreen.mainScreen().scale) | |
self.layer.renderInContext(UIGraphicsGetCurrentContext()!) | |
let img = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
return img | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic.swift | |
extension Notification.Name { | |
func post(object:Any? = nil, userInfo:[AnyHashable: Any]? = nil) { | |
NotificationCenter.default.post(self, object: object, userInfo: userInfo) | |
} | |
} | |
// DataModel.swift | |
extension Notification.Name { | |
static let AccountBalanceUpdated = Notification.Name("accountBalanceUpdated") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
extension AVPlayerItem { | |
enum TrackType { | |
case subtitle | |
case audio | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
setTimeout() | |
Shorthand method for create a delayed block to be execute on started Thread. | |
This method returns ``Timer`` instance, so that user may execute the block | |
within immediately or keep the reference for further cancelation by calling | |
``Timer.invalidate()`` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PromiseKitHelper.swift | |
// TrueID | |
// | |
// Created by Kittiphat Srilomsak on 3/21/2560 BE. | |
// Copyright © 2017 peatiscoding.me all rights reserved. | |
// | |
import PromiseKit |
OlderNewer