Skip to content

Instantly share code, notes, and snippets.

View gertig's full-sized avatar

Andrew Gertig gertig

View GitHub Profile
@gingertom
gingertom / renamer.sh
Created February 26, 2013 12:26
Renames all the images in a folder to add @2x between the filename and the extension. Usage (run in the folder to affect): path/to/renamer/renamer.sh
#!/bin/sh -e
cd "${1-.}"
for f in *; do
mv "$f" "${f%.*}@2x.${f##*.}"
done
@gingertom
gingertom / resizer.sh
Created February 26, 2013 12:22
Simple image magic script to go through a folder of @2x images and make non-retina copies of them too. Usage (run in folder to affect): path/to/resizer/resizer.sh
#!/bin/bash -e
cd "${1-.}"
for f in *; do
if [[ $f == *@2x* ]];
then
convert $f -resize 50% ${f//@2x/}
fi
done
@timcheadle
timcheadle / README.md
Last active January 26, 2023 00:56
Make /robots.txt aware of the Rails environment

Make /robots.txt aware of the Rails environment

You probably don't want Google crawling your development staging app. Here's how to fix that.

$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt

Now edit config/routes.rb to add a route for /robots.txt, and add the controller code.

@asmallteapot
asmallteapot / rbm_singleton.rb
Created September 20, 2012 18:00
Singletons in RubyMotion 1.4
# http://blog.rubymotion.com/post/31917526853/rubymotion-gets-ios-6-iphone-5-debugger
class STSomeAPIClient
def self.sharedClient
Dispatch.once { @instance ||= new }
@instance
end
end
@turtlesoupy
turtlesoupy / SFSChickenScreen.m
Created September 16, 2012 09:18
Ultra chicken CAEmitterLayer particle system
//
// Created by tdimson on 9/5/12.
#import <QuartzCore/QuartzCore.h>
#import "SFSChickenScreen.h"
@implementation SFSChickenScreen {
__weak CAEmitterLayer *_chickenEmitter;
CGFloat _decayAmount;
@turtlesoupy
turtlesoupy / SFSConfettiScreen.m
Created September 16, 2012 09:11
Confetti particle system for iOS5+
//
// Created by tdimson on 8/15/12.
#import <QuartzCore/QuartzCore.h>
#import "SFSConfettiScreen.h"
@implementation SFSConfettiScreen {
__weak CAEmitterLayer *_confettiEmitter;
CGFloat _decayAmount;
@turtlesoupy
turtlesoupy / SFSSmokeScreen.m
Created September 16, 2012 08:50
Psychedelic smoke CAEmitterLayer particle effect
#import "SFSSmokeScreen.h"
#import <QuartzCore/QuartzCore.h>
@implementation SFSSmokeScreen {
__weak CAEmitterLayer*smokeEmitter;
}
-(id)initWithFrame:(CGRect)frame emitterFrame:(CGRect)emitterFrame{
if ((self = [super initWithFrame:frame])) {
self.backgroundColor = [UIColor clearColor];
@turtlesoupy
turtlesoupy / SFSViewController.m
Created September 16, 2012 08:16
Really cruddy iOS particle system to demo emissionLongitude
//
// SFSViewController.m
// AmazingParticleSpinner
//
// Created by Thomas Dimson on 9/15/12.
// Copyright (c) 2012 Thomas Dimson. All rights reserved.
//
#import "SFSViewController.h"
#import <QuartzCore/QuartzCore.h>
@seanlilmateus
seanlilmateus / gist:3187192
Last active March 5, 2021 07:17
How to use Obj-C with MacRuby/Rubymotion

Using Obj-C with MacRuby/Rubymotion

This little post aims to help you to translate Objective-C Blocks into Ruby blocks. Let's start by taking a look at few examples of iOS API call where blocks are used for animations and enumeration

Ruby Lambda Syntaxes:

Im Rubymotion and MacRuby you can use all the Ruby Lambda syntaxes that are:

block = lambda { |param|  ... }
@jimmynotjim
jimmynotjim / more-mute-regex.md
Created July 19, 2012 14:37 — forked from imathis/tweetbot-mute-regex.md
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

##Simply annoying Tweets

Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD

([a-z])/1{4}

Tweet w/ just a single hashtag: #omgthissucks

^ *#[^ ]+$