Skip to content

Instantly share code, notes, and snippets.

View reime005's full-sized avatar
ℹ️

Marius Reimer reime005

ℹ️
View GitHub Profile
@reime005
reime005 / avd-create-start.sh
Created June 23, 2019 19:07
Create and Start an Android Emulator via the Command Line
# run `avdmanager create avd -h` for help
avdmanager create avd -n test -k "system-images;android-28;google_apis;x86" -b "x86" -c 512M
# start the `test` emulator
emulator @test
@reime005
reime005 / adb-commands-rn.sh
Last active June 23, 2019 19:18
Android Debug Bridge (ADB) commands specific to react native
# redirect your phones port (first argument) with your local computer's port (second argument)
adb reverse tcp:8081 tcp:8081
# initiate a bundle reload (specific to react native)
adb shell input text RR
# opens the device menu (specific to react native by shaking the device)
adb shell input keyevent KEYCODE_MENU
@reime005
reime005 / adb-commands.sh
Last active June 23, 2019 19:18
Android Debug Bridge (ADB) commands
# reconnect your device/phone connection
adb reconnect
# show the device log for a specific app / bundle id
adb logcat --pid=$(adb shell pidof -s com.mariusreimer.spaceviewer)
# copies the file from your machine to the device (may require 'adb root')
adb push <local> <remote>
# copies the file from the device to your machine (may require 'adb root')
@reime005
reime005 / settings.json
Created July 20, 2019 09:44
VSCode settings.json
{
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"explorer.openEditors.visible": 0,
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"workbench.statusBar.feedback.visible": false,
"files.autoSave": "onWindowChange",
"editor.fontSize": 16,
@reime005
reime005 / keybindings.json
Created July 20, 2019 09:45
VSCode keybindings.json
[
{
"key": "cmd+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
@reime005
reime005 / objc++.mm
Created August 11, 2019 12:07
ObjC++
#ifdef __cplusplus
#import "example.h"
#endif
@reime005
reime005 / rnobjc++.mm
Created August 11, 2019 12:19
React Native Objective C++ example
RCT_EXPORT_METHOD(
multiply:(nonnull NSNumber*)a
withB:(nonnull NSNumber*)b
withResolver:(RCTPromiseResolveBlock)resolve
withReject:(RCTPromiseRejectBlock)reject
)
{
long result = example::multiply([a longValue], [b longValue]);
resolve(@{
@reime005
reime005 / jni.java
Created August 11, 2019 13:41
React Native Android JNI
package com.mariusreimer.rncppcode;
...
class RNCPPCodeModule {
static {
try {
System.loadLibrary("cpp-code");
Log.d(TAG, "-------- libcpp-code: loaded");
} catch (Exception e){
Log.d(TAG, "-------- libcpp-code: loaded");
@reime005
reime005 / jni.cpp
Created August 11, 2019 13:45
React Native C++ JNI Adapter
#include <jni.h>
#include "example.h"
extern "C"
JNIEXPORT jlong JNICALL
Java_com_mariusreimer_rncppcode_RNCPPCodeModule_multiply(JNIEnv *env, jclass type, jlong a, jlong b) {
return example::multiply(a, b);
}
@reime005
reime005 / CMakeLists.txt
Created August 11, 2019 13:46
Android NDK C++ CMakeLists file
cmake_minimum_required(VERSION 3.4.1)
set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 11)
add_library(cpp-code
SHARED
../cpp-code/src/src/example.cpp
cpp-adapter.cpp
)