Skip to content

Instantly share code, notes, and snippets.

Chris Moutray chrismoutray

  • Bournemouth, UK
Block or report user

Report or block chrismoutray

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
chrismoutray /
Last active Mar 29, 2018
example Singleton implementation using Lazy object
chrismoutray /
Last active Mar 29, 2018
Example on using class inheritance to abolishing Switch-Case statements on a type

basic example of removing switch statement and instead using OO to have implementations that represent each type

so we don't do this!

public class Entity
    public string Type { get; set; }

    public int GetNewValueBasedOnType(int newValue)
chrismoutray / .less
Last active Oct 30, 2015
less/css opacity transition examples
View .less
.wrapper {
.transition(@property: opacity, @duration: .2s, @timing: ease-in-out);
.opacity (@opacity: 1);
&.hide {
.opacity (@opacity: 0);
.wrapper {
& > * {
chrismoutray / class.cs
Last active Oct 29, 2015
BsonDiscriminator examples
View class.cs
// base class
[BsonDiscriminator(RootClass = true)]
[BsonKnownTypes(typeof(Cat), typeof(Dog))]
public abstract class Animal
public string id { get; set; }
public string name { get; set; }
public int age { get; set; }
View AccountController.cs
[Route("confirm-signup", Name = "ConfirmSignUpRoute")]
public async Task<IHttpActionResult> ConfirmSignUp(string userId = "", string code = "")
IdentityResult confirmEmailResult = await this.AppUserManager.ConfirmEmailAsync(userId, code);
if (!confirmEmailResult.Succeeded)
return GetErrorResult(confirmEmailResult);
chrismoutray / gist:860e1d52d1f702fd82c7
Created Jun 8, 2014
Uninstall all gems on Windows
View gist:860e1d52d1f702fd82c7
Windows Powershell
-- to remove gems
gem list | %{$_.split(' ')[0]} | %{gem uninstall -Iax $_ }
-- add back important ones
gem install bundler json minitest rake rdoc
chrismoutray / list dir
Last active Aug 29, 2015
List files found in dir
View list dir
class Program
static void Main(string[] args)
string path = args[0];
Console.WriteLine("trying path: " + path);
if (Directory.Exists(path))
Directory.GetFiles(path).ToList().ForEach(s => Console.WriteLine(s));
chrismoutray / gist:9286664
Created Mar 1, 2014
insert image as varbinary
View gist:9286664
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace blobstoretest
You can’t perform that action at this time.