Skip to content

Instantly share code, notes, and snippets.

View mdaverde's full-sized avatar

Milan mdaverde

View GitHub Profile
package com.example.utils
import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.viewbinding.ViewBinding
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
@mdaverde
mdaverde / subclass.js
Last active August 29, 2015 14:00
Resig's subclass method
(function () {
var initializing = false,
superPattern = /xyz/.test(function () {
xyz;
}) ? /\b_super\b/ : /.*/;
Object.subClass = function (properties) {
var _super = this.prototype;
initializing = true;
var proto = new this();
/* Friendly timezone abbreviations in client-side JavaScript
`tzAbbr()` or `tzAbbr(new Date(79,5,24))`
=> "EDT", "CST", "GMT", etc.!
There's no 100% reliable way to get friendly timezone names in all
browsers using JS alone, but this tiny function scours a
stringified date as best it can and returns `null` in the few cases
where no friendly timezone name is found (so far, just Opera).