Skip to content

Instantly share code, notes, and snippets.

Jonathan Counihan jonathancounihan

View GitHub Profile
@jonathancounihan
jonathancounihan / Enable-Transformations.md
Created May 14, 2019 — forked from EdCharbeneau/Enable-Transformations.md
How to enable transformations on build with Visual Studio
View Enable-Transformations.md

#Transform web.config on build

  1. Unload the project
  2. Edit .csproj
  3. Append figure 1 to the end of the file just before </Project>; v12.0 my change depending on your version of Visual Studio
  4. Save .csproj and reload
  5. Open configuration manager
  6. Add a new Configuration Name: Base. Copy settings from: Release
  7. Copy the contents of your web.config
  8. Right click Web.Config > Add Config Transformation
@jonathancounihan
jonathancounihan / range.knockout.js
Created May 12, 2019 — forked from hereswhatidid/range.knockout.js
Knockout extender to force a field to be an integer value within a specified range.
View range.knockout.js
ko.extenders.range = function( target, intRange ) {
//create a writeable computed observable to intercept writes to our observable
var result = ko.computed({
read: target, //always return the original observables value
write: function( newValue ) {
var current = target(),
newValueAsNum = isNaN( newValue ) ? 0 : parseInt( +newValue, 10 ),
valueToWrite = newValueAsNum;
if ( newValueAsNum < intRange.min ) {
@jonathancounihan
jonathancounihan / prepare-commit-msg.sh
Last active Oct 13, 2018 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
View prepare-commit-msg.sh
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@jonathancounihan
jonathancounihan / index.html
Created Nov 20, 2017 — forked from nimbupani/index.html
Showing latest post on home page with Jekyll
View index.html
---
layout: default
---
<div class="blog-index">
{% assign post = site.posts.first %}
{% assign content = post.content %}
{% include post_detail.html %}
</div>
@jonathancounihan
jonathancounihan / XE_Dynamic_Shred__LongRunningQueries
Created Dec 12, 2016 — forked from mbourgon/XE_Dynamic_Shred__LongRunningQueries
Using Extended Events to find long-running queries, with a dynamic XML shred and PIVOT to simplify the code
View XE_Dynamic_Shred__LongRunningQueries
--written by MDB and ALM for TheBakingDBA.Blogspot.Com
-- basic XE session creation written by Pinal Dave
-- http://blog.sqlauthority.com/2010/03/29/sql-server-introduction-to-extended-events-finding-long-running-queries/
-- mdb 2015/03/13 1.1 - added a query to the ring buffer's header to get # of events run, more comments
-- mdb 2015/03/13 1.2 - added model_end events, filtering on hostname, using TRACK_CAUSALITY, and multiple events
-- mdb 2015/03/18 1.3 - changed header parse to dynamic, courtesy of Mikael Eriksson on StackOverflow
-- This runs on at 2008++ (tested on 2008, 2008R2, 2012, and 2014). Because of that, no NOT LIKE exclusion
------------------------------
-- Create the Event Session --
------------------------------
View RoboCopyWithErrorChecking.ps1
function InvokeRoboCopyCommandWithErrorChecking ($command, $errorMessage) {
$global:LASTEXITCODE = 0
[int[]]$errorCodes = @(8,16)
#Write-Host $command
Invoke-Expression $command -ErrorAction Stop
$roboCopyExitCode = $global:LASTEXITCODE;
# Below is taken from http://stackoverflow.com/questions/21428632/powershell-bitwise-comparison-for-robocopy-exit-codes
@jonathancounihan
jonathancounihan / GenerateJsonFromGitLog.ps1
Last active Oct 12, 2016
Generate json from git logs in powershell
View GenerateJsonFromGitLog.ps1
<#
Generate the change log in json
#>
param(
[ValidateSet("True","False", 0, 1)]
[ValidateNotNullOrEmpty()]
[string]$OutputAsString = "False",
[string]$OutputFilename = "changelog.json",
[string]$GitDirectory = ""
)
@jonathancounihan
jonathancounihan / dupfinder.cmd
Last active Aug 29, 2015
How to use JetBrains Duplicate Finder with using Twitter Bootstrap Styling.
View dupfinder.cmd
pushd "C:/Projects/Software/Dev/"
"C:\Tools\jb-commandline-8.0.0.39\dupfinder.exe" /idle-priority /show-stats /show-text /debug /normalize-types /exclude-code-regions="Windows Form Designer generated code;Component Designer generated code" /o="dupfinder.%date%.xml" /e="**/*.Designer.cs;**/*.generated.cs;**/Model.cs;**/Reference.cs" "C:/Projects/Software/Dev/SolutionName.sln"
popd
@jonathancounihan
jonathancounihan / knockout html
Last active Aug 29, 2015
knockout iCheck binding
View knockout html
<div>
<label>
<input type="checkbox" data-bind="iCheckBox: SmokerCheckBox" />
<span class="icheck-label">&nbsp;Is Smoker</span>
</label>
</div>
<div data-bind="text: ko.toJSON(vm)">
</div>
View answers.md
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
You can’t perform that action at this time.