This file contains hidden or 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 UIKit | |
import AVFoundation | |
class ZBSimpleRecorder: NSObject { | |
var audioEngine: AVAudioEngine? | |
var file: ExtAudioFileRef? | |
func start(fileURL:URL) { |
This file contains hidden or 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 <Foundation/Foundation.h> | |
@interface KKSimpleAirPlay2Player : NSObject | |
- (id)initWithURL:(NSURL *)inURL; | |
- (void)play; | |
- (void)pause; | |
@property (readonly, getter=isStopped) BOOL stopped; | |
@end |
This file contains hidden or 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 playlistMoreAction = { | |
id: "com.kkbox.k2y", | |
title: "View Videos in the Playlist on Youtube", | |
type: "playlist_more", | |
action: function(playlist) { | |
var playlistID = playlist["id"] | |
var url = "http://k2y.herokuapp.com/playlist/" + encodeURIComponent(playlistID) | |
openURL(url) | |
} | |
} |
This file contains hidden or 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 UIKit | |
import PlaygroundSupport | |
class SampleTableViewController : UITableViewController { | |
var selectedIndexPath: IndexPath? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") | |
} |
This file contains hidden or 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
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7') | |
import groovyx.net.http.HTTPBuilder | |
import groovyx.net.http.HttpResponseException | |
import static groovyx.net.http.ContentType.* | |
import groovy.json.JsonBuilder | |
def post_to_slack = { | |
token, text, channel, domain, username, icon_emoji -> | |
def site = "https://${domain}.slack.com/" | |
println site |
This file contains hidden or 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 url(http://fonts.googleapis.com/earlyaccess/cwtexhei.css); | |
body { | |
font-family: Helvetica, "Noto Sans CJK TC", cwTeXHei, sans-serif !important; | |
font-size: 10pt !important; | |
} | |
.CodeMirror { | |
width: auto !important; /*override the width below*/ | |
width: 100%; |
This file contains hidden or 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 UIKit | |
import StoreKit | |
import MediaPlayer | |
class AppleProductPlayer: NSObject { | |
func play(productID: String) { | |
SKCloudServiceController.requestAuthorization { status in | |
let cloudServiceController = SKCloudServiceController() | |
cloudServiceController.requestCapabilitiesWithCompletionHandler { cloudServiceCapability, error in | |
if cloudServiceCapability.contains(.AddToCloudMusicLibrary) { |
This file contains hidden or 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
// | |
// CustomNVToolBarVC.m | |
// customToolBar | |
// | |
#import "CustomNVToolBarVC.h" | |
#import <objc/runtime.h> | |
@interface UIToolbar (Override) | |
@property (strong, nonnull, nonatomic) UIView *targetView; |
This file contains hidden or 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 Foundation | |
import AudioToolbox | |
class KKSimplePlayer: NSObject { | |
var URL: NSURL | |
var URLSession: NSURLSession! | |
var packets = [NSData]() | |
var audioFileStreamID: AudioFileStreamID = nil | |
var outputQueue: AudioQueueRef = nil | |
var streamDescription: AudioStreamBasicDescription? |
This file contains hidden or 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
MAP = {",": ".", "!": "?", "(": ")", "{": "}", "[": "]", "<": ">", "@": "#", | |
";": ":", ".": ",", "?": "!", ")": "(", "}": "{", "]": "[", ">": "<", | |
"#": "@", ":": ";"} | |
c_t = lambda x: ''.join(c.swapcase() for c in x.group(0)[::-1]) | |
def twist(text): | |
import re | |
text = re.sub(r'[a-zA-Z]*', c_t, text) | |
text = re.sub(r'\s+', ' ', text) | |
text = re.sub(r'[0-9]', lambda x: str(9 - int(x.group(0))), text) | |
text = re.sub('[!#$%&()*+,-./:;<=>?@[\]^_`{|}~]', |