Skip to content

Instantly share code, notes, and snippets.

View jongalloway's full-sized avatar

Jon Galloway jongalloway

View GitHub Profile
@jongalloway
jongalloway / RemoveAllStoreApps
Created October 17, 2014 23:57
Remove all Windows Store apps (useful for small VM)
Get-AppxPackage | Remove-AppxPackage
@jongalloway
jongalloway / MarkdownPackager.cs
Last active August 29, 2015 14:15
Recursive Markdown Compiler (with Image URI inline)
using Strike.IE;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
namespace TrainingKitPackager
{
class Program
@jongalloway
jongalloway / markdown-deep-delegate-hooks.ps1
Created February 23, 2015 21:14
MarkdownDeep Delegate Hooks
md.PrepareImage = delegate(MarkdownDeep.HtmlTag tag, bool TitledImage)
{
//Compress PNG
string relPath = tag.attributes["src"].Replace('/', '\\').Replace("?raw=true", "");
string path = Path.Combine(file.DirectoryName, relPath);
Console.WriteLine("\tProcessing image: {0}", path);
System.Drawing.Bitmap img = (Bitmap)Bitmap.FromFile(path);
var quant = new nQuant.WuQuantizer();
var ms = new MemoryStream();
@jongalloway
jongalloway / index.html
Created February 24, 2015 00:21
qEYPqw
<h2>Testing custom link renderer with Marked.js</h2>
<div class="container">
<div class="row">
<div class="col-md-6">
<textarea class="form-control" id=input rows="30">
Enter Markdown here. This should append /readme.htm to any relative link to a path (not a document).
* [Self anchor link](#do-not-change-me)
* [Another doc anchor](/chocolate/#change-me)
* [Another doc with path](/chocolate/cake.htm)
@jongalloway
jongalloway / LiveWriterLookup.cs
Created May 19, 2011 23:53
Retrieving Live Writer account credentials via LiveWriter API
//Source: Last comment at http://lozanotek.com/blog/archive/2007/07/22/Using_The_Windows_Live_Writer_API_To_Retrieve_Your_Blog_Password.aspx
using System;
using Microsoft.Win32;
// Add a ref to C:\Program Files\Windows Live\Writer\WindowsLive.Writer.BlogClient.dll
using WindowsLive.Writer.BlogClient;
// Add a ref to C:\Program Files\Windows Live\Writer\WindowsLive.Writer.CoreServices.dll
using WindowsLive.Writer.CoreServices.Settings;
using WindowsLive.Writer.CoreServices;
using System;
using System.Diagnostics;
using System.Net;
namespace ConsoleApplication1 {
internal class Program {
private const int COUNT = 20;
private static void Main() {
var urls = new[] {
@jongalloway
jongalloway / DynamicModelcontroller.cs
Created May 27, 2011 00:17
ASP.NET MVC - Dynamic Model w/ Mono compiler as a service
using System.IO;
using System.Reflection;
using System.Web.Mvc;
using Mono.CSharp;
using System;
namespace DynamicModelCompilation.Controllers
{
public class HomeController : Controller
{
public class CurrentTimeGetter
{
private volatile Holder _holder;
const String rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
public string GetCurrentTimeAsString()
{
DateTime now = DateTime.UtcNow;
Holder currentHolder = _holder;
@jongalloway
jongalloway / feeds-rss2.php
Created January 7, 2012 00:17
Lame hack in WordPress feeds-rss2.php to work around Feedburner's 512K limit. I later moved this into a plugin, Excerpt Old Posts (in the WordPress plugins directory)
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
@jongalloway
jongalloway / sublime_text.bat
Created January 26, 2012 03:04
Chocolatey - launching apps via PowerShell
if not "%*" =="" SET args = "-argumentlist \"%*\"
powershell -command "start-process -filepath \"..\lib\sublimetext2.2.0.2165\tools\sublime_text.exe\" %args%"