Skip to content

Instantly share code, notes, and snippets.

@tuanchauict
tuanchauict / README.md
Last active January 15, 2023 12:31
Safari ebooks reader improvement

A simple script for adding a jump key (N / B) with two guidelines to help reading on PC easier.

The progress is also more trackable with page and percent

using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.IO.Packaging;
using System.Linq;
using System.Reflection;
@kamermanpr
kamermanpr / install-xcodeCLT-homebrew-git.md
Last active November 9, 2023 17:50
Install Xcode Command Line Tools, Homebrew, and Git on macOS

Install Xcode command line tools, Homebrew, and Git on macOS

Install the following apps on your mac running macOS:

  1. (standalone) Xcode Command Line Tools
  2. Homebrew
  3. Git

Modified from: https://www.moncefbelyamani.com

@insidegui
insidegui / gist:a18124c0c573a4eb656f5c485ea7dae4
Last active March 29, 2024 07:46
Unofficial documentation for the iCloud Apple device image URL format
https://statici.icloud.com/fmipmobile/deviceImages-9.0/iPhone/iPhone9,4-2-3-0/online-infobox__3x.png
A B C D E F G
A: deviceImages version seems to determine the format of the image specifier (C, D, E, F)
B: device marketing name
C: device model identifier
D: color cover glass (front color)
1 - Black
2 - White
E: device enclosure color (back color)
@wojteklu
wojteklu / clean_code.md
Last active May 4, 2024 08:34
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

adb shell << 'END'
run-as <package_id>
chmod 777 shared_prefs/<prefs_file_name>.xml
exit
cp /data/data/<package_id>/shared_prefs/<prefs_file_name>.xml /sdcard/Download/prefs.xml
exit
END
@tuanchauict
tuanchauict / README.md
Last active March 17, 2016 07:09
Revoke permissions for testing request permissions on android SDK >= 23
$ python3 revoke_permission.py
$ python3 revoke_permission.py <device_code>
@tuanchauict
tuanchauict / PermissionActivity.java
Last active March 14, 2016 15:00
Headless permissions request for Android 23+
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.SparseArray;
import java.util.ArrayList;
@tuanchauict
tuanchauict / AspectRatioFrameLayout.java
Created December 4, 2015 04:42
AspectRatioFrameLayout for Android
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.FrameLayout;
/**
* Created by tuanchauict on 11/18/15.
*/
public class AspectRatioFrameLayout extends FrameLayout {
private static final float DEFAULT_RATIO = 109.33f / 144f;
@tuanchauict
tuanchauict / ParseListLoader.java
Last active October 23, 2015 01:35
ParseListLoader is an universal version of ParseQueryAdapter that we can use it on both ListView/GridView and RecyclerView as well as ViewPager
/*
* Copyright (C) 2015 Tuan Chau (tuanchauict)
*
* 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