Skip to content

Instantly share code, notes, and snippets.

@grandeforesta
grandeforesta / gist:1938266
Created February 29, 2012 05:42
gitのリビジョン番号をplistに自動的に埋め込む by http://sonson.jp/?p=2241
#svnやgitのリビジョン,ビルド番号をplistに自動的に埋め込む http://sonson.jp/?p=2241
git_revision=$(git show --format='%h' -s)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
/usr/libexec/PlistBuddy -c "Set :CFBundleGitRevision $git_revision" "$INFOPLIST_FILE"
@kkosuge
kkosuge / route53DynDNS.bash
Created March 2, 2012 19:58
Amazon Route 53 Dynamic DNS Updater Script
#!/bin/bash
### User Settings (things you must set)
## Location of the dnscurl.pl script
DNSCurl="/path/to/route53DynDNS/dnscurl.pl"
## The host name you wish to update/create
myHostName="*"
## Zone/domain in which host (will) reside(s)
myDomainName="example.com"
@kevinmcmahon
kevinmcmahon / gist:2295471
Created April 3, 2012 20:59
Create a 1x1 UIImage from a UIColor
- (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
#import <Foundation/Foundation.h>
@interface UILabel (ktlib)
- (void) fitSizeOfFont:(UIFont *)font;
@end
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@Irio
Irio / PropositionListActivity.java
Created July 24, 2012 01:08
Android - How to move ActionBar.Tab's icon as your needs (example using ActionBarSherlock)
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.SherlockActivity;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.Menu;
@tomohisa
tomohisa / ViewController.m
Created July 25, 2012 01:09
Add ChildViewController Help Method.
#pragma mark - help functions
-(void) addChildViewControllerWithIdentifier:(NSString*)identifier inArea:(CGRect)rect closeOtherChildView:(BOOL)isClose toView:(UIView*) toView{
if (isClose) {
for (UIViewController* vc in self.childViewControllers) {
[vc.view removeFromSuperview];
[vc removeFromParentViewController];
}
}
@nakiwo
nakiwo / gist:3174351
Created July 25, 2012 04:15
subviewだけtouchできるview
@interface TestView : UIView
@end
@implementation TestView
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *view = [super hitTest:point withEvent:event];
if(view == self) {
return nil;
@fmtonakai
fmtonakai / CustomAlertView.h
Created September 4, 2012 02:20
Custom AlertView with Interface Builder
//
// CustomAlertView.h
// CustomAlert
//
// Created by masaki.fuke on 2012/08/23.
// Copyright (c) 2012年 masaki.fuke. All rights reserved.
//
#import <UIKit/UIKit.h>
RAC(self.layer.contents) = [[[[[[RACAble(self.rowView) select:^(YourRowView *rowView) {
return RACAble(rowView, selected);
}] switch] distinctUntilChanged] injectObjectWeakly:self]
doNext:^(RACTuple *x) {
CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"contents"];
fade.duration = 0.15;
[[x.last layer] addAnimation:fade forKey:@"animateContents"];
}] select:^id(RACTuple *x) {
return ([x.first boolValue] ? [self highlightedGradient] : [self standardGradient]);
}];