Skip to content

Instantly share code, notes, and snippets.

Avatar

Grant Davis gdavis

View GitHub Profile
View _form.html.erb
<%= semantic_form_for [ :manage, resource ], :html => {:class => 'default-manage-form' } do |f| %>
<%= f.inputs do %>
<% attributes.each do |attr| %>
<% puts attr %>
<% case attr %>
<% when "q" %>
<% puts resource[attr] %>
<%= f.input :q, :selected => resource[attr], :collection => Ability.all, :include_blank => false %>
<% when "w" %>
<% puts resource[attr] %>
@gdavis
gdavis / gist:6519324
Created Sep 11, 2013
Xcode Script to Create Icons for different build schemes
View gist:6519324
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"`
build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"`
function processIcon() {
export PATH=$PATH:/usr/local/bin
base_file=$1
base_path=`find "${SRCROOT}/CirrusMD" -name "${base_file}"`
@gdavis
gdavis / XcodeWarnings.sh
Created Mar 9, 2016
Xcode Run Script that highlights TODO, FIXME and more as warnings.
View XcodeWarnings.sh
KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \
perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@gdavis
gdavis / gist:23cbc7b49aa37ba3ef5f001c7779a6f3
Last active Jul 14, 2017
Xcode 9 – Enable Simulator to work in fullscreen mode
View gist:23cbc7b49aa37ba3ef5f001c7779a6f3

defaults write http://com.apple .dt.Xcode ShowDVTDebugMenu YES

Source

@gdavis
gdavis / gist:2829437
Last active Aug 7, 2017
Xcode 4 Custom Key Commands - Add to IDETextKeyBindingsSet.plist
View gist:2829437
<key>GDI Commands</key>
<dict>
<key>GDI Duplicate Current Line</key>
<string>selectLine:, copy:, moveToEndOfLine:, insertNewLine:, moveToBeginningOfLine:, paste:, moveToEndOfLine:</string>
<key>GDI Delete Current Line</key>
<string>moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToEndOfLine:</string>
<key>GDI Move Current Line Up</key>
<string>selectLine:, cut:, moveUp:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:</string>
<key>GDI Move Current Line Down</key>
<string>selectLine:, cut:, moveDown:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:</string>
@gdavis
gdavis / gist:70f6dae2f3a9d9e9351c5f3e84f23e5e
Created Sep 18, 2017
Remove unwanted Xcode Console Messages
View gist:70f6dae2f3a9d9e9351c5f3e84f23e5e

Add this to the current scheme's environment variables:

OS_ACTIVITY_DT_MODE: NO

View email.txt
Hello, I'm contacting you today in response to the FCC's vote today to repeal Net Neutrality.
I want to urgently request that Colorado join New York state in suing the FCC over this action. By repealing the protections put in place in 2015, large corporations that own both news outlets and act as internet service providers, can now freely choose what news, and therefore access to information, their users have access to.
By controlling this access to information, these corporations can dictate what you learn about political candidates, controversial issues, and anything other than what the ISPs deem they want you to know. This undermines the foundations of democracy which depends on an having a public that is informed and unbiased.
While I would personally say we have not had a true democracy in decades, this further establishes the power that corporations wield and further entrenches us into a corporatocracy. For example, Comcast already maintains a virtual monopoly for access to high-speed broadband in
@gdavis
gdavis / gist:2845766
Created May 31, 2012
iOS Phone Number Field Formatting With User Entry
View gist:2845766
#pragma mark - Phone Number Field Formatting
// Adopted from: http://stackoverflow.com/questions/6052966/phone-number-formatting
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (textField == self.mobileNumberField || textField == self.homeNumberField || textField == self.workNumberField) {
int length = [self getLength:textField.text];
if(length == 10) {
if(range.length == 0)
@gdavis
gdavis / desymbolication-terminal.markdown
Last active Jul 16, 2018
De-symbolicating crash reports via Terminal
View desymbolication-terminal.markdown
  1. download the crash log, dSYM, and place in the same directory

  2. copy the symbolicatecrash executable from Xcode tools and place in the directory in step 1 (or create an alias pointing to it)

  3. set the environment variable for the developer directory

export DEVELOPER_DIR=$(xcode-select --print-path)

  1. run the symbolicatecrash with arguments to the crash log and dSYM

./symbolicatecrash -v [crashfilename].crash [appname].app.dSYM

@gdavis
gdavis / gist:6589417
Last active Aug 5, 2020
Enable CoreData debugging in Xcode
View gist:6589417
Pass argument on launch:
-com.apple.CoreData.SQLDebug 1
Value should be 1, 2 or 3. Don't forget the -
To debug iCloud Ubiquity pass:
-com.apple.CoreData.Ubiquity.LogLeve 3
You can’t perform that action at this time.