Skip to content

Instantly share code, notes, and snippets.

View DanTup's full-sized avatar

Danny Tuppeny DanTup

  • Coded Consultants Ltd
  • England, UK
  • 07:36 (UTC +01:00)
  • X @DanTup
View GitHub Profile
@DanTup
DanTup / VS References Yuml.ps1
Last active October 4, 2015 10:47
Output Visual Studio project references for yuml.me
function Get-ProjectReferences
{
param(
[Parameter(Mandatory)]
[string]$rootFolder,
[string[]]$excludeProjectsContaining
)
dir $rootFolder -Filter *.csproj -Recurse |
@DanTup
DanTup / StructureMapRepoBug.cs
Created May 7, 2012 15:05
StructureMap SingleImplementationsOfInterface bug
namespace StructureMapBugRepro
{
using System;
using StructureMap;
using StructureMapBugRepo.NS1;
using StructureMapBugRepo.NS2;
public class Program
{
static void Main(string[] args)
@DanTup
DanTup / SyncKilnAndGitHub.ps1
Last active December 14, 2015 20:39
Scripts to sync a GitHub repo to Kiln to allw GitHub contributions without using Git (use Hg on your Kiln repos!).
<#
.SYNOPSIS
Script to sync a GitHub repo to Kiln to allw GitHub contributions without using Git (use Hg on your Kiln repos!).
.DESCRIPTION
Create a branch repo in Kiln specifically for for the GitHub sync and run this PS script periodically (PoSh v3
scheduled jobs make this easy).
Merge the GitHub branch repo (using Hg!) into your main repo periodically, then push back to the GitHub branch
once done. This will be sync'd back to GitHub when the script next runs.
@DanTup
DanTup / LaunchKiln.ps1
Last active May 11, 2018 18:43
PowerShell function to launch Kiln in a browser for the repo you're currently in.
# Launch Kiln for current repo
Function Kiln
{
if (Test-Path ".\.hg\hgrc")
{
$repoUrl = (Select-String "default = (.*)" -Path ".\.hg\hgrc" -AllMatches).Matches.Groups[1].Value
Start $repoUrl
}
else
{ Write-Warning "Not in a repo!" }
@DanTup
DanTup / default.htm
Created July 9, 2013 15:24
Strange IE10 issue. In IE7/8/9 this code will throw an error (attributes["onchange"] returns null). But in IE10, magic happens, and attributes["onchange"] returns attributes["name"] and the code alerts the name of the element!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
</head>
<frameset rows="70,*">
<frame src="about:blank">
<frameset cols="165,*">
<frame src="about:blank">
<frame src="settings.htm">
let [<Given>] ``something`` () = ()
let [<Given>] ``something else`` () = ()
---
Scenario: TestStuff
Given something
and something else
----
@DanTup
DanTup / PowerShellHere.reg
Created February 1, 2014 11:28
Creates "PowerShell Here" shortcuts on context menu for right-clicking folders, blank background space, blank background space in libraries. Preserves default PowerShell colours/settings.
Windows Registry Editor Version 5.00
; Creates "PowerShell Here" shortcuts on context menu for
;
; a) right-clicking on a folder
; b) right-clicking in the blank space when inside a folder (eg. already inside the folder)
; c) right-clicking in the blank space when inside a folder that's inside a library
;
; Uses cmd start to launch normal Powershell shortcut so that the normal PowerShell shortcut
; colours/settings are preserved (blue, not black/white)
@DanTup
DanTup / npm error
Created March 19, 2014 12:35
Error when trying to grab AngularJS from GitHub via NPM
PS M:\Coding\TestApps\AngularTest> npm install angular/angular.js --save-dev
npm ERR! git fetch -a origin (git://github.com/angular/angular.js) fatal: refs/remotes/origin/v1.0.x tracks both refs/heads/v1.0.x and refs/remotes/origin/v1.0.x
// A list of all event types; these are basically used as strings, because we can't(?)
// get a nice unique name from a TS Class to use for the event name
enum EventType {
SendTheStuff
};
// All events must at least give us the EventType that we can convert to a string
interface IEvent {
EventType: EventType;
};
@DanTup
DanTup / simple_serialization_tests.dart
Created August 7, 2014 12:06 — forked from sethladd/simple_serialization_tests.dart
+ support for child objects (sorry if it's bad; written in Notepad and don't really know Dart!)
import 'dart:convert';
import 'package:smoke/smoke.dart' as smoke;
@MirrorsUsed(targets: const [SimpleWithMirrors, Simple], override: '*')
import 'dart:mirrors';
abstract class Serializable {
static fromJson(Type t, Map json) {
var typeMirror = reflectType(t);
T obj = typeMirror.newInstance(new Symbol(""), const[]).reflectee;