Skip to content

Instantly share code, notes, and snippets.

//
// NSDate+Surrounding.h
//
// Created by Josh Kendall on 12/22/10.
// Copyright 2010 JoshuaKendall.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDate (Surrounding)
@gavingmiller
gavingmiller / gist:1271793
Created October 8, 2011 03:10 — forked from javan/gist:1168475
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@gavingmiller
gavingmiller / hack.sh
Created March 31, 2012 14:19 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2265392/hack.sh | sh
#
A good commit message looks like this:
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
@gavingmiller
gavingmiller / dump.m
Created June 11, 2012 14:43
Objective-C Dump Views
static void dumpViews(UIView* view, NSString *text, NSString *indent)
{
Class cl = [view class];
NSString *classDescription = [cl description];
while ([cl superclass])
{
cl = [cl superclass];
classDescription = [classDescription stringByAppendingFormat:@":%@", [cl description]];
}

Capybara

save_and_open_page

Matchers

have_button(locator)
#in config/initializers/wicked_pdf.rb
module WickedPdfHelper
def wicked_pdf_stylesheet_link_tag(*sources)
sources.collect { |source|
"<style type='text/css'>#{Rails.application.assets.find_asset("#{source}.css")}</style>"
}.join("\n").gsub(/url\(['"](.+)['"]\)(.+)/,%[url("#{wicked_pdf_image_location("\\1")}")\\2]).html_safe
end
def wicked_pdf_image_tag(img, options={})
image_tag wicked_pdf_image_location(img), options

Capybara

save_and_open_page

Matchers

have_button(locator)
@gavingmiller
gavingmiller / deploy.rake
Last active December 15, 2015 09:49 — forked from njvitto/deploy.rake
# Deploy and rollback script for Heroku on staging and/or production
# Modified from: https://gist.github.com/njvitto/362873
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
desc 'Deploy to Staging on Heroku'
task :staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
desc 'Deploy to Production on Heroku'