Skip to content

Instantly share code, notes, and snippets.

View Guang1234567's full-sized avatar
🌴
On vacation

GuangGuang Guang1234567

🌴
On vacation
View GitHub Profile
@jk2K
jk2K / extract_realm_database_android.sh
Last active February 22, 2023 15:04 — forked from medyo/extract_realm_database_android.sh
how to export realm database, work on Android 5.0+
#!/bin/bash
ADB_PATH="/Users/lee/Library/Android/sdk/platform-tools"
PACKAGE_NAME="com.yourcompany.app"
DB_NAME="default.realm"
DESTINATION_PATH="/Users/lee/Downloads/${DB_NAME}"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Make sure a device is connected"
else
@orange1988
orange1988 / Android 命名规范.md
Last active December 19, 2022 03:43
Android 命名规范

在讲解命名规范前,先初略介绍下当前主要的标识符命名法和英文缩写规则。

标识符命名法

标识符命名法最要有四种:

  1. 驼峰(Camel)命名法:又称小驼峰命名法,除首单词外,其余所有单词的第一个字母大写。
  2. 帕斯卡(pascal)命名法:又称大驼峰命名法,所有单词的第一个字母大写
  3. 下划线命名法:单词与单词间用下划线做间隔。
  4. 匈牙利命名法:广泛应用于微软编程环境中,在以Pascal命名法的变量前附加小写序列说明该变量的类型。 量的取名方式为:<scope_> + <prefix_> + 范围前缀,类型前缀,限定词。
@subfuzion
subfuzion / README.md
Last active April 11, 2024 14:52
vim/neovim configuration

I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.

It's currently synchronized with my .vimrc config except for a block of neovim-specific terminal key mappings.

This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.

These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,

@harlanhaskins
harlanhaskins / trace.swift
Created October 6, 2016 17:50
Pure Swift stack trace
struct StackFrame {
let symbol: String
let file: String
let address: UInt64
let symbolAddress: UInt64
var demangledSymbol: String {
return _stdlib_demangleName(symbol)
}
}
@kakajika
kakajika / ScopeFuncs.swift
Last active June 21, 2023 13:11
A port of Kotlin's scope functions to Swift.
protocol ScopeFunc {}
extension ScopeFunc {
@inline(__always) func apply(block: (Self) -> ()) -> Self {
block(self)
return self
}
@inline(__always) func letIt<R>(block: (Self) -> R) -> R {
return block(self)
}
}
@109021017
109021017 / current_activity.sh
Created February 3, 2016 09:32
A shell script log the current android top activity
oldActvity=""
displayName=""
currentActivity=`adb shell dumpsys window windows | grep -E 'mCurrentFocus'`
while true
do
if [[ $oldActvity != $currentActivity && $currentActivity != *"=null"* ]]; then
displayName=${currentActivity##* }
displayName=${displayName%%\}*}
echo $displayName
oldActvity=$currentActivity
@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 17, 2024 15:37
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@sharplet
sharplet / trap.swift
Created November 23, 2015 03:46
Simple signal handling in Swift
import Darwin
enum Signal: Int32 {
case HUP = 1
case INT = 2
case QUIT = 3
case ABRT = 6
case KILL = 9
case ALRM = 14
case TERM = 15
@Diolor
Diolor / BroadcastObservable.java
Last active January 13, 2021 09:26
Retry with Connection
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Looper;
import rx.Observable;
import rx.Scheduler;
@TWiStErRob
TWiStErRob / SquareFrameLayout.java
Created September 30, 2015 23:33
Make GridView or GridLayoutManager items square.
package net.twisterrob.android.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
public class SquareFrameLayout extends FrameLayout {
public SquareFrameLayout(Context context) {
super(context);
}