Skip to content

Instantly share code, notes, and snippets.

View mhaylock's full-sized avatar

Mark Haylock mhaylock

  • abitofthought.com
  • Christchurch, New Zealand
View GitHub Profile
@mhaylock
mhaylock / gist:958381
Created May 6, 2011 03:14
Setting up GIT Bash autocompletion

Run the following to create ~/.git-completion.bash:

curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash > ~/.git-completion.bash

Then add the following to your ~/.bashrc or ~/.bash_profile after PATH:

# Set the base PS1
PS1="\h:\W \u\$ "

Source the git bash completion file

@mhaylock
mhaylock / gist:995049
Created May 27, 2011 11:11
nginx config to add Cache-Control header to rails static cache files
location / {
try_files /system/maintenance.html $uri $uri/index.html $uri.html @passenger;
expires 60s;
add_header Cache-Control public;
add_header Vary Accept-Encoding;
}
@mhaylock
mhaylock / gist:4727993
Created February 7, 2013 02:46
Instructions for adding Cedar to an existing project. Cedar does exist as a CocoaPods project but that doesn't get you access to the templates, so this approach installs it as a git submodule - YMMV.

Existing project details

This document uses a project named "Example" that has an existing target "ExampleApp". This is the target you will host you tests in.

Adding Cedar as a submodule and installed templates into Xcode:

  $ mkdir Externals
  $ git submodule add git://github.com/pivotal/cedar.git Externals/Cedar
  $ cd Externals/Cedar/; ./installCodeSnippetsAndTemplates; cd -;

foo

  1. index is the 0 based index value of the button pressed

  2. label is the text label of the button pressed

         function showConfirm() {
             var confirmDelegate = navigator.notification.confirm(
                 'You are the winner!',  // message
    

'Game Over', // title

@mhaylock
mhaylock / gist:8528394
Last active January 3, 2016 22:29
AppleScript to tell Xcode to run app on multiple devices at once. Use here to run on "Example’s iPad" and "iPhone". For some reason Xcode crashes if I try to choose the iOS version in the simulator as well, i.e. `menu_click({"Xcode", "Product", "Destination", "iPhone"})` will work fine, but `menu_click({"Xcode", "Product", "Destination", "iPhone…
---- Handy menu_click code from http://hints.macworld.com/article.php?story=20060921045743404:
-- `menu_click`, by Jacob Rus, September 2006
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.
on menu_click(mList)
local appName, topMenu, r
@mhaylock
mhaylock / gist:b7b83911d779f4b351da
Last active August 29, 2015 14:02
Cleaning up old branches from a Git repo
# Update local remote refs, and delete all local remote refs that have been
# deleted on Github:
$ git fetch -p
# Switch to a primary branch (i.e. 'api' or 'master'), you will use this branch
# to find all merged branches that you will delete:
$ git checkout api
@mhaylock
mhaylock / private.xml
Created March 12, 2015 09:50
Karabiner (https://pqrs.org/osx/karabiner/index.html.en) Configuration for remapping "Sculpt Ergonomic Desktop" mouse's Windows button to Mouse Button 4. Derived from http://blog.yorkxin.org/posts/2014/04/12/microsoft-sculpt-mobile-mouse-and-mac/.
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>MICROSOFT</vendorname>
<vendorid>0x045e</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>SCULPT_ERGONOMIC_DESKTOP</productname>
<productid>0x07a5</productid>
/* This is a FluidApp userscript for Google Inbox for Mac.
Includes options for total badge count and unread badge count.
1) You need the paid version of FluidApp (http://fluidapp.com/)
2) Point Fluid to https://inbox.google.com (I recommend the icon from here: https://medium.com/@chrismessina/create-an-icon-for-google-inbox-in-your-dock-ed269312e3bc)
3) Set the user-agent to Chrome
4) Go to window -> userscript and add click the plus sign under the first table (on the left). Name the item 'Inbox'.
5) In the second table (on the right) click the plus and type in "*inbox.google.com*".
6) Paste the contents of this document into the script area below that.
7) Configure badge count (for total or unread only) in the code below.
@mhaylock
mhaylock / boost.sh
Last active October 29, 2015 02:58 — forked from faithfracture/boost.sh
Boost build script for iOS (armv7, armv7s, arm64), iOS Simulator (i386, x86_64), and OSX (i386, x86_64)
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
#===============================================================================
#
# Builds a Boost framework for iOS, iOS Simulator, and OSX.
# Creates a set of universal libraries that can be used on an iOS and in the
@mhaylock
mhaylock / no_animations.rb
Last active May 2, 2017 17:08 — forked from keithtom/no_animations.rb
Rack Middleware to disable Disable CSS3/jQuery Animations for Capybara
module Rack
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues.
# Usage for Rails:
# in config/environments/test.rb
# config.middleware.use Rack::NoAnimations
class NoAnimations
def initialize(app, options = {})
@app = app
end