Skip to content

Instantly share code, notes, and snippets.

View adamralph's full-sized avatar
🤗
Living the dream

Adam Ralph adamralph

🤗
Living the dream
View GitHub Profile
@adamralph
adamralph / jabbr-spam.js
Created April 23, 2014 20:10
JabbR spam removal bookmarklet
javascript:(function(){$('li[data-name=sttriviabot].message').remove();$('li[data-name=sahin].message').remove();$('li[data-name=tacobell8888].message').remove();})();
23840 2014-05-07 10:14:55Z [ 5] NEventStore.SqlPersistenceWireup DEBUG: Using SQL connection factory of type '{Redacted}.{Redacted}.Application.Host.SqlConnectionFactory'.
23840 2014-05-07 10:14:55Z [ 5] NEventStore.SqlPersistenceWireup TRACE: Configuring SQL engine to auto-detect dialect.
23840 2014-05-07 10:14:55Z [ 5] NEventStore.SqlPersistenceWireup DEBUG: Registering SQL dialect of type 'NEventStore.Persistence.Sql.SqlDialects.MsSqlDialect'.
23840 2014-05-07 10:14:55Z [ 5] NEventStore.SqlPersistenceWireup DEBUG: Persistence engine configured to page every '2147483647' records.
23840 2014-05-07 10:17:44Z [ 5] NEventStore.PersistenceWireup DEBUG: Configuring persistence engine to initialize.
23840 2014-05-07 10:17:44Z [ 5] NEventStore.PersistenceWireup
@adamralph
adamralph / FluentAssertionsNestedDoubleApproximation.cs
Created May 8, 2014 09:27
Example of how to perform nested approximate double comparison in FluentAssertions
var doubleRule = new AssertionRule<double>(
i => i.RuntimeType == typeof(double),
c => Math.Abs(c.Expectation - c.Subject).Should().BeLessThan(0.0000000000001));
actual.ShouldBeEquivalentTo(expected, options => options.Using(doubleRule));
@adamralph
adamralph / gist:523469f5c100cd0dd786
Created May 14, 2014 19:57
Octokit Fresh Clone test failures
------ Test started: Assembly: Octokit.Tests.dll ------
Test 'Octokit.Tests.Clients.SearchClientTests+TheSearchIssuesMethod.TestingTheStateQualifier_Closed' failed: NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
Get<SearchIssuesResult>(u => (u.ToString() == "search/issues"), d => (d.get_Item("q") == "something+state:Closed"))
Actually received no matching calls.
Received 1 non-matching call (non-matching arguments indicated with '*' characters):
Get<SearchIssuesResult>(search/issues, *Dictionary<String, String>*)
at NSubstitute.Core.ReceivedCallsExceptionThrower.Throw(ICallSpecification callSpecification, IEnumerable`1 matchingCalls, IEnumerable`1 nonMatchingCalls, Quantity requiredQuantity)
at NSubstitute.Routing.Handlers.CheckReceivedCallsHandler.Handle(ICall call)
@adamralph
adamralph / FluentAssertions.Enumerable.cs
Last active August 29, 2015 14:02
FluentAssertions enumerable assertion
IEnumerable<Foo> foos;
foos.Should().All(foo => foo.Bar.Should().Be("baz"));
// if an item does not satisfy the inner assertion, I'd like to be told which one.
// perhaps I could be told the index, and maybe a string representation of the item
@adamralph
adamralph / notes.csx
Last active August 29, 2015 14:04
Create release notes from GitHub issues with power of scriptcs and Octokit!
var owner = "scriptcs";
var repo = "scriptcs";
var milestone = "v0.10";
var labels = new Dictionary<string, string>{ { "feature", "New" }, { "bug", "Fixed" } };
var username = "adamralph";
var oAuthToken = "secret";
var client = Require<OctokitPack>().CreateWithOAuth("ScriptCs.ReleaseNotesScript", username, oAuthToken);
var issues = client.Issue.GetForRepository(owner, repo, new RepositoryIssueRequest { State = ItemState.Closed, }).Result;
@adamralph
adamralph / xbehave.rollback.cs
Last active August 29, 2015 14:10
xBehave.net transaction rollback
[Scenario]
public void MyScenario(..., SqlTransaction transaction)
{
"Given..."
.f(() => ...);
...
"When..."
.f(c =>
{
// Appending .Using(c) will call Dispose() after all steps in the scenario have finished.

Keybase proof

I hereby claim:

  • I am adamralph on github.
  • I am adamralph (https://keybase.io/adamralph) on keybase.
  • I have a public key whose fingerprint is BBD9 E810 1318 94AF DB41 884C A13C 4EC3 43B4 4212

To claim this, I am signing this object:

@adamralph
adamralph / gist:b815fb59a17d05256d75
Created January 25, 2015 12:06
Mail to GitHub support - "Bug in org dashboard"
Currently, https://github.com/orgs/scriptcs/dashboard shows "14 minutes ago adamralph released v0.10 at scriptcs/scriptcs". This is incorrect.
https://github.com/scriptcs/scriptcs/releases shows "v0.10 Adam Ralph adamralph released this on 30 Jul 2014". This is correct.
I believe the reason the dashboard shows "14 minutes ago" is because I edited the release notes.
What I have noticed is that if I edit the release notes and click 'Update release notes' then this problem does not occur. It only occurs when I accidentally click 'Save draft' instead of 'Update release notes' and then I click 'Update release notes' immediately afterwards to correct myself. I guess that the transition in and out of draft is throwing things off somehow.
@adamralph
adamralph / MyApp.exe.csx
Last active August 29, 2015 14:15
Using ConfigR to pass values to your app via a static class
#r MyApp.exe
using MyApp;
Settings.Foo = "Bar";