Skip to content

Instantly share code, notes, and snippets.

View MacKentoch's full-sized avatar
👨‍💻

Erwan DATIN MacKentoch

👨‍💻
  • France
View GitHub Profile

React hook - class lifecycle equivalences

State

//Class
class CounterButton extends Component {
  state = {
    count: 0
  };

unpair wearOS watch wihtout performing factory reset (and without root)

1- Wear is connected with phone A (old phone or the same phone before a factory reset) so turn off Bluetooth on this phone.

2- enable developer mode on watch, manually go:

  • settings > system > about and tap build version 10 times

3- reset previously paired phone (phone A) then watch will restart:

adb shell "pm clear com.google.android.gms && reboot"

Keybase proof

I hereby claim:

  • I am mackentoch on github.
  • I am mackentoch (https://keybase.io/mackentoch) on keybase.
  • I have a public key ASB0Hk9qaahfTSsmFVxY9k4WYxldni5GdhrXSEL9gnDgcwo

To claim this, I am signing this object:

@MacKentoch
MacKentoch / android-adb-pull-apk.md
Created February 11, 2019 13:51 — forked from ctrl-freak/android-adb-pull-apk.md
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

import { Dimensions, Platform, StatusBar } from 'react-native';
// NOTE:
// const iPhoneXSMax = { width: 414, height: 896 };
// const iphoneXS = { width: 375, scale: 3, height: 812 };
// const iphoneXR = { width: 414, height: 896 };
export function isIphoneX() {
const dimen = Dimensions.get('window');
return (
@MacKentoch
MacKentoch / Alamofire-JSON-Serialization.md
Created July 11, 2018 16:16 — forked from jpotts18/Alamofire-JSON-Serialization.md
Alamofire JSON Serialization of Objects, Collections, Nesting

Alamofire JSON Serialization of Objects and Collections

Alamofire is a great Swift library developed by the creator of AFNetworking @mattt. The purpose of this gist is to explain how to use the built-in power of Alamofire to serialize your JSON. In this example we will be serializing a simple blog API. First we will start with serializing a single JSON object and add complexity as we go along.

Warning: This was written before Swift 1.2

A Single JSON Serialization

This is the first JSON object that we will be serializing.

{
// coding style and xp:
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.autoClosingBrackets": true,
// npm scripts
"npm.enableScriptExplorer": true,
// search:
"search.exclude": {
"**/node_modules": true,
{
// coding style and xp:
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.autoClosingBrackets": true,
// search:
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"jspm_package": true,

In ROOT_PROJECT/ios directory:

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
function ajoute2(nombre) {
return nombre + 2;
}
console.log('quatre: ', ajoute2(2));
console.log('six: ', ajoute2(ajoute2(2)));