Skip to content

Instantly share code, notes, and snippets.

View brantb's full-sized avatar

Brant Bobby brantb

View GitHub Profile
@brantb
brantb / main.tf
Last active January 22, 2019 21:43
data "azurerm_subscriptions" "available" {}
output "subscriptions" {
value = "${data.azurerm_subscriptions.available.subscriptions}"
}
/*
Sample output:
subscriptions = [
{
goroutine 438210 [running]:
runtime/pprof.writeGoroutineStacks(0x140b660, 0xc420338a80, 0x410079, 0xc421817aa0)
/usr/local/go/src/runtime/pprof/pprof.go:650 +0xa7
runtime/pprof.writeGoroutine(0x140b660, 0xc420338a80, 0x2, 0xc42005f000, 0x140b440)
/usr/local/go/src/runtime/pprof/pprof.go:639 +0x44
runtime/pprof.(*Profile).WriteTo(0x1bd1a40, 0x140b660, 0xc420338a80, 0x2, 0xc420338a80, 0x13014b8)
/usr/local/go/src/runtime/pprof/pprof.go:310 +0x3e4
net/http/pprof.handler.ServeHTTP(0xc426b860d1, 0x9, 0x1424100, 0xc420338a80, 0xc426299000)
/usr/local/go/src/net/http/pprof/pprof.go:243 +0x20d
net/http/pprof.Index(0x1424100, 0xc420338a80, 0xc426299000)
@brantb
brantb / Manifest.Tests.ps1
Last active October 17, 2017 17:54
Pester test suite for module manifest
$ModuleManifestName = 'MyModuleName.psd1'
$ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName"
Describe 'Module Manifest Tests' {
# Test-ModuleManifest is slooooooow for some reason :(
It 'Passes Test-ModuleManifest' -Skip {
Test-ModuleManifest -Path $ModuleManifestPath
$? | Should Be $true
}
rmo Pester -Force
ipmo Pester -MaximumVersion '4.0.8'
Invoke-Pester .\sut.ps1
rmo Pester -Force
ipmo Pester -MaximumVersion '3.6.0'
Invoke-Pester .\sut.ps1
<# Output:
Describe 'Mocking Azure Powershell cmdlets' {
Mock New-AzureRmResource { Write-Host "Mock invoked" }
It 'Does not throw an exception' {
New-AzureRmResource -Properties @{} -ResourceId foo
}
}
<#
Without running Login-AzureRmAccount:
# npm install gulp gulp-util gulp-mocha mocha coffee-script assert
gulp = require 'gulp'
gutil = require 'gulp-util'
mocha = require 'gulp-mocha'
gulp.task 'test', ->
gulp.src('test.coffee').pipe(mocha()).on('error', gutil.log)
gulp.task 'default', ->
gulp.watch('test.coffee', 'test').on('error', gutil.log)
@brantb
brantb / gist:7548185
Created November 19, 2013 16:31
Well, that was not what I expected.
public class Source { public string Property { get; set; } }
public class Dest { public string Property { get; private set; } }
[Fact]
public void Wat()
{
Mapper.CreateMap<Source, Dest>();
var source = new Source {Property = "foo"};
var dest = Mapper.Map<Dest>(source);
@brantb
brantb / foo.bar.js
Created June 19, 2012 03:28
volo.js testcase
/*package.json
{
"volo": {
"dependencies": {
"jquery": "jquery/jquery"
}
}
}
*/
(function (root, factory) {
@brantb
brantb / cmd.exe
Created June 11, 2012 16:32
Error installing grunt via npm on Windows 7
C:\Users\bbobby\Code>npm install -g grunt
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/dateformat/1.0.2-1.2.3
npm http GET https://registry.npmjs.org/glob-whatev
npm http GET https://registry.npmjs.org/hooker
npm http GET https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/prompt
npm http GET https://registry.npmjs.org/semver
@brantb
brantb / gist:2503619
Created April 26, 2012 22:16
Output of `gradle jshint --debug`
17:13:36.706 [ERROR] [org.gradle.BuildExceptionReporter]
17:13:36.709 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
17:13:36.710 [ERROR] [org.gradle.BuildExceptionReporter]
17:13:36.714 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
17:13:36.715 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':jshint'.
17:13:36.716 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find property 'rhino' on configuration container.
17:13:36.716 [ERROR] [org.gradle.BuildExceptionReporter]
17:13:36.717 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
17:13:36.718 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jshint'.
17:13:36.719 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)