Skip to content

Instantly share code, notes, and snippets.

bastami82 / cloneAllBranchesFromGitRepoCommand.txt
Last active Sep 5, 2020
clone all branches of git repository
View cloneAllBranchesFromGitRepoCommand.txt
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
bastami82 / Vim basic commands
Last active Jun 11, 2020
reminder of Vim commands to prevent me google it every time !
View Vim basic commands
There are two Modes: Insert and Command:
1. to go o Insert mode -> Press `i`
2. to switch back to Command mode -> pres `esc`
x - to delete the unwanted character
u - to undo the last the command and U to undo the whole line
CTRL-R to redo
A - to append text at the end
bastami82 / gist:ef5987b79353978223b74257f42c09c9
Last active Apr 4, 2018
set drwabale icon backward compatible
View gist:ef5987b79353978223b74257f42c09c9
THE_VIEW.setBackgroundDrawable(AppCompatResources.getDrawable(ctx, R.drawable.ic_report_review);
//with drwable left
THE_VIEW.setCompoundDrawablesWithIntrinsicBounds(AppCompatResources.getDrawable(ctx, R.drawable.ic_report_review), null, null, null);
bastami82 /
Created Jan 3, 2018
using Android handler as a timer to check a condition
private Runnable runnable;
private Handler handler;
private boolean condition;
runnable = () -> {
if (condition) {
handler.removeCallbacks(runnable); //stop handler
} else {
handler.postDelayed(runnable, 500); //check a condition every half a second (until condition is met)