Skip to content

Instantly share code, notes, and snippets.

View radianttap's full-sized avatar
馃
路 路 路

Aleksandar Vaci膰 radianttap

馃
路 路 路
View GitHub Profile
@radianttap
radianttap / TableHeaderFooterView.bgcolor
Created October 11, 2017 10:57
I would love to know the reasons for this. Must be quite a big technical debt for the hard-coded behavior since iPhone OS 2.
[TableView]
Setting the background color on UITableViewHeaderFooterView has been deprecated.
Please set a custom UIView with your desired background color to the backgroundView property instead.
@radianttap
radianttap / fall17.sh
Created September 18, 2017 12:27
Script to download Fall 2017 HD videos
#!/bin/bash
#Setup the environnement
mkdir fall2017
cd fall2017
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
@radianttap
radianttap / wwdc17.sh
Created June 7, 2017 09:57
Bash script to download all HD videos + PDF slides for WWDC 2017
#!/bin/bash
#Setup the environnement
mkdir wwdc2017
cd wwdc2017
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
@radianttap
radianttap / human.swift.motemplate
Last active November 13, 2016 14:57 — forked from JoshuaSullivan/human.swift.motemplate
Better mogenerator Swift 3 templates, using code very similar to what Xcode produces but with mogenerator goodies on the top
import Foundation
import CoreData
@objc(<$managedObjectClassName$>)
public class <$managedObjectClassName$>: <$customSuperentity$> {
// MARK: - Life cycle methods
public override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?) {
super.init(entity: entity, insertInto: context)
double ToRadians(double degrees) { return degrees * M_PI / 180; }
- (NSNumber *)geoDistanceFromLat:(CLLocationDegrees)lat1 fromLon:(CLLocationDegrees)lng1 toLat:(CLLocationDegrees)lat2 toLon:(CLLocationDegrees)lng2 {
CLLocationDistance EarthRadiusInMeters = 6367000.0;
CLLocationDistance distance = EarthRadiusInMeters * 2 *
asin(fmin(1, sqrt((pow(sin((ToRadians(lat2) - ToRadians(lat1)) / 2.0),2.0)
+
cos(ToRadians(lat1)) * cos(ToRadians(lat2))
@radianttap
radianttap / versioning
Created September 12, 2014 10:11
Xcode versioning based on git tags and number of builds
# Get the version number from the tag in git and the number of commits as the build number
#
appVersion=$(git describe --long | cut -f 1 -d "-")
appBuild=$(git describe --long | cut -f 2 -d "-")
#gitHash=$(git describe --long | cut -f 3 -d "-")
echo "From GIT Version = $appVersion Build = $appBuild"
#
# Set the version info in plist file
#
@radianttap
radianttap / wwdchd.sh
Created June 4, 2014 09:14
Download HD session from WWDC 2014
curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g' | xargs -n1 wget -N
- (void)preferredContentSizeChanged:(NSNotification *)aNotification
{
UITextView *textView = <the text view holding your attributed text>
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:textView.attributedText];
NSRange range = NSMakeRange(0, attributedString.length - 1);
// Walk the string's attributes
[attributedString enumerateAttributesInRange:range options:NSAttributedStringEnumerationReverse usingBlock:
^(NSDictionary *attributes, NSRange range, BOOL *stop) {
@radianttap
radianttap / dynamictypefontsize
Created January 7, 2014 18:36
Dynamic Type size for custom fonts
UIFontDescriptor *userFont = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleBody];
float userFontSize = [userFont pointSize];
someLabelOrText.font = [UIFont fontWithName:@"CustomFont" size:userFontSize];
@radianttap
radianttap / daringfireball.css
Created November 16, 2013 11:03
User CSS for daringfireball.net, using Avenir Next (and its condensed variant).
body, dt, dd {
font-family: "Avenir Next", sans-serif !important;
line-height: 1.5 !important;
}
body {
font-size: 14px !important;
font-weight: 400 !important;
}