Skip to content

Instantly share code, notes, and snippets.

Latest update:
<html><head><title></title><script type="text/javascript">if(confirm("There are applications that are currently running that were launched from Task Explorer. Logging out of E1 Menu will close these applications. Would you like to continue?")){ self.location="/jde/MafletClose.mafService?action=close&e1.namespace=&e1.service=MafletClose&RENDER_MAFLET=E1Menu&e1.state=maximized&e1.mode=view";}else{self.location="/jde/share/https_dummy.html";}</script></head><body></body></html>
<a onclick="try{doE1PreLogout();}catch(problem){}" id="e1LogoutLink" href="/jde/MafletClose.mafService?e1.namespace=&amp;e1.service=MafletClose&amp;RENDER_MAFLET=E1Menu&amp;e1.state=maximized&amp;e1.mode=view" target="LOGOUT_IFRAME" style="text-decoration: none; color: #003286;">Sign Out</a>
subprojects {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
// set bintrayUser & bintrayKey in HomeDir/gradle.properties and do not check in
// To upload to bintray, each user must create this file and add credentials (per pc)
bintray {
user = bintrayUser
key = bintrayKey
@solvingj
solvingj / VSWorkspaceState.json (working)
Last active April 13, 2017 15:37
Working visual studio cmake project
{
"ExpandedNodes": [
"",
"\\.vs\\config",
"\\.vs\\new001",
"\\.vs\\new001\\v15",
"\\.vs\\new001\\v15\\ipch",
"\\.vs\\new001\\v15\\ipch\\AutoPCH",
"\\.vs\\new001\\v15\\ipch\\AutoPCH\\CMAKELISTS-6fda3a50",
"\\.vs\\new001\\v15\\ipch\\AutoPCH\\CMAKELISTS-6fda3a50\\TIMER-e4e1cf68",
@solvingj
solvingj / VSWorkspaceState.json (not working)
Last active April 13, 2017 15:38
NonWorking visual studio cmake project
{
"ExpandedNodes": [
"",
"\\src",
"\\src\\main",
"\\src\\main\\timer",
"\\src\\test",
"\\src\\test\\timer"
],
"SelectedNode": "\\src\\test\\timer",
@solvingj
solvingj / gist:58160fb77e08237f840995dcc4015162
Created May 8, 2017 21:33
Simple Logger with Functional Influence
public class FunLog
{
public List<Action<string>> InfoActions = new List<Action<string>>();
public List<Action<string>> VerboseActions = new List<Action<string>>();
public List<Action<string>> ErrorActions = new List<Action<string>>();
public List<Action<string>> WarningActions = new List<Action<string>>();
public List<Action<string>> TraceActions = new List<Action<string>>();
[DebuggerStepThrough]
public FunLog(){ }
public void InitializeLogToOutput(TraceWriter writer)
{
Log = new FunLog()
.WithInfoAction(msg => writer.Info(msg))
.WithErrorAction(msg => writer.Error(msg))
.WithVerboseAction(msg => writer.Verbose(msg))
.WithWarningAction(msg => writer.Warning(msg));
}
@solvingj
solvingj / gist:3c112bba2fb22b86386910a0ea49625a
Last active May 9, 2017 00:25
Works with no annotations...
[Fact]
public void Should_serialize_Test()
{
var sets = new DataContractJsonSerializerSettings { SerializeReadOnlyTypes = true };
Test test = new Test { Name = "name", City = "city" };
DataContractJsonSerializer js = new DataContractJsonSerializer(typeof(Test), sets);
MemoryStream ms = new MemoryStream();
js.WriteObject(ms, test);
ms.Position = 0;
public static class Tryable
{
public static Exceptional<T> Try<T>(Func<T> func)
{
try
{
return Exceptional.Ok(func());
}
catch (Exception e)
{
@solvingj
solvingj / gist:84f8e0a6e6db5512efa0d5df01f0d529
Created May 19, 2017 17:19
Is this unit test valid? It succeeds, but I dunno if Task.Factory.StartNew really imitates an async task from a 3rd party library.
[Fact]
public async Task can_return_failed_exceptional_from_async_task_try()
{
Func<Task<int>> mathFunc = () => Task.Factory.StartNew(() => Int32.Parse(""));
Exceptional<int> exceptionalInt = await Tryable.Try(mathFunc);
//Assert
exceptionalInt.IsFailure.Should().BeTrue();
exceptionalInt.ToString().ShouldBeEquivalentTo("Input string was not in a correct format.");
internal sealed class ExceptionalCommonLogic
{
public bool IsFailure { get; }
public bool IsSuccess => !IsFailure;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly Exception _exception;
public Exception Exception
{