Skip to content

Instantly share code, notes, and snippets.

View mkchoi212's full-sized avatar
🎯
Focusing

Mike JS. Choi mkchoi212

🎯
Focusing
View GitHub Profile
@mkchoi212
mkchoi212 / Localizable.strings
Created April 18, 2019 18:30
Juice for macOS Empty Localization File
/*
Localizable.strings
Juice
Created by Mike Choi on 4/9/19.
Copyright © 2019 Mike JS. Choi. All rights reserved.
*/
// Menu Bar
"Control Center" = "";
import numpy as np
HORIZONTAL = 1
VERTICAL = 0
def first_nonzero(arr, axis, invalid_val=-1):
mask = arr!=0
return np.where(mask.any(axis=axis), mask.argmax(axis=axis), invalid_val)
def last_nonzero(arr, axis, invalid_val=-1):
@mkchoi212
mkchoi212 / VLCMediaPlayerTest.swift
Last active July 16, 2018 14:36
UI API called on a background thread problem while testing VLCMediaPlayer
class MockMediaPlayerDelegate: NSObject, VLCMediaPlayerDelegate {
let stateExpectation: XCTestExpectation?
init(stateExpectation: XCTestExpectation) {
self.stateExpectation = stateExpectation
}
func mediaPlayerStateChanged(_ aNotification: Notification!) {
guard let mediaPlayer = aNotification.object as? VLCMediaPlayer else {
@mkchoi212
mkchoi212 / VLCMediaNetworkingTest.swift
Created July 6, 2018 10:11
This is the ideal testing code to test VLCMedia::parse
func testLength() {
let tests: [(path: String, expected: VLCTime)] = [
("https://youtube.com/some_video_here", VLCTime(int: 12345)),
]
for (path, expected) in tests {
let media = VLCMedia(url: URL(string: path)!)
let expection = self.expectation(description: "mediaDidFinishParsing called")
let delegate = MockMediaDelegate(parseExpectation: expection)
media.delegate = delegate
@mkchoi212
mkchoi212 / UISwitchBackgroundViewBugDemo.swift
Last active June 19, 2018 02:53
UISwitch BackgroundView Bug Demo Playground File
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIStackView()
view.alignment = .center
view.distribution = .equalCentering
view.axis = .horizontal
view.backgroundColor = .black
@mkchoi212
mkchoi212 / testhelper.go
Created May 28, 2018 19:33
Go Test Helpers
package testhelper
import (
"fmt"
"path/filepath"
"reflect"
"runtime"
"testing"
)
So you just ran
git clone https://github.com/videolan/vlc-ios.git
after deciding that you want to contribute to VLC-iOS. First thing is first; '''welcome to the community 🎉.'''<br>
To get you settled in, here are couple of issues beginners tend to run into when first trying to build and run the app.
= Running VLC-iOS =
== Podfile ==
@mkchoi212
mkchoi212 / beginner-issues.md
Last active July 11, 2018 04:04
VLC-iOS Beginner Issues
@mkchoi212
mkchoi212 / generic_result_enum.swift
Created February 5, 2017 13:24
Simple generic version of result enums
enum Result<T> {
case Success(T)
case Error(ErrorType)
}
// Example function signitures
func findUserAddress(name: String) -> Result<String>
func findUserAge(name: String) -> Result<Int>
// IMPLEMENTATION
enum LookupError: ErrorType {
case InvalidName
case NullData
}
enum UserResult {
case Success(String)
case Error(LookupError)
}