Skip to content

Instantly share code, notes, and snippets.

View trbngr's full-sized avatar

Chris Martin trbngr

  • Phoenix, AZ, USA
View GitHub Profile
import { GraphQLScalarType } from 'graphql';
import { GraphQLError } from 'graphql/error';
import { Kind } from 'graphql/language';
import moment from 'moment';
import tz from 'moment-timezone';
function coerceDate(value) {
if(typeof value === 'string')
value = moment(value);
var express = require('express');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
var Strategy = require('./passport-openidconnect/index').Strategy;
module.exports.configure = function configure(app, passport) {
var identityServer = 'https://users.xxx.com/identity';
var auth = {
@trbngr
trbngr / Account.cs
Created July 9, 2015 00:30
Mini Akka Helper DSL
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="eventday" value="http://www.myget.org/f/aspnetwebstacknightly/" />
</packageSources>
</configuration>
using System;
namespace ConsoleApplication2
{
internal class Program
{
private static void Main()
{
var bar = UniversalFactory.Create<Bar>(23);
Console.Out.WriteLine(bar);
EventStoreConnection connection = get your connection;
string streamName = GetStreamName(aggregate);
//try to read the slice
var slice = connection.ReadStreamEventsForward(streamName, 0, int.MaxValue, false);
if (slice.Status == SliceReadStatus.StreamNotFound)
{
//create the stream if doesn't exist.
//NOTE: isJson MUST be true for this to work.
@trbngr
trbngr / EventStoreService.cs
Last active July 4, 2017 21:29
EventStore as a windows service w/ TopShelf
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
namespace EventStoreService
{
public class EventStoreService
{
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using SignalR.Client;
using SignalR.Client.Hubs;
using SignalR.Hubs;
namespace EventDay.Web.Api.Controllers
@trbngr
trbngr / ApiResourceSerializationTests.cs
Created August 26, 2012 09:54
Demonstrating how to skip fields that aren't decorated with a certain attribute using json.net.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using GuessWho;
using NUnit.Framework;
public class Program
{
private static void Main()
{
var instance = new SomeClass
{
SomePropertyWithAttribute = "I have an attribute",
SomeProperty = "I don't have an attribute"
};