Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am shayne on github.
  • I am shayne (https://keybase.io/shayne) on keybase.
  • I have a public key ASDyQYKTQTZgsHIJo_wBxC2EaPPYCE8QkkBHk4BdK-w0jgo

To claim this, I am signing this object:

@shayne
shayne / json_grammar.pl
Created April 1, 2016 18:49
Perl 6 JSON Grammar - playing with Perl6
use LWP::Simple;
grammar JsonGrammer {
token TOP { <object-value>|<array-value> }
token any-value { \s* <string-value>|<numeric-value>|<null-value>|<object-value>|<array-value> \s* }
token object-value { '{' <property> [\s* \, \s* <property> \s*]*'}' }
token array-value { '[' <any-value> [\s* \, \s* <any-value> \s*]*']' }
token property { \s* <key> \s* ':' \s* <any-value> \s* }
token key { \" \w+ \" }
token any-quotes { <["']> }
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// Not needed
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let indexPath = self.tableView.indexPathForSelectedRow()!
let destinationController = segue.destinationViewController as ProductDetailViewController
destinationController.productData = products[indexPath.row] as PFObject
}
//
// CGViewController.swift
// Banksy
//
// Created by Shayne Sweeney on 11/1/14.
// Copyright (c) 2014 App Couture. All rights reserved.
//
import UIKit
@shayne
shayne / gist:3086902
Created July 10, 2012 23:27
Add Mac OS X user to "wheel" group (no more sudo passwd)
sudo dscl . -append /groups/wheel GroupMembership <username>
# now `sudo visudo` and remove comment from: %wheel ALL=(ALL) NOPASSWD: ALL
@shayne
shayne / gist:1001050
Created May 31, 2011 18:53
PeepOpen Xcode 3 script
#!/bin/sh
open "peepopen://%%%{PBXFilePath}%%%?editor=Xcode"
@shayne
shayne / gist:885579
Created March 24, 2011 18:30
[iOS] Simulate memory warning on device
[[UIApplication sharedApplication] _performMemoryWarning];
@shayne
shayne / ec2-host.py
Created January 6, 2011 02:23
Easily get ec2 public hosts, open a shell or run commands...
#!/usr/bin/env python
import os
import sys
import getopt
import boto
from sys import stderr
_ec2 = None
#ifdef DEBUG
#define DLog(...) NSLog(@"%s:%d %s - %@", __FILE__, __LINE__, __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#define DLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
#endif
#define ALog(...) NSLog(@"%s:%d %s - %@", __FILE_, __LINE__, __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#endif
@shayne
shayne / gvoice.rb
Created December 15, 2009 06:21
A quick interface to the Google Voice using an undocumented API
require 'rest_client'
class GVoice < Struct.new :e, :p
def initialize(*args, &block)
super; instance_eval &block if block_given?
end
def send_sms(number, text)
post 'sms/send', :phoneNumber => number, :text => text, :_rnr_se => get[/'_rnr_se': '([^']+)'/, 1]
end