Skip to content

Instantly share code, notes, and snippets.

View alexmx's full-sized avatar
🏴‍☠️
(╯°□°)╯︵ ┻━┻

Alex Maimescu alexmx

🏴‍☠️
(╯°□°)╯︵ ┻━┻
View GitHub Profile

Keybase proof

I hereby claim:

  • I am alexmx on github.
  • I am amaimescu (https://keybase.io/amaimescu) on keybase.
  • I have a public key ASBFZdW6cPj3g362RdExAzA9ompbGGbqAQDeQp_IdI7UcAo

To claim this, I am signing this object:

@alexmx
alexmx / remove-stale-local-branches.sh
Created June 19, 2019 16:47
Remove stale git local branches
git remote prune origin
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D
@alexmx
alexmx / swift-lint-modified-files.sh
Created August 21, 2018 18:54
Run SwiftLint against files which have been changed in the current branch relative to RELATIVE_BRANCH (eg. master)
#!/bin/bash
# Path to the repository root folder
REPO_ROOT_DIR=$1
# The branch name relative to which the modified files will be determined
RELATIVE_BRANCH=$2
# The path to the SwiftLint command.
SWIFT_LINT_PATH=$3
run_swiftlint() {
@alexmx
alexmx / carousel-pagination.swift
Created February 19, 2018 22:56
Sample carousel implementation which supports spacing, content mode and custom pagination.
#!/bin/bash
START=$(date +%s)
# Command to benchmark
END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)
echo "Time elapsed: $DIFF"
defaults write com.apple.dt.Xcode IDEDisableStructureEditingCoordinator -bool YES
@alexmx
alexmx / table-view-fill-footer.m
Created April 7, 2017 13:30
Adjust UITableView footer view to fill the whole remaining part of the screen.
@alexmx
alexmx / uibutton-icon-alignment.m
Created April 4, 2017 13:54
Set UIButton title icon alignment
- (void)layoutSubviews
{
[super layoutSubviews];
if (self.imageView.image) {
if (self.showIconOnTheRightSide) {
self.titleEdgeInsets = UIEdgeInsetsMake(self.titleEdgeInsets.top, -self.imageView.frame.size.width - self.titleIconSpacing,
self.titleEdgeInsets.bottom, self.imageView.frame.size.width + self.titleIconSpacing);
self.imageEdgeInsets = UIEdgeInsetsMake(self.imageEdgeInsets.top, self.titleLabel.frame.size.width + self.titleIconSpacing,
#ifndef AMXLog
#ifdef DEBUG
#define AMXLog(f...) NSLog(f)
#else
#define AMXLog(...)
#endif
#endif
echo ".config" >> .gitignore
git clone --bare [email protected]:alexmx/dotfiles.git $HOME/.dotfiles
function config {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .dotfiles-backup
config checkout