Skip to content

Instantly share code, notes, and snippets.


John Reilly johnnyreilly

View GitHub Profile
johnnyreilly / sh
Last active Feb 21, 2021
markdown blogpost with sed
View sh
// with markdown
npx markdown | sed -e 's|<pre>|<pre class="prettyprint json">|'
// with showdown
npx showdown makehtml -i
View Goals
- single page application
- code splitting
- ts-loader?
- react
- TypeScript
- .NET backend (C#)
- swagger
- auto-generated TypeScript client
- continuous deployment
View globalize-localeDisplayNames.js
<!DOCTYPE html>
<!-- saved from url=(0094) -->
<html lang="en" class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Globalize - jQuery Validation Unobtrusive Native</title>
<link href="
johnnyreilly / comparers.js
Last active Sep 2, 2015
Helper functions for sorting arrays by multiple criteria
View comparers.js
function composeComparers(...comparers) {
return comparers.reduce((prev, curr) => (a, b) => prev(a, b) || curr(a, b));
function stringComparer(propLambda) {
return (obj1, obj2) => {
const obj1Val = propLambda(obj1) || '';
const obj2Val = propLambda(obj2) || '';
return obj1Val.localeCompare(obj2Val);
johnnyreilly / confirm.html
Last active Dec 29, 2015
Rolling your own confirm mechanism using Q and jQuery UI
View confirm.html
<!DOCTYPE html>
<html xmlns="">
<title>Roll your own confirm</title>
<link rel="stylesheet" href="//">
<link rel="stylesheet" href="//">
<style type="text/css">
body {
padding: 0em 1em 0em;
johnnyreilly / jquery.validate.unobtrusive-remote.js
Last active Dec 22, 2015
jQuery Remote Validation gets unobtrusively driven additional parameters.
View jquery.validate.unobtrusive-remote.js
(function($) {
var originalRemote = $.validator.methods.remote;
$.validator.methods.remote = function(value, element, param) { = {};
if (param.dataSelector) {
var dataToSend = $(element)
johnnyreilly / Index.js
Last active Dec 19, 2015
TypeScript and Cassette
View Index.js
/// <reference path="../../typings/jquery/jquery.d.ts" />
// @reference ~/bundles/core
$(document).ready(function () {
var $body = $("#body");
$body.fadeOut(1000, function () {
$body.html('<div style="width: 150px; margin: 0 auto;">I made it all go away...</div>').fadeIn();
johnnyreilly / Demo.html
Last active Jun 18, 2018
jQuery Validate - using the native unobtrusive support
View Demo.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<link href="" rel="stylesheet">
form { padding: 10px; }
.error { color: red; }
johnnyreilly / Index.js
Last active Dec 17, 2015
Cassette and Asset References
View Index.js
// @reference ~/bundles/core
$(document).ready(function () {
var $body = $("#body");
$body.fadeOut(1000, function() {
'<div style="width: 150px; margin: 0 auto;">'+
johnnyreilly / ko.binding.valueNumber.js
Last active Apr 3, 2018
A value number style binding for Knockout made using Globalize for parsing / formatting
View ko.binding.valueNumber.js
ko.bindingHandlers.valueNumber = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
// This will be called when the binding is first applied to an element
// Set up any initial state, event handlers, etc. here
var observable = valueAccessor(),
properties = allBindingsAccessor();
var interceptor = ko.computed({
read: function () {