Skip to content

Instantly share code, notes, and snippets.

@flagbug
flagbug / Dockerfile
Last active February 26, 2021 15:26
SQL Server Linux Dockerfile
FROM microsoft/mssql-server-linux:2017-CU9
ENV ACCEPT_EULA=Y
ENV SA_PASSWORD=yourStrong(!)Password
RUN apt-get update && apt-get install unzip -y
# SqlPackage taken from https://github.com/Microsoft/mssql-docker/issues/135#issuecomment-389245587
RUN wget -O sqlpackage.zip https://go.microsoft.com/fwlink/?linkid=873926 \
&& unzip sqlpackage.zip -d /tmp/sqlpackage \
public class VersionConfiguration
{
public string BuildCommitHash { get; set; }
}
Task("Version")
.Does(() =>
{
IEnumerable<string> redirectedStandardOutput;
IEnumerable<string> redirectedErrorOutput;
var exitCodeWithArgument =
StartProcess(
"git",
new ProcessSettings {
Arguments = "rev-parse HEAD",
services.Configure<HealthOptions>(configuration.GetSection("Version"));
@flagbug
flagbug / appsettings.json
Last active April 24, 2018 14:52
Versioning ASP.NET Core applications with Git and CAKE
{
"Version": {
"BuildCommitHash": "%BUILD_COMMIT_HASH%"
}
}
@flagbug
flagbug / gist:fd9566a2b4ea41f33289
Created October 21, 2014 19:47
ReactiveCommand exceptions

Scenario: ReactiveCommand executes a network request hat can throw an exception. View subscribes to the ThrownExceptions property so it can display a toast message e.g "Request failed"

The user executes the command, but immediately goes to another view, so the current view is destroyed and unsubscribes in WhenActivatedfrom the command. The network request throws a few seconds later, but since there is no subscriber to ThrownExceptions, the application blows up.

@flagbug
flagbug / rxbug.cs
Last active August 29, 2015 13:58
Rx CompositeDisposable CopyTo bug
// View constructor
this.WhenActivated(() =>
{
var disposable = new CompositeDisposable();
// We never actually add an IDisposable to the CompositeDisposable for debugging reasons or whatever
return disposable;
})
// This code will crash at https://github.com/reactiveui/ReactiveUI/blob/rxui6-master/ReactiveUI/Activation.cs#L89
@flagbug
flagbug / MeasureHelper.cs
Last active August 29, 2015 13:56
Measure
public static class MeasureHelper
{
public static IDisposable Measure([CallerMemberName] string caller = null)
{
var stopWatch = Stopwatch.StartNew();
return Disposable.Create(() =>
{
stopWatch.Stop();
Console.WriteLine("Measured in {0}: {1}", caller, stopWatch.Elapsed);
@flagbug
flagbug / bad.html
Last active December 18, 2015 09:59
Bad- after - diff
<div id="home-container" style="width: 0px; height: 366px; overflow: hidden; position: relative; padding: 0px;">
<div id="dragwrapper52126904" style="opacity: 0.25; position: absolute; padding: 0px; left: -4px; z-index: 20; width: 8px; height: 366px;" class="ui-draggable">
<div id="drag52126904" style="width: 2px; height: 366px; background-color: rgb(136, 136, 136); position: absolute; left: 3px; background-position: initial initial; background-repeat: initial initial;">
<img width="8" height="56" alt="handle" src="./js/handle.gif" id="handle52126904" style="z-index: 100; position: relative; cursor: pointer; top: 155px; left: -3px;">
</div>
</div>
<div style="height: 366px; width: 0px; position: absolute; overflow: hidden; left: 0px; z-index: 10;">
<img alt="before" src="/MahApps.Metro/images/home-title-light.png" height="366" id="beforeimage52126904" style="position: absolute; top: 0px; left: 0px;">
</div>
<div style="height: 366px; width: 0px; position: absolute; overflow: hidden
@flagbug
flagbug / fetch.rb
Created December 11, 2012 13:52
Ruby redirect
require 'net/http'
require 'uri'
def fetch(uri_str, limit = 10)
# You should choose a better exception.
raise ArgumentError, 'too many HTTP redirects' if limit == 0
response = Net::HTTP.get_response(URI(uri_str))
case response