Skip to content

Instantly share code, notes, and snippets.

View KelvinJin's full-sized avatar
🎯
Focusing

Jin Wang KelvinJin

🎯
Focusing
  • Uthoft
  • Melbourne
View GitHub Profile
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:6.00000,
#EXT-X-BITRATE:2060
https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/v5/fileSequence0.ts
#EXTINF:6.00000,
@KelvinJin
KelvinJin / om_validation.js
Created August 16, 2019 01:50
OM Validation JS
;(function(omidGlobal, factory, exports) {
// CommonJS support
if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
factory(omidGlobal, exports);
// If neither AMD nor CommonJS are used, export to a versioned name in the
// global context.
} else {
var exports = {};
var versions = ['1.2.17-iab1276'];
@KelvinJin
KelvinJin / om_service.js
Created August 14, 2019 04:28
OM Tracking JS
;(function(omidGlobal) {
'use strict';var k,aa='function'==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},m='undefined'!=typeof window&&window===this?this:'undefined'!=typeof global&&global?global:this;function ba(){ba=function(){};m.Symbol||(m.Symbol=ca)}var da=0;function ca(a){return'jscomp_symbol_'+(a||'')+da++}
function n(){ba();var a=m.Symbol.iterator;a||(a=m.Symbol.iterator=m.Symbol('iterator'));'function'!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});n=function(){}}function ea(a){var b=0;return fa(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function fa(a){n();a={next:a};a[m.Symbol.iterator]=function(){return this};return a}function p(a){n();ba();n();var b=a[Symbol.iterator];return b?b.call(a):ea(a)}
function q(a,b){function c(){}c.prototype=b.prototype;a.pa=b.prototype;a.prototype=new c;a.prototype.constructor=a;for(var d in b)if('proto
@KelvinJin
KelvinJin / sample_hls_android_tv_master.m3u8
Last active September 9, 2019 02:12
sample_hls_android_tv_master.m3u8
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-0",NAME="en (Main)",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="https://manifest.prod.boltdns.net/manifest/v1/hls/v5/aes128/5303576322001/7affc152-4e44-42af-8076-9200c5276050/0b240357-30a0-4f47-90a9-6aac5d343808/10s/rendition.m3u8?behavior_id=cce7c9bf-8bda-4c83-9e5c-9795a96fdf14&fastly_token=NWQ3NWM1MDRfZTY3ZmY0ZDVkMDNiNDJhYmQ0N2ZhZTY1NzY0MjlkMTBlYzkxNmJkYTBkMmU4ODFkY2ZlMGQ2ZTc2ZTU3NTU3Ng%3D%3D"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles-0",NAME="EN",DEFAULT=NO,LANGUAGE="en",URI="https://manifest.prod.boltdns.net/manifest/v1/hls/v5/clear/5303576322001/7affc152-4e44-42af-8076-9200c5276050/000a8d6d-49c4-434d-abb0-16739dc44c4b/rendition.m3u8?behavior_id=cce7c9bf-8bda-4c83-9e5c-9795a96fdf14&fastly_token=NWQ3NWM1MDRfMTc3YTdkNDE3MTJjYjQ0ZjY1Mjg1MzA0YmRmMTg4YzM2YmI3MmZjYTQwYTY4MTY1MWZlNjM2NWIxMjBiZGQwNQ%3D%3D"
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=289300,CODECS="mp4a.40.2,avc1.4d000c",RESOLUTION=256x144,AUDIO="audio-0",CLOSED-CAPTIONS=NONE,SU
@KelvinJin
KelvinJin / content.mpd
Last active April 17, 2019 03:18
android.tv
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT1H9M10.403S" minBufferTime="PT2.000S">
<Period id="0" duration="PT28S">
<AdaptationSet mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1" lang="en">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"></Role>
<SegmentTemplate initialization="https://ssaiplayback.ap-southeast-2.prod.boltdns.net/playback/once/redirect/v1/5303576322001/5b947f87-2c38-40f2-8591-caa404bcdb52/x109/$RepresentationID$/init0.m4f" media="https://ssaiplayback.ap-southeast-2.prod.boltdns.net/playback/once/redirect/v1/5303576322001/5b947f87-2c38-40f2-8591-caa404bcdb52/x109/$RepresentationID$/segment$Number$.m4f" startNumber="0" timescale="48000">
<SegmentTimeline>
<S d="95232" r="13"></S>
<S d="11264"></S>
</SegmentTimeline>
<Playlist>
<Preroll>
<Ad>
<![CDATA[https://gist.githubusercontent.com/KelvinJin/ff06196b6d981802372461971281f3da/raw/vast.xml]]>
</Ad>
<Ad>
<![CDATA[https://gist.githubusercontent.com/KelvinJin/ff06196b6d981802372461971281f3da/raw/vast.xml]]>
</Ad>
</Preroll>
<Midroll timeOffset="00:09:00">
@KelvinJin
KelvinJin / AttributedHTMLFont.swift
Created October 18, 2017 04:31 — forked from chrislonge/AttributedHTMLFont.swift
Attributed HTML With Custom Font Parsing (Playground)
import UIKit
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
let containerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 375.0, height: 667.0))
containerView.backgroundColor = UIColor.whiteColor()
XCPlaygroundPage.currentPage.liveView = containerView
var aboutTextView = UITextView(frame: CGRect(x: 12.0, y: 20.0, width: containerView.frame.size.width - 12.0, height: 200.0))
aboutTextView.textAlignment = .Left
interface RxBusSubscriber<in T> {
fun onReceived(notification: T)
}
open private class RxBusSubscriberHolder<out T>(t: T) {
private val ref: WeakReference<T> = WeakReference(t)
fun get(): T? = ref.get()
import UIKit
class SimpleCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var titleLabel: UILabel!
func bind(color: String) {
titleLabel.text = "\(arc4random_uniform(1000))"
backgroundColor = .clear
contentView.backgroundColor = color.hexColor
import UIKit
class ParallaxCollectionViewLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
return super.layoutAttributesForElements(in: rect)?.flatMap { $0.copy() as? UICollectionViewLayoutAttributes }.flatMap(addParallaxToAttributes)
}
private func addParallaxToAttributes(_ attributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
return attributes
}