Skip to content

Instantly share code, notes, and snippets.

View mbmccormick's full-sized avatar

Matt McCormick mbmccormick

View GitHub Profile
@mbmccormick
mbmccormick / gist:2210715
Created March 26, 2012 23:41
Uploading an image to Winstagram
WebServiceClient client = null;
public static void Main(string[] args)
{
client = new WebServiceClient("YOUR_API_KEY");
// login with user's credentials
client.AuthenticateCompleted += new RequestCompletedEventHandler(client_AuthenticateCompleted);
client.Authenticate("YOUR_USERNAME", "YOUR_PASSWORD");
}
/* lflistdir.c - lflistdir */
#include <xinu.h>
/*------------------------------------------------------------------------
* lflistdir - List all valid files within the XINU flat file system
*------------------------------------------------------------------------
*/
syscall lflistdir(
did32 diskdev /* ID of device to read from */
$ updatewp /iu diff-7.10.8107.79-7.10.8112.7-armv7-retail-microsoft-pluspkr.pks_d500a10eeb11fb6c1913adac4759d67185474d3e.cab diff-7.10.8107.79-7.10.8112.7-armv7-retail-microsoft.lang_0409.pks_ae068921fd637ba2e3e268b28e6ca1c9f3a9c11f.cab
$ updatewp /iu diff-7.10.8112.7-7.10.8773.98-armv7-retail-microsoft.pks_113460c78ac6233e3bb776ceddb6ac94e98c4221.cab diff-7.10.8112.7-7.10.8773.98-armv7-retail-microsoft.lang_0409.pks_3e940c840ee4815422610bb6da8f28ac327767cc.cab
@mbmccormick
mbmccormick / gist:3555204
Created August 31, 2012 16:09
Shit that annoys me.
public int FetchMediumType(string device)
{
SQLSelect select = new SQLSelect(Connection);
select.Columns("MediumType");
select.From("dbo.Links");
select.Distinct = true;
select.Where("FromPort", Op.Like, device)
.Or("ToPort", Op.Like, device);
@mbmccormick
mbmccormick / gist:3621333
Created September 4, 2012 13:52
Formatting Twitter Direct Messages as email message
DirectMessage message = _messages.get(Integer.parseInt(line.substring(5, line.length())));
SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
out.println("+OK " + message.getText().length() + " octets");
out.println("From: " + message.getSender().getScreenName() + "@twitter.com (" + message.getSender().getName() + ")");
out.println("Subject: Direct Message from " + message.getSender().getName());
out.println("Date: " + formatter.format(message.getCreatedAt()));
out.println("Message-Id: <" + message.getId() + "@twitter.com>");
out.println("");
@mbmccormick
mbmccormick / gist:3766456
Created September 22, 2012 15:03
Authorize desktop application with Fitbit API
Authenticator authorizer = new Authenticator("YOUR_CONSUMER_KEY", "YOUR_CONSUMER_SECRET",
"http://api.fitbit.com/oauth/request_token",
"http://api.fitbit.com/oauth/access_token",
"http://www.fitbit.com/oauth/authorize");
string url = authorizer.GetAuthUrlToken();
Console.WriteLine("Authorization URL: " + url);
string tempAuthToken;
@mbmccormick
mbmccormick / 0001-Updating-CustomMessageBox-control-to-handle-SystemTr.patch
Created November 1, 2012 13:52
Updates the CustomMessageBox control to account for the SystemTray opacity property, similar to how the color property is being handled. This is needed when using the CustomMessageBox control with a page (such as Panorama control) that has a transparent S
From ffc6d879979b1290818de3ea7eb5dcf1e1f208bc Mon Sep 17 00:00:00 2001
From: Matt McCormick <[email protected]>
Date: Thu, 1 Nov 2012 09:43:59 -0400
Subject: [PATCH] Updating CustomMessageBox control to handle SystemTray
opacity properly.
---
.../CustomMessageBox/CustomMessageBox.cs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
@mbmccormick
mbmccormick / rtm-weather.lua
Created November 20, 2012 23:26
Remember The Milk umbrella reminder using http://webscript.io
local lom = require 'lxp.lom'
local xpath = require 'xpath'
local response = http.request {
-- 2517274 is the WOEID for West Lafayette, IN
url = 'http://weather.yahooapis.com/forecastrss?w=2517274'
}
local hour = tonumber(os.date('%H'))
if (hour == 4) then -- 11:00pm eastern time
@mbmccormick
mbmccormick / gist:4176825
Created November 30, 2012 16:34
Creating a FlipTile through reflection in Windows Phone 7.1
public static void CreateFlipTile(Uri tileId, string title, int count, string backTitle, string backContent, Uri smallBackgroundImage, Uri backgroundImage, Uri backBackgroundImage, Uri wideBackgroundImage, Uri wideBackBackgroundImage, string wideBackContent)
{
// Get the new FlipTileData type.
Type flipTileDataType = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone");
// Get the ShellTile type so we can call the new version of "Create" that takes the new Tile templates.
Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
// Get the constructor for the new FlipTileData class and assign it to our variable to hold the Tile properties.
var CreateTileData = flipTileDataType.GetConstructor(new Type[] { }).Invoke(null);
@mbmccormick
mbmccormick / gist:4176835
Created November 30, 2012 16:35
Updating a FlipTile through reflection in Windows Phone 7.1
public static void UpdateFlipTile(Uri tileId, string title, int count, string backTitle, string backContent, Uri smallBackgroundImage, Uri backgroundImage, Uri backBackgroundImage, Uri wideBackgroundImage, Uri wideBackBackgroundImage, string wideBackContent)
{
// Get the new FlipTileData type.
Type flipTileDataType = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone");
// Get the ShellTile type so we can call the new version of "Update" that takes the new Tile templates.
Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
// Loop through any existing Tiles that are pinned to Start.
foreach (var tileToUpdate in ShellTile.ActiveTiles)