Skip to content

Instantly share code, notes, and snippets.

@Swoogan
Swoogan / app.js
Last active September 30, 2015 01:19
Angular test example
angular.module('testModule', []).controller('TestCont', function ($scope) {
$scope.message = 'hello';
}
describe('testModule module', function(){
beforeEach(module('testModule'));
describe('test controller', function(){
var scope, testCont;
@Swoogan
Swoogan / Exec
Created May 13, 2015 15:26
Wrapping commandline tools in a scriptblock to improve error handling
function Exec([scriptblock]$cmd) {
$result = & $cmd
if ($LastExitCode -ne 0) {
throw $result[-50..-1] -join "`n"
}
else {
foreach ($line in $result) {
Write-Host $line
}
}
@Swoogan
Swoogan / Find-Unreplaced
Last active August 29, 2015 14:21
PowerShell script to find Octopus Variable tokens that haven't been replaced
function Find-Unreplaced {
<#
.SYNOPSIS
Looks for Octopus Deploy variables
.DESCRIPTION
Analyses `Web/App.Release.configs`, etc... looking for Octopus Deploy
variables that have not been replaced.
.EXAMPLE
Find-Unreplaced C:\Folder *.config, *.ps1
.PARAMETER Path
public struct DocIdLookup
{
public List<string> DocIds;
public int Index;
}
public class Indexer
{
private readonly Dictionary<string, List<string>> _terms =
new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);