Skip to content

Instantly share code, notes, and snippets.

View jgable's full-sized avatar

Jacob Gable jgable

  • Making Other People Money
  • San Carlos, CA
  • X @jacob4u2
View GitHub Profile
@jgable
jgable / TeamResponses.cs
Created March 24, 2011 14:42
TeamResponses - For the Team Demo at Hackatopia
using System;
using System.Collections.Generic;
/// <summary>
/// Our Hello response object; /Index action
/// </summary>
public class HelloWorldResponse
{
public bool Success { get; set; }
public DateTime Time { get; set; }
@jgable
jgable / Gist4u2.ps1
Created March 24, 2011 00:10
Gist4u2 - A set of powershell CmdLet's for adding in-line gists; intended for the NuGet Package Manager
# Serializer loader
$extAssembly = [Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$serializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer
# Url's formatted
$gistUserListUrlForm = "http://gist.github.com/api/v1/json/gists/{0}";
$gistInfoUrlForm = "http://gist.github.com/api/v1/json/{0}";
$gistContentsUrlForm = "http://gist.github.com/raw/{0}/{1}";
# Json downloader
@jgable
jgable / TeamController.cs
Created March 23, 2011 23:51
TeamController - Hackatopia Team Demo Controller
using System;
using System.Linq;
using System.Web.Mvc;
using JSONPhoneApp1.Web.Models;
public class TeamController : Controller
{
// Our Team data; fake data is loaded in the constructor.
private static TeamRepository _teams = new TeamRepository();
@jgable
jgable / HelloWorldVM.cs
Created March 23, 2011 22:37
PivotVM's and MainPage Pivot View for Hackatopia Demo
using System;
using System.Windows;
using System.Windows.Input;
using JSONPhoneApp1.Common;
using JSONPhoneApp1.Service;
public class HelloWorldVM : ViewModelBase
{
private HelloWorldService _helloServ = new HelloWorldService();
@jgable
jgable / MVVMCommon.cs
Created March 23, 2011 19:47
MVVMCommon contains a VM Base and Commanding Helpers for Windows Phone 7 or Silverlight 3
using System;
using System.ComponentModel;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
/// <summary>
/// Base class for Viewmodels providing common INotifyPropertyChanged functionality.
/// </summary>
public abstract class ViewModelBase : INotifyPropertyChanged
@jgable
jgable / TeamRepository.cs
Created March 23, 2011 15:19
TeamRepository and Models for a demo project.
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Team information
/// </summary>
public class Team
{
public int Id { get; set; }
@jgable
jgable / Postifier.cs
Created March 22, 2011 18:05
Helps turn any object into a URL Form Encoded string version, including lists of complex objects.
using System;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Extensions to help postify parameters.
/// </summary>
public static class PostifyExtensions
{
private static Postifier postifier = new Postifier();
@jgable
jgable / JsonService.cs
Created March 22, 2011 17:49
A basic JsonService using WebClient and DataContractJsonSerializer for Windows Phone 7, along with an example of how to use it.
using System;
using System.IO;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;
/// <summary>
/// Strongly typed GET and POST utility enum.
/// </summary>
public enum HTTPMethod
@jgable
jgable / DataGridColumnBindableHeaderBehavior.cs
Created March 8, 2011 01:45
A simple behavior for adding a bindable column header to a DataGridTextColumn (or any other DataGridColumn)
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interactivity;
public class BindableColumnHeader : Behavior<DataGridColumn>
{
/// <summary>
/// The <see cref="Header" /> dependency property's name.
/// </summary>
public const string HeaderPropertyName = "Header";
@jgable
jgable / UpdateSourceOnTextChanged.cs
Created February 28, 2011 15:52
Updates a source binding for a TextBox when the text changes and not just when the box loses focus.
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Interactivity;
public class UpdateSourceOnTextChanged : Behavior<TextBox>
{
BindingExpression textBinding;
protected override void OnAttached()
{