Skip to content

Instantly share code, notes, and snippets.

@ole
ole / update_storyboard_strings.sh
Last active April 4, 2022 06:11
Automatically extract translatable strings from Xcode storyboards and update .strings files. Original version by MacRumors forum user mikezang (http://forums.macrumors.com/showpost.php?p=16060008&postcount=4). Slightly updated by Ole Begemann. NOTE: this Gist moved to a regular repo at https://github.com/ole/Storyboard-Strings-Extraction.
# (File moved to https://github.com/ole/Storyboard-Strings-Extraction)
@jfryman
jfryman / personal_boxen_manifest.pp
Last active November 30, 2019 05:05
Personal Boxen Manifest
class people::jfryman {
# Applications
include chrome::stable
include onepassword
include dropbox
include alfred
include macvim
include zsh
include homebrew
include fitbit
@arashm
arashm / rbenv_migrate_gems.sh
Created February 3, 2013 09:31
migrate GEMs from rbenv cache to the newer version of ruby (without internet) Thanks to Austin Ziegler - http://stackoverflow.com/questions/13649241/copying-gems-from-previous-version-of-ruby-in-rbenv
#!/bin/sh
# if you're using ZSH, change the shebang above to "#!/bin/zsh -i"
if [ ${#} -ne 2 ]; then
echo >&2 Usage: $(basename ${0}) old-version new-version
exit 1
fi
home_path=$(cd ~; pwd -P)
old_version=${1}
@mbinna
mbinna / RunUnitTests.sh
Last active October 25, 2017 12:59
Run Xcode Application Tests from the command line
#!/bin/sh
# Launch application using ios-sim and set up environment to inject test bundle into application
# Source: http://stackoverflow.com/a/12682617/504494
if [ "$RUN_APPLICATION_TESTS_WITH_IOS_SIM" = "YES" ]; then
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
environment_args="--setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=$test_bundle_path --setenv XCInjectBundleInto=$TEST_HOST"
ios-sim launch $(dirname $TEST_HOST) $environment_args --args -SenTest All $test_bundle_path
echo "Finished running tests with ios-sim"
[super viewWillAppear:animated];
NSManagedObjectContext *context = [NSManagedObjectContext MR_contextForCurrentThread];
// ここで、FEUnitはFEClanに対してclanというrelationを持っているとする
// FEClanはFEUnitに対してunitsというrelationを持っているとする
// NSManagedObjectIDで検索
// Property clanID must be permanent since a temporary ID cannot handle this query
self.fetchedResultsController = [FEUnit MR_fetchAllGroupedBy:nil
withPredicate:[NSPredicate predicateWithFormat:@"clan == %@", self.clanID]
// Created by Nick Snyder on 11/13/12.
// https://gist.github.com/nicksnyder/4075682
// http://stackoverflow.com/questions/12927027/uicollectionview-flowlayout-not-wrapping-cells-correctly-ios
// NDCollectionViewFlowLayout.h
@interface NDCollectionViewFlowLayout : UICollectionViewFlowLayout
@end
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]);
}];
@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>
@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;
@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];
}
}