Skip to content

Instantly share code, notes, and snippets.

Amitai Blickstein AmitaiB

Block or report user

Report or block AmitaiB

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
View NSObject+LogProperties.h
//
// NSObject+LogProperties.h
// JWPlayer-SDK-iOS-Demo
//
// Created by Amitai Blickstein on 6/15/19.
// Copyright © 2019 JWPlayer. All rights reserved.
//
#import <Foundation/Foundation.h>
@AmitaiB
AmitaiB / AudioInterruptionMonitor.swift
Created Jun 17, 2019
Elegant implementation of iOS Audio Interruption Notification subscription Monitor in Swift, from Quran.com
View AudioInterruptionMonitor.swift
//
// AudioInterruptionMonitor.swift
// QueuePlayer
//
// Created by Afifi, Mohamed on 4/29/19.
// Copyright © 2019 Quran.com. All rights reserved.
//
// originally DL'ed from https://github.com/quran/quran-ios/blob/master/QueuePlayer/AudioInterruptionMonitor.swift
import AVFoundation
@AmitaiB
AmitaiB / ConvertibleNumberType.swift
Created Feb 13, 2019
Drop-in, extendable Swift extension that allows for easy, clean number interoperability
View ConvertibleNumberType.swift
/**
* Give Int, CGFloats, and Floats a `doubleValue` property, like `NSNumber`.`doubleValue`
Original By Erica Sadun, (Swift Cookbook recipe 5-1), found here: https://gist.github.com/erica/2f6a38c844573c778b0f
Subsequent mutilations by Amitai Blickstein
*/
//: Numbers that convert to other types
public protocol ConvertibleNumberType: DoubleRepresentable, NumberInitAble {}
View SafeCollection.swift
// Not mine, forgot to whom to give the credit. :(
import Foundation
/// Allows `collection.safe.whatever`. Mimics usage of AVFoundation's `collection.lazy.whatever`
public struct SafeCollection<Base : Collection> {
private var _base: Base
public init(_ base: Base) {
_base = base
@AmitaiB
AmitaiB / EasyEmbedTask.html
Last active May 11, 2018
JWPLayer Assessment Tasks
View EasyEmbedTask.html
<!DOCTYPE html>
<html>
<head>
<script scr="https://content.jwplatform.com/libraries/uoBvlSmT.js"></script>
</head>
<body>
<div id='myPlayer'>Your Ad Here1</div>
<script type="text/javascript">
var player = jwplayer('myPlayer').setup({
@AmitaiB
AmitaiB / UITableViewCellStyle+PlainEnglishNames.swift
Created Nov 28, 2016
Replaces the opaque styles 'value1' and 'value2' with 'rightDetail' and 'leftDetail' respectively.
View UITableViewCellStyle+PlainEnglishNames.swift
//
// UITableViewCellExtensions.swift
// HealthBucks
//
// Created by Amitai Blickstein on 11/28/16.
// Copyright © 2016 Amitai Blickstein, LLC. All rights reserved.
//
import UIKit
@AmitaiB
AmitaiB / SwiftXOR.swift
Created Nov 17, 2016
Swift 3 Logical XOR Operator
View SwiftXOR.swift
precedencegroup BooleanPrecedence { associativity: left }
infix operator ^^ : BooleanPrecedence
/**
Swift Logical XOR operator
```
true ^^ true // false
true ^^ false // true
false ^^ true // true
false ^^ false // false
```
@AmitaiB
AmitaiB / llamaCamelCased.swift
Last active Mar 30, 2018
CamelCase - CamelCased and llamaCase - llamaCased extensions to String in Swift 3.0
View llamaCamelCased.swift
import UIKit
// Swift 3.0
// Helper
public extension Character {
public var stringValue: String { return String(self) }
}
extension String {
// MARK: - CamelCase
@AmitaiB
AmitaiB / snake_cased.swift
Last active Mar 30, 2018
Turns CamelCase and lamaCase strings into snakecase aka underscorecase (Swift 3.0)
View snake_cased.swift
// Swift 3.0
// snake_cased
import Foundation
extension String {
mutating func snake_cased() {
self = self.snake_case()
}
func snake_case() -> String {
@AmitaiB
AmitaiB / OptionalLiteralType.swift
Created Sep 28, 2016
Provides failable initializers for X-Literals, e.g., `String(suspectedString) // returns a String optional`, just like `String(5) // returns a String, "5"`
View OptionalLiteralType.swift
/*
Instead of, say:
if let definitelyAString = perhapsAString as? String { // yadda... }
We now have:
String(perhapsAString) // returns a String? (an optional)
*/
protocol OptionalLiteralType {
You can’t perform that action at this time.