Skip to content

Instantly share code, notes, and snippets.

View tylerhall's full-sized avatar

Tyler Hall tylerhall

View GitHub Profile
@tylerhall
tylerhall / Sosumi Multiple Devices Example
Created July 28, 2010 01:08
Sosumi multiple devices example.
<?PHP
require 'class.sosumi.php';
$ssm = new Sosumi('username', 'password');
// Print a list of all the devices in your MobileMe account
print_r($ssm->devices);
// $device_number is an integer (0 through ...) that corresponds
// to the device you want info about.
@tylerhall
tylerhall / strong-passwords.php
Created August 12, 2010 21:38
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@tylerhall
tylerhall / NSDictionary+Embedded.h
Created August 19, 2010 04:04
NSDictionary category that lets you retrieve a value from a dictionary of dictionaries in a single statement. I'm gonna feel really dumb if there was already a way to do this.
#import <Foundation/Foundation.h>
@interface NSDictionary (EmbeddedValue)
- (id)embeddedValueWithKeys:(NSArray *)keys;
@end
@tylerhall
tylerhall / SkypeRepeatDial.applescript
Created August 19, 2010 20:55
If you ever have a reason to repeatedly dial and hangup on someone, here's a Skype way to do it.
property ScriptName : "Repeat Call"
property PhoneToDial : "+15551234567"
repeat
tell application "Skype"
send command "CALL " & PhoneToDial script name ScriptName
delay 10
set activeCalls to send command "SEARCH ACTIVECALLS" script name ScriptName
@tylerhall
tylerhall / SafariToFFCookies.php
Created August 19, 2010 20:58
Converts your Safari cookies into the standard Netscape (Firefox) format.
#!/usr/bin/php
<?PHP
$plist = file_get_contents($_ENV['HOME'] . '/Library/Cookies/Cookies.plist');
preg_match_all('/<dict>(.*?)<\/dict>/ms', $plist, $matches);
$dicts = $matches[1];
$fp = fopen('cookies.txt', 'w');
foreach($dicts as $dict)
{
$domain = match('/Domain<\/key>.*?<string>(.*?)<\/string>/ms', $dict, 1);
@tylerhall
tylerhall / domain1-index.html
Created August 19, 2010 21:03
Cross-domain way to resize an iFrame from within the frame itself.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<script type="text/javascript" charset="utf-8">
function resizeFrame(newHeight) {
document.getElementById('theFrame').height = newHeight;
}
</script>
</head>
<?PHP
require 'includes/master.inc.php';
if($Auth->loggedIn()) redirect('index.php');
if(!empty($_POST['username']))
{
if($Auth->login($_POST['username'], $_POST['password']))
redirect('index.php');
else
@tylerhall
tylerhall / NSData+Base64.h
Created December 30, 2010 17:12
Note that I'm using Google's (awesome) GTMHTTPRequest library.
//
// NSData+Base64.h
// base64
//
// Created by Matt Gallagher on 2009/06/03.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// Permission is given to use this source code file, free of charge, in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
00 05 * * * /usr/sbin/diskutil mount /dev/disk1s3
<?PHP
include 'class.sosumi.php';
$ssm = new Sosumi('your-username', 'your-password');
$location = $ssm->locate();