Skip to content

Instantly share code, notes, and snippets.

alias longestFiles='find . -name \*.m -not -path "./Pods/*" -exec wc -l {} \; | sort | tail'
alias avgFilesLong="find . -name \*.m -not -path './Pods/*' -exec wc -l {} \; | awk '{ total += \$1; count++} END { print total/count }'"
alias toLongFiles="find . -name \*.m -not -path './Pods/*' -exec wc -l {} \; | sort | awk 'BEGIN{ count = 0; } { if (\$1 > 300){ print \$0; count++}} END { print \" \" count \" files long over 300 lines\" }'"
#contentArea {
width:850px!important;
}
._4-u2,._5x16 ._5inf::after,._6l-:after, ._4_w3::after, ._5va1, .timelineUnitContainer, .timelineReportContainer, ._4lh .fbTimelineCapsule .timelineUnitContainer, ._4lh ._1xz, ._1xw:hover ._1xz, ._4lh ._1xw, .UFIReplyList .UFIRow, ._5vsj .UFIReplyList .UFIComponent.UFILastComponent:after, ._5vsj .UFIReplyList .UFIComponent.UFIFirstComponent:after {
border:0!important;
border-left: none!important;
border-right:none!important;
-webkit-box-shadow: none!important;
}
// returns a MKCoordinateRegion that encompasses an array of MKAnnotations
- (MKCoordinateRegion)regionForAnnotations:(NSArray *)annotations {
CLLocationDegrees minLat = 90.0;
CLLocationDegrees maxLat = -90.0;
CLLocationDegrees minLon = 180.0;
CLLocationDegrees maxLon = -180.0;
for (id <MKAnnotation> annotation in annotations) {
if [ "$CONFIGURATION" = "Ad hoc" ] || [ "$CONFIGURATION" = "Release" ]; then
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
#import <Foundation/Foundation.h>
@interface NSMutableURLRequest (KDJBasicAuthentication)
// Sets the "Authorization" HTTP header to a basic authentication value
// with Base64-encoded username and password. This overwrites any existing
// value for this header.
- (void)setAuthorizationHeaderWithUsername:(NSString *)username
password:(NSString *)password;
#import <UIKit/UIKit.h>
@interface ViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) NSMutableArray *data;
@property (nonatomic, strong) NSMutableArray *sectionTitles;
@end
@MaciejGad
MaciejGad / file.m
Last active April 14, 2016 19:38
Set image with URL
//remember to intall AFNetworking https://github.com/AFNetworking/AFNetworking#installation-with-cocoapods
//and add import :
//#import "UIImageView+AFNetworking.h"
- (void)setImageFromDictionary:(NSDictionary *)dic2 {
NSString *path = dic2[@"safe_value"];
if (![path isKindOfClass:[NSString class]]) {
return;
}
NSURL *imageUrl = [NSURL URLWithString:path];
@MaciejGad
MaciejGad / NibBaseViewController.swift
Created July 26, 2017 12:14
NibBaseViewController
import Foundation
import UIKit
enum NibBaseError:Error {
case badClassName
case noNibFile
case noStoryboard
}
class NibBaseViewController: UIViewController, IsNibBaseViewController {
@MaciejGad
MaciejGad / HideTabBar.swift
Last active June 11, 2018 18:42
Hiding TabBar with animation
extension UITabBarController {
func set(visible: Bool, animated: Bool, completion: ((Bool)->Void)? = nil ) {
guard isVisible() != visible else {
completion?(true)
return
}
let offsetY = tabBar.frame.size.height
#!/bin/bash
info="Info.plist"
plistBuddy=/usr/libexec/PlistBuddy
version=`$plistBuddy -c "print CFBundleVersion" "$info"`
echo "Current version: $version"
((version++))
echo "New version: $version"
$plistBuddy -c "set CFBundleVersion $version" "$info"