Skip to content

Instantly share code, notes, and snippets.

View spenrose's full-sized avatar

Scott Penrose spenrose

View GitHub Profile

Keybase proof

I hereby claim:

  • I am spenrose on github.
  • I am spenrose (https://keybase.io/spenrose) on keybase.
  • I have a public key ASC-vL5moocdoiyp9NMg92WRFT5T_A33llztB1lUPVXY_Ao

To claim this, I am signing this object:

@spenrose
spenrose / clean_xliff.rb
Created June 1, 2016 15:54
When importing xliff files into Xcode it does not convert new lines to `\n`. This results in broken strings files.
require 'nokogiri'
filename = "filename.xliff"
out_filename = "out_filename.xliff"
doc = File.open(filename) { |f| Nokogiri::XML(f) }
source = doc.css("trans-unit source")
source.each { |s|
s.content = s.content.gsub("\n", "\\n")
@spenrose
spenrose / BothCommandKeysPressed.xml
Last active December 14, 2015 19:28
Remap all keys when holding down left and right commands. This version is for dvorak keyboards.
<?xml version="1.0"?>
<root>
<item>
<name>Alt keyboard with Command_L + Command_R</name>
<item>
<name>Rebind all keys when both command keys are pressed</name>
<identifier vk_config="true">notsave.smp_alt_keyboard</identifier>
<autogen>__KeyToKey__ KeyCode::A, KeyCode::MINUS</autogen> <!-- A to [ -->
<autogen>__KeyToKey__ KeyCode::SEMICOLON, KeyCode::EQUAL</autogen> <!-- S to ] -->
<autogen>__KeyToKey__ KeyCode::S, KeyCode::MINUS, ModifierFlag::SHIFT_L</autogen> <!-- O to { -->
@spenrose
spenrose / Gemfile
Created January 26, 2013 02:49
Rakefile for Xcode projects.
source "https://rubygems.org"
# Rakefile
gem "rake"
gem "xcoder"
gem "open4"
gem "spinning_cursor"
@spenrose
spenrose / gist:4539571
Last active December 11, 2015 03:39
Logging macros
// Logging Macros
#ifdef DEBUG
# define DLog(FORMAT, ...) printf("%s %s ~ %s\n", [[[NSDate date] description] UTF8String], __PRETTY_FUNCTION__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(FORMAT, ...) printf("%s %s ~ %s\n", [[[NSDate date] description] UTF8String], __PRETTY_FUNCTION__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])