Skip to content

Instantly share code, notes, and snippets.

@DanTup
DanTup / simple_serialization_tests.dart
Created Aug 7, 2014 — 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!)
View simple_serialization_tests.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;
View Events.ts
// 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 / npm error
Created Mar 19, 2014
Error when trying to grab AngularJS from GitHub via NPM
View npm error
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
@DanTup
DanTup / PowerShellHere.reg
Created Feb 1, 2014
Creates "PowerShell Here" shortcuts on context menu for right-clicking folders, blank background space, blank background space in libraries. Preserves default PowerShell colours/settings.
View PowerShellHere.reg
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)
View TickSpec.fs
let [<Given>] ``something`` () = ()
let [<Given>] ``something else`` () = ()
---
Scenario: TestStuff
Given something
and something else
----
@DanTup
DanTup / default.htm
Created Jul 9, 2013
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!
View default.htm
<!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">
@DanTup
DanTup / LaunchKiln.ps1
Last active May 11, 2018
PowerShell function to launch Kiln in a browser for the repo you're currently in.
View LaunchKiln.ps1
# 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 / SyncKilnAndGitHub.ps1
Last active Dec 14, 2015
Scripts to sync a GitHub repo to Kiln to allw GitHub contributions without using Git (use Hg on your Kiln repos!).
View SyncKilnAndGitHub.ps1
<#
.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 / StructureMapRepoBug.cs
Created May 7, 2012
StructureMap SingleImplementationsOfInterface bug
View StructureMapRepoBug.cs
namespace StructureMapBugRepro
{
using System;
using StructureMap;
using StructureMapBugRepo.NS1;
using StructureMapBugRepo.NS2;
public class Program
{
static void Main(string[] args)
@DanTup
DanTup / VS References Yuml.ps1
Last active Oct 4, 2015
Output Visual Studio project references for yuml.me
View VS References Yuml.ps1
function Get-ProjectReferences
{
param(
[Parameter(Mandatory)]
[string]$rootFolder,
[string[]]$excludeProjectsContaining
)
dir $rootFolder -Filter *.csproj -Recurse |
You can’t perform that action at this time.