Skip to content

Instantly share code, notes, and snippets.

@inidamleader
inidamleader / AutoSizeText.kt
Last active July 4, 2024 20:03
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
/*
MIT License
Copyright (c) 2024 Reda El Madini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@y-polek
y-polek / doze_mode_adb_commands.sh
Last active May 30, 2024 22:25
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;