Skip to content

Instantly share code, notes, and snippets.

Scott Penrose spenrose

Block or report user

Report or block spenrose

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c3117888abf4b114c28421d326ef2037
### Keybase proof
I hereby claim:
* I am spenrose on github.
* I am spenrose (https://keybase.io/spenrose) on keybase.
* I have a public key ASBuW-sWnW4llUKpzJ9QgIkU3QRjA-jOsKBD7AJSYElwjwo
To claim this, I am signing this object:
@spenrose
spenrose / clean_xliff.rb
Created Jun 1, 2016
When importing xliff files into Xcode it does not convert new lines to `\n`. This results in broken strings files.
View clean_xliff.rb
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 Dec 14, 2015
Remap all keys when holding down left and right commands. This version is for dvorak keyboards.
View BothCommandKeysPressed.xml
<?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 Jan 26, 2013
Rakefile for Xcode projects.
View Gemfile
source "https://rubygems.org"
# Rakefile
gem "rake"
gem "xcoder"
gem "open4"
gem "spinning_cursor"
@spenrose
spenrose / gist:4539571
Last active Dec 11, 2015
Logging macros
View gist:4539571
// 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])
You can’t perform that action at this time.