"Design is a plan for arranging elements in such a way as best to accomplish a particular purpose" — Charles Eames

A comprehensive script for Xcode projects that lets you generate .gitignore and .gitattributes in the directory of your choosing.

Download
You can grab the script here: https://gist.github.com/anjerodesu/5063843

Running the script

Copy the script to your project folder.
Open Terminal and run:

cd path/to/your/project/ (if you’re not yet on your project’s directory)
sh generate-git.sh

AVPickerDimView is a simple class combination of UIView, UIActionSheet, and UIPickerView.

Installation
There are 3 ways to download and import the files to your project:

Download:

Using git subtree (recommended)

git subtree add –prefix=AVPickerDimView –squash git@github.com:anjerodesu/AVPickerDimView.git master

Using git submodule

git submodule add git@github.com:anjerodesu/AVPickerDimView.git AVPickerDimView

Download as zip

Download the file: AVPickerDimView Project Page on GitHub
Unzip the folder and put it inside your project with the .xcodeproj file

After downloading and importing the files to your project folder, your next step is …

NSString+HTMLHelper is a collection of methods that helps me deal with HTML tags and URLs.

NSString+HTMLHelper Download Link

GitHub

Sample Usage:
Please look at the demo project. It has sample codes on how to use the category.

Methods:

// Class Methods
+ (NSString *)mimeTypeFromURL:(NSURL *)pathForResource;
+ (NSString *)mimeTypeFromResource:(NSString *)pathForResource ofType:(NSString *)type;

// Instance Methods
- (NSString *)URLEncodeString;
- (NSString *)URLDecodeString;
- (NSString *)replaceTagWithLineBreak;
- (NSString *)replaceTagWithWhiteSpace;
- (NSString *)stripHTMLTags;

Install:
Just copy the NSString+HTMLHelper Category or NSString+HTMLHelper.h and NSString+HTMLHelper.m files to your project and #import the header file NSString+HTMLHelper.h

ImageHelper is a simple PHP class that save, resize and/or crop photos. You can download the script in the links listed below.
ImageHelper download link

Gist

Sample Usage :

$image = new ImageHelper();
$imageThumb = ‘../images/thumb/’ . $imageID . ‘.jpg’;
$image->saveImage( $url , $imageURL );
$image->resizeCrop( $imageThumb , $imageThumb , ’1:1′ , ’75x’ );

$imagePreview = ‘../images/preview/’. $imageID . ‘.jpg’;
$image->saveImage( $url , $imagePreview );
$image->resizeCrop( $imagePreview , $imagePreview , null , ’250×150′ );

Functions
saveImage( $url , $serverURL ) saves an image from a URL. The function uses cURL to copy an image from the URL then save it to the server’s folder.

$url – URL to get the image
$serverURL – server URL to save the image

resizeCrop( $loadPath, $savePath , $crop , $size ) resize and/or crop the image from a URL. The function uses PHP’s GD and image functions using the $crop and $size parameter.

$loadPath – path where the image is on the server
$savePath – path where the image should be saved on the server
$crop – crop ratio
$size – image size

Spotlight indexing can slow your machine if you have low memory. Doing it repeatedly may stop your machine from working. This problem is a common occurrence with Mac machines. As I am a Mac user, I wrote a simple shell script that will help your Spotlight to stop reindexing your installed drive(s).

[gist id=4385230]

This Shell script is all you need. Save it to with any filename you want (mine’s ReindexSpotlight.sh) and make sure to put it in a folder you can access easily (Documents folder for example).

How to use
Using Terminal, you can call the script with sh /Documents/ReindexSpotlight.sh

LockGen is an iOS app that generates random string that can be used to lock specific vaults, accounts, and other classified documents. It can also save the generated string to it’s own secured internal library using Apple’s Core Data technology.

Tricks
Some NSLog tricks I’m using on my escapade. These snippets are preprocessor macros that will help your debugging moments easier if not a lot.

