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
(global-hl-line-mode 1)
(set-face-background 'hl-line "#3e4446")
(set-face-foreground 'highlight nil)
(transient-mark-mode 1)
(set-face-background 'region "white")
(set-face-foreground 'region "blue")
(set-face-background 'highlight "white")
(set-face-foreground 'highlight "blue")
(setq make-backup-files nil)
@bananita
bananita / gist:3415194c2610e49a5bf9
Created February 26, 2014 13:41
date as build number
build_number=`date +%d.%m.%Y`
for x in `find ${SRCROOT}/Resources/Applications -name "Info.plist" -print`; do
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${build_number}" "$x"
done

Object-oriented languages

Assignment

In this assignment you should design and implement a minimal object-based programming language with delegation. It must be complete enough to

  • read instructions of arbitrary form (any human-readable format)
@bananita
bananita / gist:31ab0aaa3d4e17f3633e
Last active August 29, 2015 14:10
computing number of code lines
find . "(" -name "*.m" -or -name "*.mm" -or -name "*.h" -or -name "*.cpp" ")" -print0 | xargs -0 wc -l
@bananita
bananita / gist:0b5c79f8de16219da000
Created October 12, 2015 14:05
Check number of lines in git
#!/bin/bash
IFS=$'\n'
git log --format='%aN' | sort -u | while read -r user ; do
echo $user
git log --author=$user --pretty=tformat: --numstat -- . ":(exclude)*.pbxproj" ":(exclude)*.xcworkspace" ":(exclude)*.storyboard" ":(exclude)*.xib" ":(exclude)*Pods" ":(exclude)*Podfile.lock"| awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
done
@bananita
bananita / script.sh
Created November 4, 2015 13:54
bumbimp podspec version
#!/bin/bash
version=`grep -E "\.version\s*=\s*[\"']*[\"']" Registration.podspec | awk -v FS="('|')" '{print $2}'`
version=`echo $version | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}'`
echo $version
@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)
}
@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;
}
#!/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
*~
FailedSnapshots
#*#
*orig
*_BACKUP_*
*_BASE_*
*_LOCAL*_
*_REMOTE*_