Skip to content

Instantly share code, notes, and snippets.

View k06a's full-sized avatar
🚀
DeFi dreamer

Anton Bukov k06a

🚀
DeFi dreamer
View GitHub Profile
@k06a
k06a / git-rename-bunch-tags.sh
Last active March 14, 2016 19:48
git rename bunch tags
# Create and push new tags
for t in $(git tag | grep _); do git tag ${t//_//} $t; done
git push --tags
# Delete original tags
for t in $(git tag | grep _); do git tag -d $t && git push origin :refs/tags/$t; done
@k06a
k06a / reorder_attrs.sh
Last active April 5, 2016 11:33
Reorder property attributes script
#
# Reorder property attributes in one possible way
#
# @property (nullable, readonly, assign, nonatomic, getter=isReady) BOOL ready;
#
# 1. Move readonly to the BEGIN of attribute list
# 2. Move nullable to the BEGIN of attribute list
# 3. Move null_resettable to the BEGIN of attribute list
# 4. Move nonatomic to the END of attribute list
# 5. Move getter to the END of attribute list
@k06a
k06a / Bike.m
Created April 28, 2016 18:33 — forked from mgamer/Bike.m
contentsRect animation
#import <QuartzCore/QuartzCore.h>
#import "Bike.h"
@implementation Bike {
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
@k06a
k06a / fizzbuzz.cpp
Last active May 25, 2016 05:57 — forked from bgaff/fizzbuzz.cpp
FizzBuzz C++: Template Recursion
/*
* fizzbuzz.cpp
*
* Created on: Apr 25, 2012
* Author: Brian Geffon
*
* Modified on: May 25, 2016
* Author: Anton Bukov
*
* fizzbuzz solved without looping or conditionals using only template recursion.
@k06a
k06a / imageNamed.sh
Last active June 15, 2016 13:08
Xcode xcasset usage detector
set -eu -o pipefail
function show_code {
while read ERROR_LOCATION; do
echo "$ERROR_LOCATION:: error: Missing imageset with name $1"
done < <(find "$PROJECT_NAME" -name '*.m' -print0 | xargs -0 grep -n -o -e "\[UIImage imageNamed:@\"$1\"\]" | cut -d ':' -f 1,2)
}
function show_img {
echo -n $(find "$PROJECT_NAME" -name "$1.imageset")
@k06a
k06a / AutolayoutTableView.m
Created August 9, 2016 07:08
UITableView subclass with autolayoutable header and footer
@interface AutolayoutTableView : UITableView
@end
@implementation AutolayoutTableView
- (void)layoutSubviews {
[super layoutSubviews];
// Dynamic sizing for the header view
@k06a
k06a / gist:6ab1c52b6c0d63a659e46bfb414b8f92
Created September 9, 2016 09:21 — forked from podkovyrin/fix_xcode_plugins.sh
Update XCode plugins compatibility id
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
@k06a
k06a / Anchors.m
Last active November 9, 2016 20:18
Missing Anchors (1) on Medium.com
[statusBarBackground.edgesAnchor.withoutBottomAnchor constraintsEqualToConstant:UIEdgeInsetsZero].active = YES;
[statusBarBackground.heightAnchor constraintEqualToConstant:kStatusBarBackgroundHeight];
[commentLabel.centerYAnchor constraintEqualToAnchor:commentLabel.superView].active = YES;
[commentLabel.leadingAnchor.withTrailingAnchor constraintsLessThanOrEqualToConstant:UIEdgeInsetsMake(0, kCommentLeading, 0, kCommentTrailing)].active = YES;
@k06a
k06a / Active.m
Last active November 9, 2016 20:20
Missing Anchors (2) on Medium.com
@[
[statusBarBackground.edgesAnchor.withoutBottomAnchor constraintsEqualToConstant:UIEdgeInsetsZero],
[statusBarBackground.heightAnchor constraintEqualToConstant:kStatusBarBackgroundHeight],
].active = YES;
@[
[commentLabel.centerYAnchor constraintEqualToAnchor:commentLabel.superView],
[commentLabel.leadingAnchor.withTrailingAnchor constraintsLessThanOrEqualToConstant:UIEdgeInsetsMake(0, kCommentLeading, 0, kCommentTrailing)],
].active = YES;
@k06a
k06a / Active.m
Created November 9, 2016 20:21
Missing Anchors (3) on Medium.com
@[
@[
[statusBarBackground.edgesAnchor.withoutBottomAnchor constraintsEqualToConstant:UIEdgeInsetsZero],
[statusBarBackground.heightAnchor constraintEqualToConstant:kStatusBarBackgroundHeight],
],
@[
[commentLabel.centerYAnchor constraintEqualToAnchor:commentLabel.superView],
[commentLabel.leadingAnchor.withTrailingAnchor constraintsLessThanOrEqualToConstant:UIEdgeInsetsMake(0, kCommentLeading, 0, kCommentTrailing)],
],