Skip to content

Instantly share code, notes, and snippets.

View cchamberlain's full-sized avatar

Cole Chamberlain cchamberlain

View GitHub Profile
@cchamberlain
cchamberlain / update-nuget-encoded
Last active February 9, 2017 11:23
PowerShell script to automate getting the latest version of NuGet and installing to a configurable location with good defaults.
powershell -encodedcommand W0NtZGxldEJpbmRpbmcoDQogIFN1cHBvcnRzU2hvdWxkUHJvY2Vzcz0kVFJVRSwNCiAgQ29uZmlybUltcGFjdD0iSGlnaCINCildDQpQQVJBTSgNCiAgW3BhcmFtZXRlcihQb3NpdGlvbj0wLEhlbHBNZXNzYWdlPSJEaXJlY3RvcnkgdG8gaW5zdGFsbCAvIHVwZGF0ZSBOdUdldC4iKV0NCiAgW2FsaWFzKCJyIildDQogIFtzdHJpbmddJE5VR0VUX1JPT1Q9IiQoSm9pbi1QYXRoICRFbnY6UHJvZ3JhbUZpbGVzIE51R2V0KSINCikNClBST0NFU1Mgew0KICBOZXctSXRlbSAtcGF0aCAiJE5VR0VUX1JPT1QiIC1pdGVtdHlwZSBEaXJlY3RvcnkgLWZvcmNlIHwgT3V0LU51bGwNCiAgIyAkc291cmNlTnVnZXRFeGUgPSAiaHR0cHM6Ly93d3cubnVnZXQub3JnL2FwaS92Mi9wYWNrYWdlL051R2V0LkNsaWVudC8zLjIuMCINCiAgJHNvdXJjZU51Z2V0RXhlID0gImh0dHBzOi8vbnVnZXQub3JnL251Z2V0LmV4ZSINCiAgJHRhcmdldE51Z2V0RXhlID0gSm9pbi1QYXRoICIkTlVHRVRfUk9PVCIgbnVnZXQuZXhlDQogIEludm9rZS1XZWJSZXF1ZXN0ICIkc291cmNlTnVnZXRFeGUiIC1PdXRGaWxlICIkdGFyZ2V0TnVnZXRFeGUiDQogIFNldC1BbGlhcyBudWdldCAiJHRhcmdldE51Z2V0RXhlIiAtU2NvcGUgR2xvYmFsIC1WZXJib3NlIC1mb3JjZQ0KfQ==
@cchamberlain
cchamberlain / Solarized (dark).tmTheme
Last active January 16, 2017 21:12
Customized version of https://github.com/jrolfs/sodarized modified for better looking block cursor (Vintageous / Block Cursor Everywhere)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (dark)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@cchamberlain
cchamberlain / .eslintrc
Last active June 14, 2016 00:03
The best eslint configuration
{
"env": {
"shared-node-browser": true,
"es6": true,
"mocha": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
@cchamberlain
cchamberlain / metaRouter.js
Created April 5, 2016 05:56
redux-middleware
import timeoutScheduler from './timeoutScheduler'
import identityHandler from './identityHandler'
import apiDispatcher from './apiDispatcher'
import routeHandler from './routeHandler'
import idleHandler from './idleHandler'
import errorHandler from './errorHandler'
/**
* Lets you dispatch special actions with a { meta } field.
*
@cchamberlain
cchamberlain / .vimrc
Last active March 30, 2016 17:42
dot-vimrc
execute pathogen#infect()
""" SYNTAX """
syntax on
syntax enable " enable syntax processing
""" SETTINGS """
set tabstop=2 " number of visual spaces per tab when opened
set expandtab " use spaces instead of tabs
@cchamberlain
cchamberlain / SONGS.md
Last active March 16, 2016 20:47
Songs I'm planning on learning on guitar.

METAL

As I Lay Dying

  • The Sound of Truth

public abstract class DapperApiService<TModel, TKey> : DapperService, IApiService<TModel, TKey> {
protected DapperApiService(string connectionString, ICacheProvider cacheProvider = null) : base(connectionString, cacheProvider) {}
protected SqlApiService<TModel, TKey> Sql { get; } = new SqlApiService<TModel, TKey>();
public IEnumerable<TModel> Get(string whereClause, object param = null, int top = 500)
=> Query<TModel>(Sql.Get(whereClause, top));
public IEnumerable<TModel> Get(object param = null, int top = 500)
@cchamberlain
cchamberlain / ConEmu.xml
Created July 23, 2015 02:47
My ConEmu.xml
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2015-07-22 13:35:19" build="150716">
<value name="ColorTable00" type="dword" data="00362b00"/>
<value name="ColorTable01" type="dword" data="0000bfa8"/>
<value name="ColorTable02" type="dword" data="00009985"/>
<value name="ColorTable03" type="dword" data="0098a12a"/>
<value name="ColorTable04" type="dword" data="00164bcb"/>
<value name="ColorTable05" type="dword" data="00c4716c"/>
@cchamberlain
cchamberlain / IApiService.cs
Created August 26, 2015 04:39
API Service Interface
/// <summary>
/// By adhering to this interface, services will align to all the common HTTP methods and will expose sync and async versions.
/// </summary>
/// <typeparam name="TModel">The type of model that the SQL entity will be bound to. Can be decorated.</typeparam>
/// <typeparam name="TKey">The type of primary key of the model (primitive). Can be decorated.</typeparam>
public interface IApiService<TModel, in TKey> : IApiServiceSync<TModel, TKey>, IApiServiceAsync<TModel, TKey> {}
/// <summary>
/// By adhering to this interface, services will align to all the common HTTP methods and expose sync versions.
@cchamberlain
cchamberlain / TryExtensions.cs
Created August 23, 2015 02:27
Generic extension methods for inlining the flow of try-catch-finally blocks. Contains separate implementations for value types and reference types and handles both sync and async.
public static class TryExtensions {
/// <summary>
/// Inline try-catch-finally block for return <typeparamref name="TResult"/> value types. The input is chained through the try, and optionally through the catch and finally blocks. By default, will not throw unless an exception is returned from any of the try-catch-finally blocks.
/// </summary>
/// <typeparam name="T">The type of the input to flow through try-catch-finally.</typeparam>
/// <typeparam name="TResult">The type (value) of the try-catch-finally result.</typeparam>
/// <param name="input">The <typeparamref name="T"/> input to be chained through the try-catch-finally blocks.</param>
/// <param name="tryLogic">The try logic to execute. Receives <typeparamref name="T"/> input and returns <typeparamref name="TResult"/> result or any exception object which will subsequently be thrown.</param>
/// <param name="catchLogic">The catch logic to execute. Runs only when try logic throws. Receives the exception and <typeparamre