Skip to content

Instantly share code, notes, and snippets.

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

Alex Maimescu alexmx

🏴‍☠️
(╯°□°)╯︵ ┻━┻
View GitHub Profile
@alexmx
alexmx / update-wwdr-certificate.sh
Created February 16, 2016 13:03
Update expired WWDR certificate
security delete-certificate -c "Apple Worldwide Developer Relations Certification Authority" ~/Library/Keychains/login.keychain
sudo security delete-certificate -c "Apple Worldwide Developer Relations Certification Authority" /Library/Keychains/System.keychain
curl -O -L http://developer.apple.com/certificationauthority/AppleWWDRCA.cer
security import AppleWWDRCA.cer -k ~/Library/Keychains/login.keychain -A
KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \
perl -p -e "s/($KEYWORDS)/ warning: \$1/"
if which TOOL >/dev/null; then
# Do something
else
echo "warning: TOOL not installed."
fi
git init --bare $HOME/.config
alias config='/usr/bin/git --git-dir=$HOME/.config/ --work-tree=$HOME'
config config --local status.showUntrackedFiles no
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
#ifndef AMXLog
#ifdef DEBUG
#define AMXLog(f...) NSLog(f)
#else
#define AMXLog(...)
#endif
#endif
@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,
@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.
defaults write com.apple.dt.Xcode IDEDisableStructureEditingCoordinator -bool YES
#!/bin/bash
START=$(date +%s)
# Command to benchmark
END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)
echo "Time elapsed: $DIFF"