Skip to content

Instantly share code, notes, and snippets.

View Guang1234567's full-sized avatar
🌴
On vacation

GuangGuang Guang1234567

🌴
On vacation
View GitHub Profile
@RohanBhanderi
RohanBhanderi / Git_mergetool_commands
Last active March 13, 2024 12:16
Git Mergetool and difftool with Beyond Compare 4
//Git Mergetool and difftool with Beyond Compare 4
//For Windows
//IF running this command in git bash then escape $ with \
git config --global diff.tool bc4
git config --global difftool.bc4.cmd "\"C:/Program Files (x86)/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd "\"C:/Program Files (x86)/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\""
git config --global mergetool.bc4.trustExitCode true
@hamakn
hamakn / height.java
Created April 6, 2015 02:41
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
@wholmgren
wholmgren / use-bbdiff
Last active February 26, 2024 02:02
set git difftool to bbdiff
git config --global diff.tool bbdiff
git config --global difftool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"'
git config --global difftool.prompt false
git config --global merge.tool bbdiff
git config --global mergetool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"'
Double check ~/.gitconfig
@troystribling
troystribling / ProtocolAssociatedType.swift
Last active April 28, 2022 20:55
A swift protocol with associated type used as type parameter in generic function
protocol Thing {
typealias argType
func doit(val:argType) -> argType
}
class IntThing : Thing {
func doit(val: Int) -> Int {
return val + 1
}
}
@almozavr
almozavr / app_build.gradle
Created June 26, 2014 08:13
Workaround to bypass library's BuildConfig.DEBUG (always true, always release build type) via custom variable
// Application
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
@bmatcuk
bmatcuk / symbolizing_osx_crash_logs.md
Created May 29, 2014 21:43
How to symbolize OSX crash logs

How to Symbolize OSX Crash Logs

Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.

  1. Find your dSYM file.
    1. Assuming you are using xcode's archive functionality, open the Organizer window from the Window menu.
    2. Click the Archives tab.
    3. Right click on the appropriate build and select Show in Finder.
    4. When Finder opens, right click on the selected archive and select Show Package Contents.
    5. Navigate to the dSYM directory and copy the appropriate dSYM file to a temporary directory.
  2. Then navigate to Products, then Applications, and copy the app file to the same temporary directory.
@mpurbo
mpurbo / android-aar-maven-local.sh
Last active June 14, 2019 06:05
Installing Facebook SDK as aar to local maven repository
export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
cd facebook-android-sdk-3.14
gradle facebook:build
mv facebook/build/libs/facebook.aar facebook/build/libs/facebook-3.14.aar
mvn install:install-file -Dfile=facebook/build/libs/facebook-3.14.aar -DgroupId=com.facebook -DartifactId=android-sdk -Dversion=3.14 -Dpackaging=aar
@shawndumas
shawndumas / .gitconfig
Created August 5, 2013 19:08
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@pixelhandler
pixelhandler / pre-push.sh
Last active April 8, 2024 01:04
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@elentok
elentok / script_dir.sh
Created May 9, 2013 11:33
Current script directory (works in bash and zsh)
SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
SCRIPT_DIR=`cd $SCRIPT_DIR && pwd`