Skip to content

Instantly share code, notes, and snippets.

View chrisfcarroll's full-sized avatar
🤹‍♂️
🌍...☕...🖥️...⏳...⛪...🛌🏼

Chris F Carroll chrisfcarroll

🤹‍♂️
🌍...☕...🖥️...⏳...⛪...🛌🏼
View GitHub Profile
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>title</title></head><body>Here</body></html>
@chrisfcarroll
chrisfcarroll / Asp.Net MVC DebuggableModelBinder and CheckboxToBoolModelBinder.md
Last active September 13, 2018 16:53
To make stepping through the modelbinding process easier

Use the DebuggableModelBinder with a breakpoint to investigate what's happening when your complex model isn't binding as you expect.

Use the CheckBoxToBoolModelBinder to bind <input type="checkbox" > Note the Html standard describes "on" as the only valid postable value for a checkbox.. If you're posting something else, change the code. And don't that forget that unchecked means that nothing gets posted.

In either case, wire them up with e.g.:

public class MvcApplication : HttpApplication
{

protected void Application_Start()

@chrisfcarroll
chrisfcarroll / AutoHotKey for a Mac User with PC keyboard on Windows.ahk
Last active January 11, 2024 11:19
A Pair of AutoHotKey Scripts for they who, being Mac Users, yet still insist on using Windows. One for an Apple keyboard, one for a PC keyboard. Also some arrange-windows-on-a-big-screen keys . Takes a similar approach as Parallels to keyboard mapping: rather than a wholesale swap of Cmd <-> Ctrl, instead duplicate favourite ctrl-key shortcuts t…
; Language: English
; Uses unicode. Save this file as utf-8 with BOM.
; Else it shall not work.
;
#NoEnv ; Recommended
SendMode Event
SetWorkingDir %userprofile% ; Ensures a consistent starting directory.
; === autotexts ========================================================
;
@chrisfcarroll
chrisfcarroll / gist:28fc739fb63d19f242d1
Created February 5, 2016 10:57
Stub or Mock, as far as possible, the Asp.Net MVC controller HttpContext and also System.Web.HttpContext.Current
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 February 19, 2016 11:02
A simple memoizer backed by System.Runtime.Caching.MemoryCache.Default
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 February 14, 2016 18:54
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.
@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>
// ==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 2, 2023 11:43
A commandline script for MacOS, to create a TimeMachine Backup Volume on a non-Apple formatted disk
#!/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.
~/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)