Skip to content

Instantly share code, notes, and snippets.

@SpacyRicochet
SpacyRicochet / gist:8958266
Last active August 29, 2015 13:56
One-liners to convert retina images to non-retina images
find . -name "*@2x.png" -exec convert "{}" -resize 50% "{}.bak" \;
find . -name "*@2x.png.bak" -exec rename 's|\@2x.png.bak|.png|' "{}" \;
@SpacyRicochet
SpacyRicochet / gist:9919626
Created April 1, 2014 18:05
brew install xctool fail
➜ bin git:(master) brew install xctool --verbose
==> Downloading https://github.com/facebook/xctool/archive/v0.1.14.tar.gz
Already downloaded: /Library/Caches/Homebrew/xctool-0.1.14.tar.gz
==> Verifying xctool-0.1.14.tar.gz checksum
tar xf /Library/Caches/Homebrew/xctool-0.1.14.tar.gz
==> ./scripts/build.sh XT_INSTALL_ROOT=/usr/local/Cellar/xctool/0.1.14/libexec
User defaults from command line:
IDEBuildLocationStyle = Custom
IDECustomBuildIntermediatesPath = /private/tmp/xctool-NBtq/xctool-0.1.14/build/./Intermediates
IDECustomBuildLocationType = Absolute
@SpacyRicochet
SpacyRicochet / main.m
Created April 4, 2014 21:08
Accessibility of ivars synthesised from readonly @properties in subclasses
#import <Foundation/Foundation.h>
@interface Animal : NSObject
{
// The instance variable 'name' that would normally be generated by @property, is not visible in subclasses.
// Thus, leaving the subclasses with no way to set the 'name'.
// Because of this, we have to declare the instance variable publicly as well.
NSString *_name;
}
@SpacyRicochet
SpacyRicochet / KIDPictureMaskAnimator.m
Created August 20, 2014 12:29
Animator for disabled touches issue
@interface KIDPictureMaskAnimator()
@property (nonatomic) id<UIViewControllerContextTransitioning> transitionContext;
@end
@implementation KIDPictureMaskAnimator
#pragma mark - UIViewControllerAnimatedTransitioning
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext
@SpacyRicochet
SpacyRicochet / gist:40e17f24ffade81455d2
Created September 13, 2014 14:48
Install rbenv on clean ubuntu
Install rbenv
1. First, install LinuxBrew (https://www.digitalocean.com/community/tutorials/how-to-install-and-use-linuxbrew-on-a-linux-vps)
2. Then, install rbenv ($ brew install rbenv)
1. Don't use rbevn's directories. Do add the appropriate lines to .bash_profile
| export PATH="$HOME/.rbenv/bin:$PATH"
| if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
3. Then install ruby-build ($brew install ruby-build)
4. Install latest ruby (check with `$ rbenv install -l` and install with `$ rbenv install 2.1.2`)
rsync -rzPK -e 'ssh -p 2222' --delete _site/ bruno@ipaddress:/destination/dir
@SpacyRicochet
SpacyRicochet / gist:3599790e42d388eccaa7
Created October 4, 2014 10:13
Nuclear throne crash report
Process: Mac_Runner [84570]
Path: /Users/USER/Library/Application Support/Steam/*/nuclearthrone.app/Contents/MacOS/Mac_Runner
Identifier: com.vlambeer.nuclearthrone
Version: 1.0.3 (1.0.3)
Code Type: X86 (Native)
Parent Process: launchd [289]
Responsible: Mac_Runner [84570]
User ID: 501
Date/Time: 2014-10-04 11:28:39.871 +0200
@SpacyRicochet
SpacyRicochet / testflightuploader.sh
Created October 16, 2014 10:35
NWTestflightUploader
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
# Inspired by original script by incanus:
# https://gist.github.com/1186990
#
# Rewritten by martijnthe:
# https://gist.github.com/1379127
#
@SpacyRicochet
SpacyRicochet / convertLetterboxedPortraitVideo.txt
Created October 28, 2014 19:16
Crop a portrait video from iMovie exported at 1920x1080
ffmpeg -i iMovieLetterboxedPortrait.mp4 -filter:v "crop=608:1080:656:0" portrait.mp4
@SpacyRicochet
SpacyRicochet / hideScreen.m
Last active August 29, 2015 14:08
Hide screen when iOS app resigns active
@interface KIDAppDelegate ()
@property (nonatomic, strong) UIViewController *hideInformationViewController;
@end
@implementation KIDAppDelegate
{
- (void)applicationWillResignActive:(UIApplication *)application
{
[self hideScreen:YES];