Skip to content

Instantly share code, notes, and snippets.

View danielmcgrath's full-sized avatar
🗜️
you know, daniel from work

Daniel McGrath danielmcgrath

🗜️
you know, daniel from work
View GitHub Profile
### Keybase proof
I hereby claim:
* I am danielmcgrath on github.
* I am danielmcgrath (https://keybase.io/danielmcgrath) on keybase.
* I have a public key ASCUSHMFgxkPtnlxb610FmsJVkG7ppRGLtWdUS2ksGMVPgo
To claim this, I am signing this object:
@danielmcgrath
danielmcgrath / RCTButtonManager.h
Last active June 11, 2016 18:41
Somewhat outdated example of creating an iOS React Native bridge for the Button SDK (https://www.usebutton.com/developers).
#import "RCTBridgeModule.h"
@interface ButtonManager : NSObject <RCTBridgeModule>
@end
[TRACE] Undefined symbols for architecture i386:
[TRACE] "_OBJC_CLASS_$_Reachability", referenced from:
[TRACE] objc-class-ref in libcom.pusher.a(ComPusherModule.o)
[TRACE] "_kReachabilityChangedNotification", referenced from:
[TRACE] -[ComPusherModule pusher:connection:didDisconnectWithError:] in libcom.pusher.a(ComPusherModule.o)
[TRACE] -[ComPusherModule reachabilityChanged:] in libcom.pusher.a(ComPusherModule.o)
[TRACE] (maybe you meant: _TI_kReachabilityChangedNotification)
[TRACE] ld: symbol(s) not found for architecture i386
[TRACE] clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ cat titanium.xcconfig
//
//
// CHANGE THESE VALUES TO REFLECT THE VERSION (AND LOCATION IF DIFFERENT)
// OF YOUR TITANIUM SDK YOU'RE BUILDING FOR
//
//
TITANIUM_SDK_VERSION = 3.1.1.GA
@danielmcgrath
danielmcgrath / pixelcounter.py
Created December 22, 2012 18:35
Script to count the number of pixels in PSD files in a directory. For some reason. Requires psd-tools: https://github.com/kmike/psd-tools
import operator
import os
import sys
from psd_tools import PSDImage
def _parse_psd_size(dirname, filename):
file_ = '{0}/{1}'.format(dirname, filename)
size = (0, 0)
@danielmcgrath
danielmcgrath / gist:1407930
Created November 30, 2011 03:51
Calculate a quarterback rating with clojure
(defn force-range
"Forces a number into the allowed range. 0 - 2.375"
[i]
(cond
(< i 0) 0
(> i 2.375) 2.375
:else i))
(defn calculate-rating
"Returns the QB Rating based on the stats entered"
.arrow.down:hover::before {
position: fixed;
display: block;
z-index: 1000;
padding: 2px 0;
border-top: 1px solid #333;
content: "Please do not downvote based on team fandom.";
text-align: center;
-moz-border-radius: 5px;
-webkit-border-radius: 0;
@danielmcgrath
danielmcgrath / .bashrc
Created April 26, 2011 15:55
Automatic git branch switching based on substrings
alias fb="ruby ~/find_branch.rb $1"
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
function extract(obj, scope) { for (var i in obj) scope[i] = obj[i]; }