Skip to content

Instantly share code, notes, and snippets.

View erawhctim's full-sized avatar

Mitch Ware erawhctim

  • Atlanta, Georgia
View GitHub Profile
@pyricau
pyricau / graphviz.views.main.kts
Last active October 4, 2024 18:15
A Kotlin script that will explore & render the view hierarchy of any activity in the heap
#!/usr/bin/env kotlin -language-version 1.9
// Make sure you run "brew install kotlin graphviz" first.
@file:Repository("https://repo.maven.apache.org/maven2/")
@file:Repository("https://dl.google.com/dl/android/maven2/")
@file:DependsOn("com.squareup.leakcanary:shark-android:3.0-alpha-8")
import java.io.File
import shark.ActualMatchingReferenceReaderFactory
@daniellAlgar
daniellAlgar / Logger.kt
Last active March 28, 2020 10:36
This is a safe way to do logging in your Android apps without running the risk of having Log() statements in your production code. It reduces garbage collection and eliminates the need for a log tag.
package com.?
import android.os.Build
import android.util.Log
import com.varvet.shipgaz.BuildConfig
import java.util.regex.Pattern
/**
* A logger to avoid logging in production. It will check if [BuildConfig.DEBUG] is true or not.
* If true then allow logging, otherwise don't.
@normanlolx
normanlolx / iterm2-oh-my-fish.md
Last active May 5, 2024 13:53
iTerm2 Solarized Dark theme + Fish shell + oh-my-fish /// macOS High Sierra
@s4y
s4y / resolveWithTimeout.swift
Created February 9, 2015 00:47
NSNetService.resolveWithTimeout (with success callback)
extension NSNetService {
func resolveWithTimeout(timeout: NSTimeInterval, success: () -> ()) {
class NetServiceDelegate: NSObject, NSNetServiceDelegate {
let oldDelegate: NSNetServiceDelegate?
let netService: NSNetService
let success: () -> ()
var holdSelf: NetServiceDelegate?
init(netService: NSNetService, success: () -> ()) {
self.oldDelegate = netService.delegate
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active January 14, 2025 21:05
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gabrielemariotti
gabrielemariotti / Readme.md
Last active January 1, 2025 22:35
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@alexfu
alexfu / DividerItemDecoration.java
Last active February 9, 2023 05:09
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active February 18, 2025 18:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: