Skip to content

Instantly share code, notes, and snippets.

View jobinlawrance's full-sized avatar

Jobin Lawrance jobinlawrance

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jobinlawrance on github.
  • I am jobinlawrance (https://keybase.io/jobinlawrance) on keybase.
  • I have a public key whose fingerprint is DFFC 50D3 6D39 0028 AB84 CFF1 A6BB ABB4 C8A1 DF91

To claim this, I am signing this object:

@jobinlawrance
jobinlawrance / extract.py
Created July 14, 2017 14:38
A python script to recursively extract .tar.gz files and .gz files
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""A command line utility for recusively extracting nested tar archives."""
__author__ = "Pushpak Dagade (पुष्पक दगड़े)"
__date__ = "$4 July, 2011 3:00:00 PM$"
import os
import sys
@jobinlawrance
jobinlawrance / extract.py
Created July 14, 2017 14:38
A python script to recursively extract .tar.gz files and .gz files
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""A command line utility for recusively extracting nested tar archives."""
__author__ = "Pushpak Dagade (पुष्पक दगड़े)"
__date__ = "$4 July, 2011 3:00:00 PM$"
import os
import sys
@jobinlawrance
jobinlawrance / extract.py
Created July 14, 2017 14:38
A python script to recursively extract .tar.gz files and .gz files : reference - http://guanidene.blogspot.in/2011/06/nested-tar-archives-extractor.html
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""A command line utility for recusively extracting nested tar archives."""
__author__ = "Pushpak Dagade (पुष्पक दगड़े)"
__date__ = "$4 July, 2011 3:00:00 PM$"
import os
import sys
@jobinlawrance
jobinlawrance / AndroidManifest.xml
Last active October 30, 2017 05:22
Custom Content Provider Example
<application>
<provider
android:name=".sqlite.TeamProvider"
android:authorities="com.jobinlawrance"
android:grantUriPermissions="true"
android:exported="true"/>
</application>
<!-- Handle uri permissions in a better way-->
@jobinlawrance
jobinlawrance / .gitignore
Last active November 27, 2017 16:38
Android Quick startup essentials
# Built application files
*.apk
!test-butler-app-1.3.1.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
@jobinlawrance
jobinlawrance / CrashingFragment.kt
Last active November 2, 2020 05:53
A fragment that crashes on recreation
class MainActivity : AppCompatActivity() {
val mainFragment = MainFragment("Ready to crash")
override fun onCreate(savedInstanceState: Bundle?) {
// the usual stuff
supportFragmentManager.beginTransaction()
.add(R.layout.fragmentContainerView, mainFragment)
.commit()
}
class MainActivity : AppCompatActivity() {
private val mainfactory = MainFragmentFactory("Now this won't crash")
private lateinit var mainFragment: MainFragment
override fun onCreate(savedInstanceState: Bundle?) {
supportFragmentManager.factory = mainfactory //This has to be done before super call
super.onCreate(savesInstanceState)
mainFragment = supportFragmentManager.fragmentFactory.instantiate(classLoader, MainFragmentFactory::class.java.name)
inline fun <reified T : Fragment> AppCompatActivity.fragmentFromFactory(): Lazy<T> {
return lazy {
supportFragmentManager.fragmentFactory.instantiate(classLoader, T::class.java.name) as T
}
}
class MainActivity : AppCompatActivity() {
private val mainFragment by fragmentFromFactory<MainFragment>()
override fun onCreate(savedInstanceState: Bundle?) {
setupKoinFragmentFactory() //This has to be done before super call
super.onCreate(savesInstanceState)
supportFragmentManager.beginTransaction()
.add(R.layout.fragmentContainerView, mainFragment)