Skip to content

Instantly share code, notes, and snippets.

@rob-murray
rob-murray / php_ci
Last active August 29, 2015 13:57
PHP CI.md
### Continuous Integration; PHP
> RM 12.3.14
### What this is about
* Here is what I have done with CI for a PHP project.
* Key aim is knowledge sharing and if sessions like this are value.
@rob-murray
rob-murray / xtctest_assertions.c
Created March 20, 2014 09:59
XTCTest Assertions
XCTAssert(expression, format...)
XCTAssertEqual(a1, a2, format...)
XCTAssertEqualObjects(a1, a2, format...)
XCTAssertEqualWithAccuracy(a1, a2, accuracy, format...)
XCTAssertFalse(expression, format...)
XCTAssertNotEqual(a1, a2, format...)
XCTAssertNotEqualObjects(a1, a2, format...)
XCTAssertNotEqualWithAccuracy(a1, a2, accuracy, format...)
XCTAssertNoThrow(expression, format...)
XCTAssertNoThrowSpecific(expression, specificException, format...)
@rob-murray
rob-murray / gcd_ui_update.m
Created March 25, 2014 09:45
GCD; background processing... then update UI
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//background processing goes here
dispatch_async(dispatch_get_main_queue(), ^{
//update UI here
});
});
@rob-murray
rob-murray / Default_Preferences.sublime-settings
Last active August 29, 2015 14:01
Sublime Text 2 Default Settings
{
"detect_slow_plugins": true,
"remember_open_files": true,
"hot_exit": false,
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
# Git credentials
GIT_AUTHOR_NAME="Rob Murray"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
git config --global user.name "$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="robmurray17@gmail.com"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"
@rob-murray
rob-murray / commands.bash
Last active August 29, 2015 14:01
Sublime text plugins; assuming Package Control is installed
function sublg { bundle show $@ | xargs subl; }
@rob-murray
rob-murray / git_fork_sync.sh
Last active August 29, 2015 14:03
Git keep fork up to date; pull upstream changes
# inside fork dir
git remote add upstream ORIGINAL_REPO
git fetch upstream
# pull upstream branch
git pull upstream {branch}
# rebase a branch
git rebase upstream/{branch}
@rob-murray
rob-murray / matching_page_slug_validator.rb
Last active August 29, 2015 14:04
Validate that a `Page` does not have any siblings with the same `:slug`
class MatchingPageSlugValidator < ActiveModel::Validator
def validate(record)
# Ancestry gem #siblings includes current record, exclude this if present
exclude_self = record.try(:id) ? ['id <> ?', record.id] : []
sibling_slugs = record.siblings.where(exclude_self).pluck(:slug)
if sibling_slugs.include?(record.slug)
record.errors[:slug] << 'belongs to another page at this level.'
end
end
@rob-murray
rob-murray / find_txt_record.bash
Created August 11, 2014 09:49
Find the TXT record value for a host
dig -t txt _amazonses.host-domain.co.uk +short
@rob-murray
rob-murray / update_images.rb
Last active August 29, 2015 14:06
Check images in a directory for valid EXIF image creation date and update if necessary.
#!/usr/bin/env ruby
require 'optparse'
require 'mini_exiftool'
# Check images in a directory for valid EXIF image creation date and update if necessary.
# Can be used to fix older photos that do not have to the correct EXIF `date_time_original` field data.
#
# If not present then attempt fallback and update `date_time_original` field
# If fallback not available then otherwise prompt for input or use default date.