Skip to content

Instantly share code, notes, and snippets.

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@toe-lie
toe-lie / 1 ViewBindingDelegates.kt
Created February 5, 2023 22:36 — forked from gmk57/1 ViewBindingDelegates.kt
Kotlin delegates for Android View Binding with usage examples
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.viewbinding.ViewBinding
@toe-lie
toe-lie / NormalizeColor.kt
Created December 1, 2022 13:06
Normalize Color String
private fun normalizeColor(colorString: String?): String? {
if (colorString.isNullOrEmpty()) {
return null
}
if (isInvalidColor(colorString)) {
return null
}
return if (isValidColorByLength(colorString)) {
colorString
} else {
@toe-lie
toe-lie / ReadyToUse.kt
Last active August 14, 2020 14:02
Vector Drawable related code to support devices below 5.0
// To read vector drawable from xml attribute
val drawableResId = arr.getResourceId(R.styleable.GreenWayCountTextView_icon, -1)
if (drawableResId != -1) {
AppCompatResources.getDrawable(getContext(), drawableResId)?.let { drawable ->
setIcon(drawable)
}
}
// set drawable tint
@toe-lie
toe-lie / NotiBadgeCountView.kt
Last active August 4, 2020 05:34
Noti Badge Count View
package com.example.androidplayground
import android.content.Context
import android.content.res.Resources
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.ShapeDrawable
import android.graphics.drawable.shapes.RoundRectShape
import android.util.AttributeSet
@toe-lie
toe-lie / file_magic_numbers.md
Created June 29, 2018 16:15 — forked from leommoore/file_magic_numbers.md
File Magic Numbers

#File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

##Image Files