Skip to content

Instantly share code, notes, and snippets.

View mbmccormick's full-sized avatar

Matt McCormick mbmccormick

View GitHub Profile
@mbmccormick
mbmccormick / gist:1345367
Created November 7, 2011 16:05
Gist caching and download logic.
<?php
// extract gist id from url
$gist = $_GET[id];
// create cache directory
if (file_exists("gists/") == false)
mkdir("gists", 0700);
// check if we have need to update our local copy of the gist
@mbmccormick
mbmccormick / gist:1396098
Created November 26, 2011 18:29
Adding Turnstyle transitions to Windows Phone applications
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
@mbmccormick
mbmccormick / gist:1396105
Created November 26, 2011 18:32
Add Progress Bar to System Tray
ProgressIndicator progressIndicator = new ProgressIndicator();
SystemTray.ProgressIndicator = progressIndicator;
progressIndicator.IsVisible = true;
progressIndicator.IsIndeterminate = true;
@mbmccormick
mbmccormick / gist:1560472
Created January 4, 2012 15:15
Import Legacy mbox Files into Gmail
python imap_upload.py --gmail --box Imported "C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles\XXXXXXXX.default\Mail\pop-server.wi.rr.com\Inbox"
@mbmccormick
mbmccormick / gist:1872905
Created February 21, 2012 01:55
Remove application from Windows Phone Marketplace while another submission is being certified. Run this in a JavaScript console while viewing the Application Details page.
ApplicationDetails.onSubmitAction('1', '<your application id>', '<your application instance id>', '1', 'False');
@mbmccormick
mbmccormick / gist:1934178
Created February 28, 2012 18:32
/cs354/lab03/notes

Hints

Similar to proctab, there should be something like pipetab which is seen system-wide. Most of the data manipulation will be using this pipetab only.

The pipid32 type is a typedef of int.

Test Cases

Consider during an on-going pipe operation, if the pipe owner calls pipdisconnect or pipdelete, then do the following:

@mbmccormick
mbmccormick / gist:1978607
Created March 5, 2012 14:48
Enable cross-domain resource sharing on a WCF web service, this is pretty dirty.
[WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/common/helloWorld?name={name}")]
public string HelloWorld(string name)
{
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
return "Hello World! Your name is " + name + ".";
}
@mbmccormick
mbmccormick / gist:1979285
Created March 5, 2012 17:00
Sample MobileClientLibrary call
public static void Main(string[] args)
{
WebServiceClient client = new WebServiceClient("YOUR_API_KEY");
client.FetchAllUsersCompleted += new RequestCompletedEventHandler(client_FetchAllUsersCompleted);
client.FetchAllUsers();
}
private static void client_FetchAllUsersCompleted(object sender, RequestCompletedEventArgs e)
{
@mbmccormick
mbmccormick / SettingsPage.xaml
Created March 6, 2012 02:35
Settings page used in Milkman
<phone:PhoneApplicationPage
x:Class="Milkman.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
@mbmccormick
mbmccormick / gist:1983036
Created March 6, 2012 02:44
Add Task dialog used in Milkman
<UserControl x:Class="Milkman.AddTaskDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="Black"