Skip to content

Instantly share code, notes, and snippets.

View amine2233's full-sized avatar

Amine Bensalah amine2233

View GitHub Profile
@jonah-williams
jonah-williams / build.sh
Created April 30, 2011 17:46
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@shazron
shazron / sim-run.sh
Created October 25, 2011 21:53
Run Xcode Simulator project from the command line
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@TonnyXu
TonnyXu / Description.md
Created February 3, 2012 10:03
Make the UITableView with group style to round the image.

The point is, the roundCorner is draw by a subview of UITableViewCell, and mean while, it's not a public class, there is no way you can get layer.cornerRadius from any view. So we need to resolve this problem by ourselves.

There are 2 cases.

  1. There is only one cell.

    This case is ease, just use cell.contentView.layer.cornerRadius and cell.contentView.layer.masksToBounds to make it work.

  2. There are more than one cell.

@v-yarotsky
v-yarotsky / .tmux.conf
Created March 22, 2012 11:57
Mac OS X tmux config
### INSTALLATION NOTES ###
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
# Character Encoding: Unicode (UTF-8)
# Report Terminal Type: xterm-256color
# 7. Put itunesartist and itunestrack into PATH
@developernotes
developernotes / changelog.sh
Created July 5, 2012 20:45
Display a simple changelog between the last two tags in a Git repository
#! /usr/bin/env sh
firstTag=$(git tag | sort -r | head -1)
secondTag=$(git tag | sort -r | head -2 | awk '{split($0, tags, "\n")} END {print tags[1]}')
echo "Changes between ${secondTag} and ${firstTag}\n"
git log --pretty=format:' * %s' ${secondTag}..${firstTag}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@cconstable
cconstable / singleton.m
Created October 8, 2013 16:06
Generic Obj-C Singleton Code Snippet
+ (instancetype)sharedUtilities
{
__strong static id sharedUtilities;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedUtilities = [[self alloc] init];
});
return sharedUtilities;
}
@ariok
ariok / [CoreData]EntriesBetweenDates.m
Created November 29, 2013 17:01
Get Core Data entries between a date range
+ (NSArray*)allEntriesInContext:(NSManagedObjectContext*)context fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate{
// Create the request
NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Entry"];
// Build the predicate
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"date >= %@ && date <= %@ ", fromDate, toDate];
request.predicate = predicate;
// Define sorting
NSSortDescriptor *sortDesc = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES];
request.sortDescriptors = @[sortDesc];

Keynote I guess pushed an update that doesn't take hightlighted code from xCode anymore. So, I googled around and found highlight. It is a super useful utitlity to do syntax highlighting from the command line.

$ brew install highlight

If you are on Mavericks you may need to brew link lua to get it working right.

Hightlight has support for all kinds of languages and themes and it can wrap the code with line numbers, which is great.