Skip to content

Instantly share code, notes, and snippets.

🤹‍♂

Chris F Carroll chrisfcarroll

🤹‍♂
Block or report user

Report or block chrisfcarroll

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
@chrisfcarroll
chrisfcarroll / gist:28fc739fb63d19f242d1
Created Feb 5, 2016
Stub or Mock, as far as possible, the Asp.Net MVC controller HttpContext and also System.Web.HttpContext.Current
View gist:28fc739fb63d19f242d1
public partial class HttpRequestOverridableWrapper : HttpRequestWrapper
{
readonly string appVirtualDir;
public HttpRequestOverridableWrapper(HttpRequest httpRequest, string appVirtualDir)
: base(httpRequest)
{
this.appVirtualDir = appVirtualDir;
}
public override string ApplicationPath { get { return appVirtualDir; } }
@chrisfcarroll
chrisfcarroll / Cacher.cs
Last active Feb 19, 2016
A simple memoizer backed by System.Runtime.Caching.MemoryCache.Default
View Cacher.cs
using System;
using System.Reflection;
using System.Runtime.Caching;
/// <summary>Memoize the results of method calls.</summary>
class Cacher
{
public readonly string UniqueName;
public readonly int CacheTimeSeconds;
@chrisfcarroll
chrisfcarroll / QUnitTestIf.cshtml
Last active Feb 14, 2016
An Asp.Net MVC PartialView for in-browser page testing. Makes it possible to test complex UIs and widgets 'in situ' but with zero client-side pageweight in production.
View QUnitTestIf.cshtml
@model IEnumerable<string>
@if (Request.IsLocal
&& ( Request.QueryString["test"]!=null
||
Request.QueryString.ToString().Split('&').Any(k=>k.Equals("test",StringComparison.InvariantCultureIgnoreCase))
))
{
<div id="unit-tests">
<script src='~/scripts/qunit-1.20.0.js'></script>
View trello-wrap-n-stack-to-fit.user.js
// ==UserScript==
// @name Trello Wrap-n-Stack-To-Fit
// @namespace http://tampermonkey.net/
// @version 0.73
// @description Trello: Auto-wrap, stack and resize your Trello lists so they don't go offscreen. And kill that horizontal scroll-bar.
// @author chrisfcarroll
// @match https://trello.com/*
// @grant none
// ==/UserScript==
// jshint -W097
@chrisfcarroll
chrisfcarroll / tmMakeImage
Last active May 6, 2019
A commandline script for MacOS, to create a TimeMachine Backup Volume on a non-Apple formatted disk
View tmMakeImage
#!/bin/bash
# 2015 Updates to sunkid's script. chrisfcarroll
# - added more quote marks to cope with e.g. spaces in volume names.
# - get machine UUID from ioreg instead of parsing and system report.
# - added steps to tell Time Machine to use your new backup drive.
# - renamed.
# Make it executable with e.g. chmod a+x tmMakeImage && mv tmMakeImage /usr/local/bin.
#
# A bash script to create a time machine disk image suitable for
# backups with OS X 10.6 (Snow Leopard) and later.
View gist:4596103
~/Software/Clojure/pallet-crate-tomcat7-demo]lein run
16:35:14.723 [main] DEBUG pallet.compute.jclouds - extensions (:slf4j :sshj)
16:35:14.734 [main] DEBUG pallet.compute.jclouds - options []
16:35:17.279 [main] DEBUG pallet.core - pallet version: 0.7.2
16:35:17.290 [main] INFO pallet.core - retrieving nodes
16:35:23.639 [main] INFO pallet.core - lift-nodes phases [:destroy-server], groups []
Exception in thread "main" java.lang.NumberFormatException: Invalid number: 09
at clojure.lang.LispReader.readNumber(LispReader.java:253)
at clojure.lang.LispReader.read(LispReader.java:171)
at clojure.lang.RT.readString(RT.java:1707)
You can’t perform that action at this time.