ALog
This snippet will log everything every time you use it in a line. It will display the method name, the line number and the argument you gave.

#define ALog(fmt, …) NSLog((@”%s [Line %d] ” fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

DLog
This snippet will log everything every time you are in a DEBUG mode but has the same function of ALog.

#ifdef DEBUG
#define DLog(fmt, …) NSLog((@”%s [Line %d] ” fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(…)
#endif

LFLog

#ifdef DEBUG
#define LFLog() NSLog((@”%s [Line %d]“), __PRETTY_FUNCTION__, __LINE__);
#else
#define LFLog(…)
#endif

This snippet will not take any arguments but will display the current file and method and the line number if you are in a DEBUG mode.

UALog
This snippet is much like DLog. It will take an argument and will display it, but in this case, it will display it using a UIAlertView instead of displaying it on the console.

#ifdef DEBUG
#define UALog(fmt, …) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat: @"%s\n[Line %d]“, __PRETTY_FUNCTION__, __LINE__] message: [NSString stringWithFormat: fmt, ##__VA_ARGS__] delegate: nil cancelButtonTitle: @”Ok” otherButtonTitles: nil]; [alert show]; }
#else
#define UALog(…)
#endif

The debugging process is tough, especially if …

Foursquare (foursquare) in their own words is a location-based mobile platform that makes cities easier to use and more interesting to explore. By “checking in” via a smartphone app or SMS, users share their location with friends while collecting points and virtual badges. Foursquare guides real-world experiences by allowing users to bookmark information about venues that they want to visit and surfacing relevant suggestions about nearby venues.

Important: Before continuing, make sure you have a valid Client ID and Secret to use for your app. For more information, go here: https://developer.foursquare.com/

We can display venues using the foursquare Venues Project. The foursquare Venues Project is an API that makes it easy to display the foursquare venues in various ways.

Using the API we can display venues’ informations from the foursquare venues database in JSON format. In this tutorial, we will use the information from the database to display the data in a map using the built-in MapKit of iOS and a JSON parser to parse the returned information. Yes, we can do that because the information from their database includes latitude and longitude.

Note: The JSON parser I used in this project is SBJSON, you can download it here: …

Table Views are the most common object used to display lists of data to the user. This objects are highly configurable, they can be made to look different things. Mail, Contacts, and Messages to name a few apps using the Table View. Mail uses table view to display lists of accounts, folders, and messages, but table views are not limited to display text, they are also used in YouTube, Settings, and other applications, even though this applications has many different appearances.

Property list files use the filename extension .plist, and thus are often referred to as plist files. Property lists organize data into named values and lists of values using several object types. These types give you the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. Property lists are frequently used by applications running on both Mac OS X and iOS. The property-list programming interfaces for Cocoa and Core Foundation allow you to convert hierarchically structured combinations of these basic types of objects to and from standard XML. You can save the XML data to disk and later use it to reconstruct the original objects.

Note: To know more about property list, …

UIColor+ColorWithHex is a category method for iOS UIColor, inspired by the lack of hexadecimal colour integration of iOS.

UIColor+ColorWithHex Download Link

GitHub

Sample Usage:

[[self view] setBackgroundColor: [UIColor colorWithHex: 0xff0000]];

UIColor *randomColor = [UIColor randomColor];

Methods:

+ (UIColor *)colorWithHex:(UInt32)hexadecimal;
+ (UIColor *)colorWithHexString:(NSString *)hexadecimal;
+ (UIColor *)colorWithAlphaHex:(UInt32)hexadecimal;
+ (UIColor *)colorWithAlphaHexString:(NSString *)hexadecimal;
+ (NSString *)hexStringFromColor: (UIColor *)color;
+ (UIColor *)randomColor;
// ObjC (manual hex conversion to RGB)
+ (UIColor *)colorWithHexa:(NSString *)hexadecimal;

Pages

Copyright © 2010 - 2013 Studio Villegas. All Rights Reserved.