Skip to content

Instantly share code, notes, and snippets.

View motowilliams's full-sized avatar

Eric Williams motowilliams

View GitHub Profile
@kennethreitz
kennethreitz / sync.py
Created October 10, 2010 19:08
GitHub Syncer. Clones or Pulls all GitHub repos (including watched list).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
@darrelmiller
darrelmiller / gist:1036674
Created June 20, 2011 21:49
Creating the hal spec example using Hal.net
var hal = HalDocument.Create(new Uri("http://example.org"));
hal.AddNamespace("td", new Uri("http://mytodoapp.com/rels/"));
hal.AddLink("td:search", new Uri("/todo-list/search;{searchterm}",UriKind.Relative));
hal.AddLink("td:description", new Uri("/todo-list/description", UriKind.Relative));
hal.AddProperty("created_at", "2010-01-16");
hal.AddProperty("updated_at", "2010-02-21");
hal.AddProperty("summary", "An example list");
hal.CreateResource("td:owner", new Uri("http://range14sux.com/mike"))
@jstangroome
jstangroome / install.ps1
Created August 14, 2011 03:40
Example Nuget package install script in C#
param ($InstallPath, $ToolsPath, $Package, $Project)
Add-Type -Language CSharpVersion3 -TypeDefinition @'
public class MyPackage {
public static void Execute(string installPath, string toolsPath, object package, object Project) {
// implement Nuget init, install, uninstall script as C#
System.Console.WriteLine(installPath);
}
}
'@
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller31"
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller45"
# Powershell
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell"
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell2"
# .NET
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework20SP2"
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework35"
@motowilliams
motowilliams / ServiceStackTextFormatter.cs
Created February 22, 2012 04:03
aspnet web api json MediaTypeFormatter using Servicestack.Text
public class ServiceStackTextFormatter : MediaTypeFormatter
{
public ServiceStackTextFormatter()
{
// Fill out the mediatype and encoding we support
SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json"));
Encoding = new UTF8Encoding(false, true);
}
protected override Task<object> OnReadFromStreamAsync(Type type, Stream stream, HttpContentHeaders contentHeaders, FormatterContext formatterContext)
@half-ogre
half-ogre / NuGet.targets.xml
Created February 22, 2012 04:22
A replacement for the NuGet.targets file that requires nuget.exe be on the path, so you don't have to commit it.
<?xml version="1.0" encoding="utf-8"?>
<!-- #### NOTE #### -->
<!-- To build with Mono's xbuild on bash, you must execute [`sudo install-nuget.sh`](https://gist.github.com/2595337) first. -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<!-- Windows specific commands -->
public class LoggingFormatterSelector : IFormatterSelector
{
private readonly FormatterSelector _FormatterSelector = new FormatterSelector();
public new MediaTypeFormatter SelectReadFormatter(Type type, FormatterContext formatterContext, IEnumerable<MediaTypeFormatter> formatters)
{
string descriptFormatterContext = GetDescriptFormatterContext(formatterContext);
Console.WriteLine("Selecting Read Formatter for type {0} based on formatter context: {1}", type.Name, descriptFormatterContext);
$dontcare = git fetch origin --prune
$branches = git branch -a --merged |
?{$_ -match "remotes\/origin"} |
?{$_ -notmatch "\/master"} |
%{$_.Replace("remotes/origin/", "").Trim() }
if (-not $branches) {
echo "No merged branches detected"
exit 0
}
@dahlbyk
dahlbyk / .gitconfig
Created March 1, 2012 14:29
Windows Git Diff/Merge Tool Configuration
[alias]
dt = difftool
mt = mergetool
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool "p4"]