Skip to content

Instantly share code, notes, and snippets.

View uberbruns's full-sized avatar

Karsten Bruns uberbruns

View GitHub Profile
<?php
/***********************************************************************************************
* Tweetledee - Incredibly easy access to Twitter data
* userrss.php -- User timeline results formatted as a RSS feed
* Version: 0.3.0
* Copyright 2013 Christopher Simpkins
* MIT License
************************************************************************************************/
/*-----------------------------------------------------------------------------------------------
==> Instructions:
@uberbruns
uberbruns / testassets.rb
Last active September 11, 2016 06:02
iOS Retina Assets Test
require 'fileutils'
path = ARGV[0]
ok = 0
fail = 0
Dir.glob("#{path}/*.png", File::FNM_DOTMATCH) do |f|
unless f.end_with? "@2x.png"
@uberbruns
uberbruns / BlankBackBarButtonText.m
Created October 18, 2013 19:22
A simple way to remove the backBarButtonTitle on iOS7.
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] init];
barButton.title = @"";
self.navigationItem.backBarButtonItem = barButton;
}
@uberbruns
uberbruns / UBRShiftRange
Created October 14, 2013 18:51
Calculates how a given NSRange is affected by replacing another range with a defined length in the same context. It's a little bit like `replaceCharactersInRange:withString:` but the receiver/result is not a string but a NSRange.
static inline NSRange UBRShiftRange(NSRange range, NSRange replacedRange, NSUInteger insertedLength) {
if (replacedRange.location > range.location + range.length) {
// Following
return range;
}
NSRange intersection = NSIntersectionRange(range, replacedRange);
@uberbruns
uberbruns / NonBouncingTableViewCell.m
Last active December 20, 2015 14:29
Makes the first row of an UITableView ignoring the bounce effect, like the gallery for highlights in the AppStore App.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y < 0) {
UIView * firstCell = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
firstCell.frame = ({
CGRect frame = firstCell.frame;
frame.origin.y = 0;
[_tableView.superview convertRect:frame toView:firstCell.superview];
});