Skip to content

Instantly share code, notes, and snippets.

View bananita's full-sized avatar

Michał Banasiak bananita

  • so many apps
  • Poland
View GitHub Profile
@bananita
bananita / .zshrc
Created April 20, 2022 11:29
.zshrc
eval "$(rbenv init - zsh)"
function parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
COLOR_DEF=$'%f'
COLOR_USR=$'%F{243}'
COLOR_DIR=$'%F{197}'
COLOR_GIT=$'%F{39}'
@bananita
bananita / .zshenv
Last active April 20, 2022 11:23
.zshenv
alias deeplink="xcrun simctl openurl booted"
alias ssh-keychain="ssh-add --apple-use-keychain ~/.ssh/id_rsa"
adb-killall () {
adb devices | grep emulator | while read line; do adb -s $line emu kill; done
}
@bananita
bananita / gist:7c95316f2f45dcf614655d0a0da40686
Created July 8, 2020 17:13
ignore local files without gitignore
git update-index --assume-unchanged FILENAME
git update-index --no-assume-unchanged FILENAME
rename 's/13-3-0/13-5-0/' */*
find . -type f -name '*.txt' -exec sed -i '' s/drutex/[email protected]/ {} +
@bananita
bananita / kill_all_simulators.sh
Created July 24, 2019 11:20
Kills all cloned zombie simlators
ps aux | grep _sim | grep -v grep | awk '{print $2}' | xargs kill -9 2>/dev/null
*~
FailedSnapshots
#*#
*orig
*_BACKUP_*
*_BASE_*
*_LOCAL*_
*_REMOTE*_
#!/bin/bash
echo Deleting merged branches...
#git pull
for b in $(git branch -a --merged develop);
do
branch=${b#"remotes/origin/"}
if [[ "$branch" == "develop" ]]; then
continue
fi
@bananita
bananita / gist:938b7f229e2773d9c9f6
Created December 16, 2015 19:30
uicolor -> uiimage
func imageFromColor(color: UIColor) -> UIImage {
let rect = CGRectMake(0, 0, 10, 10)
UIGraphicsBeginImageContext(rect.size)
let context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, rect);
let image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@bananita
bananita / random.swift
Created November 19, 2015 15:59
random color
func generateRandomColor() -> UIColor {
let hue : CGFloat = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
let saturation : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from white
let brightness : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from black
return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1)
}