Skip to content

Instantly share code, notes, and snippets.

@inidamleader
inidamleader / AutoSizeText.kt
Last active April 23, 2024 17:21
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
// LAST UPDATE: 10 April 2024 v4.3:
// - Correction of updated density value in AutoSizeText function
package com.inidamleader.ovtracker.util.compose
import android.util.Log
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.InternalFoundationTextApi
@y-polek
y-polek / doze_mode_adb_commands.sh
Last active April 20, 2024 09:36
adb commands to test Doze mode
#! /bin/zsh
# Buttery powered state
adb shell dumpsys battery | grep powered
# Unplug battery
adb shell dumpsys battery unplug
# Reset battery
adb shell dumpsys battery reset
@lucholaf
lucholaf / gist:e37f4d26e406250a156a
Last active September 5, 2016 15:06
Xcode pre-action: generate Swift FAT file to reduce compilation time, since it's faster to recompile the whole source code in a single file
> $PROJECT_DIR/merge.swift; find $PROJECT_DIR/ -iname *.swift -not -name merge.swift -exec cat {} >> $PROJECT_DIR/merge.swift \;
@lucholaf
lucholaf / iOS dev notes
Created November 20, 2014 13:45
iOS dev notes
WWDC 2013 - #???: What's new in Foundation Networking
-----------------------------------------------------
. NSURLConnection, configured through NSURLRequest. Has a global storage for cookies, cache, etc.
. NSURLSession, replaces NSURLConnection, per object configurable.
. Uploads/Downloads through the filesystem. Can be done Out-of-process, but not a regular data request.
. NSURLSessionTask per request, represents the status and progress. Cancel, Suspend, Resume.
. Per session policies: cache, cookies, credentials.
. backgroundSessionConfiguration
. Background Transfers
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
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:

@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@akhenakh
akhenakh / NBNet.m
Last active March 5, 2017 01:45
Download image and update using NSURLSession
@interface NBNet()
@property(nonatomic, strong) NSURLSession *imageSession;
@property(nonatomic, strong) NSOperationQueue *netOperationQueue;
@end
@implementation NBNet
+ (id)sharedNBNet {
static NBNet *sharedNBNet = nil;
static dispatch_once_t onceToken;