Skip to content

Instantly share code, notes, and snippets.

@tdshipley
tdshipley / dockerrun_sonarqube.txt
Created November 6, 2018 14:34
Docker Run command for Sonarqube
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
@tdshipley
tdshipley / wait_for_jquery_load.js
Created April 24, 2018 08:14
Wait for jQuery to load
async function checkJquery(tries, tryLimit) {
console.log("Waiting for jQuery to Load");
//1. Base Case - JQuery Loaded
if (window.jQuery) {
console.log("jQuery Loaded");
return;
}
//2. Base Case - TryLimit Hit
if(parseInt(tries) > parseInt(tryLimit)) {
@tdshipley
tdshipley / .gitconfig
Created April 20, 2018 13:21
Perforce P4 Merge Git Config
[diff]
tool = p4merge
[difftool "p4merge"]
path = C:\\Program Files\\Perforce\\p4merge.exe
[merge]
tool = p4merge
[mergetool "p4merge"]
path = C:\\Program Files\\Perforce\\p4merge.exe
@tdshipley
tdshipley / blog_github_sonarqube_start_script.ps1
Created March 21, 2018 13:22
Script for starting SonarQube differently for PR or Master Branch in CI using PowerShell
$github_branch_refs_parts = "%teamcity.build.branch%" -split "/"
$is_pr = ($github_branch_refs_parts.Count -eq 2 -and $github_branch_refs_parts[1] -eq "merge")
if (-Not $is_pr) {
Write-Host "Running SonarQube in master branch mode"
SonarQube.Scanner.MSBuild.exe begin /k:"%sonar.project%" /d:"sonar.host.url=%sonar.host.url%" /d:sonar.cs.dotcover.reportsPaths="dotCover.html" /v:"%build.number%"
} else {
Write-Host "Running SonarQube in PR Mode"
$pull_request_number = $github_branch_refs_parts[0]
@tdshipley
tdshipley / blog_webdriver_session_error.txt
Created February 8, 2018 15:11
blog_webdriver_session_error
OpenQA.Selenium.WebDriverException : A exception with a null response was thrown sending an HTTP request
to the remote WebDriver server for URL http://localhost:51027/session/71f17e73965ce00cdd20434b035cdce2/element
@tdshipley
tdshipley / blog_idserver_3_to_4_api_resource.json
Created January 18, 2018 13:48
blog_idserver_3_to_4_api_resource
{
"Name": "MyApiRescource",
"ApiSecrets": [
{
"Value": "MyAPIResouceSecret"
}
],
"Scopes": [
{
"Name": "MyScopeName",
@tdshipley
tdshipley / blog_example_aspnet_core_2_startup_configure.cs
Created January 17, 2018 18:06
Blog - Example Aspnet Core 2 Startup class Configure Method
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseStaticFiles();
app.UseAuthentication();
app.UseMvc();
}
@tdshipley
tdshipley / blog_auth_successful_user_null.txt
Created January 17, 2018 18:02
Blog: Info message for authorisation successful for null user
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
Authorization was successful for user: (null).
@tdshipley
tdshipley / idisposable_teardown_xunit.cs
Last active January 10, 2018 15:59
Using IDisposable to clean up a test
public class TruthTests : IDisposable
{
public TruthTests()
{
}
public void Dispose()
{
//Do cleanup actions here
//
@tdshipley
tdshipley / running_aspnetcore_server_port_at_command_line
Created November 29, 2016 16:42
Examples of how to run the ASP.NET Core web server with a specified port at the command line.
# Unix:
ASPNETCORE_URLS="https://*:5123" dotnet run
# Windows PowerShell:
$env:ASPNETCORE_URLS="https://*:5123" ; dotnet run
# Windows CMD (note: no quotes):
SET ASPNETCORE_URLS=https://*:5123 && dotnet run