Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Farrelly jellybeansoup

View GitHub Profile
@jellybeansoup
jellybeansoup / AutoConvert.scpt
Created Feb 15, 2012
Automatic AVI/MKV conversion for iTunes
View AutoConvert.scpt
--Set the location for where your torrents download to
set torrentsLocation to "/Users/Jelly/Torrents"
--Set the location for where HandbrakeCLI lives
set handbrakeLocation to "/Applications/Utilities/HandBrakeCLI"
--Settings up some handlers…
on fileExists(posixFile)
try
if not (exists posixFile as alias) then return false
on error
return false
@jellybeansoup
jellybeansoup / cltools.sh
Last active Dec 31, 2018
Install Autoconf and Automake on OS X Mountain Lion
View cltools.sh
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@jellybeansoup
jellybeansoup / OpenWithCleanup.sh
Created May 28, 2013
A shell script to remove duplicates in the "Open With" menu in OS X 10.5 and later.
View OpenWithCleanup.sh
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@jellybeansoup
jellybeansoup / wordpress.sh
Created Mar 25, 2014
A shell script for easily setting up a Wordpress dev environment.
View wordpress.sh
#!/bin/sh
# We need an install path
if [ $# != 1 ]; then
echo "Usage: wordpress.sh <install-path>"
exit 1
fi
# Fix the path if it's relative
given_path=$1
@jellybeansoup
jellybeansoup / arrangeSubviews.m
Last active Aug 29, 2015
Eat my shorts, auto layout.
View arrangeSubviews.m
#pragma mark - Rearrange the subviews
- (void)setFrame:(CGRect)frame {
[super setFrame:frame];
[self arrangeSubviews];
}
- (void)arrangeSubviews {
// Cover image frame
@jellybeansoup
jellybeansoup / gist:9051a033e7b7929d2a70
Created Jul 5, 2014
My "fix" for the stuck grey buttons thing.
View gist:9051a033e7b7929d2a70
#pragma mark - Action sheet delegate
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
for( UIView *subview in actionSheet.subviews ) {
if( [subview isKindOfClass:[UIButton class]] ) {
UIButton *button = (UIButton *)subview;
[button setTitleColor:[UIColor mainTintColor] forState:UIControlStateNormal];
[button setTitleColor:[UIColor mainTintColor] forState:UIControlStateHighlighted];
[button setTitleColor:[UIColor mainTintColor] forState:UIControlStateSelected];
}
@jellybeansoup
jellybeansoup / new.m
Last active Aug 29, 2015
Grid cell size calculator.
View new.m
// Get the view's actual pixel width
CGFloat pixelWidth = self.collectionView.frame.size.width * UIScreen.mainScreen.scale;
// Maximum cells per row
CGFloat maxCells = ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) ? 10.0 : 5.0;
// Determine a cell width
CGFloat cellWidth = 0.0;
CGFloat cellSpacing = 2.0;
for( CGFloat i = cellSpacing; i <= 4; i++ ) {
View gist:3b5be4045628089afd0d
#pragma mark - View life cycle
- (void)viewDidLoad {
[super viewDidLoad];
[_collectionView registerClass:[JSMRefreshViewCell class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"SearchViewRefresh"];
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
// If we have more results to fetch
View StaticTablesDataSourceTests.m
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "StaticTables.h"
@interface StaticTablesDataSourceTests : XCTestCase
@end
@implementation StaticTablesDataSourceTests
@jellybeansoup
jellybeansoup / update-version.sh
Last active Jun 23, 2021
Script for Incrementing Version Numbers
View update-version.sh
#!/bin/bash
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4>
#
# A command-line script for incrementing build numbers for all known targets in an Xcode project.
#
# This script has two main goals: firstly, to ensure that all the targets in a project have the
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number
# is incremented appropriately when git has changes.
#