Skip to content

Instantly share code, notes, and snippets.

@joebuschmann
joebuschmann / iis_create_website.bat
Created June 6, 2014 12:09
A batch script that builds out a website, virtual directory, application, and app pool using AppCmd.exe
CD %systemroot%\system32\inetsrv
REM Add a new site and enable Windows authentication
MKDIR C:\Blogs
APPCMD add site /name:Blogs /bindings:"http/*:81:" /physicalPath:"C:\Blogs"
APPCMD set config "Blogs" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost
REM Create a virtual directory
MKDIR C:\Blogs\Technology
APPCMD add vdir /app.name:"Blogs/" /path:/Technology /physicalPath:C:\Blogs\Technology
@joebuschmann
joebuschmann / disqus-post.hbs
Created September 25, 2014 22:46
HTML snippet to add Disqus comments to a Ghost theme
<section>
<hr />
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'joebuschmann'; // required: replace example with your forum shortname
var disqus_identifier = '{{id}}';
/* * * DON'T EDIT BELOW THIS LINE * * */
@joebuschmann
joebuschmann / social.links.config.js
Created September 26, 2014 13:18
Configuration file for my social URLs
@joebuschmann
joebuschmann / social.links.load.js
Created September 26, 2014 13:20
Javascript snippet to scan a web page for anchor elements marked with the "social-link" attribute and load the URL from a config file
@joebuschmann
joebuschmann / package_ghost_theme.sh
Created September 26, 2014 16:48
Script to zip up a modified Casper theme for uploading to a Ghost blog
#!/bin/sh
# Execute this script from the content/themes directory.
# This script copies the Casper theme in the "Casper" directory
# to a new directory with the new theme name. Then it creates
# a .zip file with the new directory's contents.
# New theme name. Update if you aren't Joe Buschmann :-)
THEME_NAME="Casper-JoeBuschmann"
readonly THEME_NAME
@joebuschmann
joebuschmann / Calculator.feature
Created September 29, 2014 21:54
Default feature generated by Specflow
Feature: Calculator
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
@joebuschmann
joebuschmann / Calculator.ScenarioContext.cs
Last active August 29, 2015 14:07
Implementation of Specflow's default calculator feature using ScenarioContext to maintain state
[Binding]
public class CalculatorSteps
{
private const string CalculatorValues = "calculatorValues";
private const string CalculationResult = "calculationResult";
[Given(@"I have entered (.*) into the calculator")]
public void GivenIHaveEnteredIntoTheCalculator(int num)
{
List<int> values;
@joebuschmann
joebuschmann / Calculator.PrivateMembers.cs
Last active August 29, 2015 14:07
Implementation of Specflow's default calculator feature using private members to maintain state
[Binding]
public class CalculatorSteps
{
private readonly List<int> _values = new List<int>();
private int _result;
[Given(@"I have entered (.*) into the calculator")]
public void GivenIHaveEnteredIntoTheCalculator(int num)
{
_values.Add(num);
@joebuschmann
joebuschmann / Calculator.ContextObject.cs
Last active August 29, 2015 14:07
Implementation of Specflow's default calculator feature using a context object to maintain state
[Binding]
public class CalculatorSteps
{
private readonly CalculatorContext _calculatorContext;
public ContextObjectSteps(CalculatorContext calculatorContext)
{
_calculatorContext = calculatorContext;
}
@joebuschmann
joebuschmann / Calculator.DomainObject.cs
Last active August 29, 2015 14:07
Implementation of Specflow's default calculator feature using a Domain Object to maintain state
[Binding]
public class CalculatorSteps
{
private readonly Calculator _calculator;
public DomainObjectSteps(Calculator calculator)
{
_calculator = calculator;
}