Skip to content

Instantly share code, notes, and snippets.

View trevorsheridan's full-sized avatar

Trevor Sheridan trevorsheridan

View GitHub Profile
@trevorsheridan
trevorsheridan / cocoa-security.m
Created August 12, 2013 19:00
CocoaSecurity Base64 encoding example
#import <CocoaSecurity/CocoaSecurity.h>
- (NSString *)encodeUsername:(NSString *)username password:(NSString *)password
{
CocoaSecurityEncoder *encoder = [[CocoaSecurityEncoder alloc] init];
NSString *pair = [NSString stringWithFormat:@"%@:%@", username, password];
return [encoder base64:[pair dataUsingEncoding:NSUTF8StringEncoding]];
}
{
"ProductId" : 646,
"OrderPayments" : [
{
"Payer" : {
"FacebookId" : "689561194"
},
"IncludeTip" : true,
"PaymentMethod" : {
"Id" : 138
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rationale Creative</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
@trevorsheridan
trevorsheridan / NSDate+Additions.m
Created October 3, 2012 08:53
Strips the time from a date with respect to the user's timezone
//
// NSDate+Additions.m
//
// Created by Trevor Sheridan on 10/1/12.
// Copyright (c) 2012 Trevor Sheridan Inc. All rights reserved.
//
#import "NSDate+Additions.h"
@implementation NSDate (Additions)
@trevorsheridan
trevorsheridan / size.sh
Created August 1, 2012 09:46
Calculate the dimensions of a bitmap given a rotation and rotation width.
#!/bin/bash
temp="/tmp/size-"$(date +"%s")"-tmp.png"
em=10
convert $1 -rotate $2 $temp
convert $temp -scale $3 -rotate $(echo "$2 * -1" | bc) -trim -shave 2x2 $temp
identify -format "dimensions: %w x %h pixels\nwidth: %[fx:w/$em]em;\nheight: %[fx:h/$em]em;" $temp
rm -rf $temp
@trevorsheridan
trevorsheridan / http-vhosts.conf
Created July 12, 2012 02:33
Apache virtual host file for mobile development on a LAN. Supports named based hosting and access through port 8000 (10.0.1.3:8000).
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
(function() {
var Detective = window.Detective = Backbone.Base.extend({
initialize: function() {
snack.publisher(this);
this.ua = window.navigator.userAgent;
return this;
},
@trevorsheridan
trevorsheridan / Installing LAME on Mac OSX Lion
Created March 1, 2012 09:00
Installing LAME on Mac OSX Lion
Getting the Source
$ cd ~/source
$ curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ tar -zxvf lame-3.99.5.tar.gz
$ rm -r lame-3.99.5.tar.gz
$ cd lame-3.99.5
Installing
$ ./configure
$ make
@trevorsheridan
trevorsheridan / Installing TagLib on Mac OSX Lion
Created March 1, 2012 08:24
Installing TagLib 1.7.1 on Mac OSX Lion
$ cd ~/source
$ ftp http://developer.kde.org/~wheeler/files/src/taglib-1.7.1.tar.gz
$ tar -zxvf taglib-1.7.1.tar.gz
$ rm -r taglib-1.7.1.tar.gz
$ cd taglib-1.7.1
$ cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.6 \
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-DENABLE_STATIC=ON \
@trevorsheridan
trevorsheridan / Installing CMake on Mac OSX Lion
Created March 1, 2012 08:17
Installing CMake 2.8.7 on Mac OSX Lion
$ cd ~/source
$ ftp http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
$ tar -zxvf cmake-2.8.7.tar.gz
$ rm -r cmake-2.8.7.tar.gz
$ cd cmake-2.8.7
$ ./bootstrap
$ make
$ sudo make install