Skip to content

Instantly share code, notes, and snippets.

View johnnyreilly's full-sized avatar

John Reilly johnnyreilly

View GitHub Profile
@johnnyreilly
johnnyreilly / navigationAnimation.css
Last active December 16, 2015 16:49
Navigation animation
#navigationAnimation {
margin-top: 7px;
}
#circleG {
width: 46.666666666666664px;
}
.circleG {
background-color: #ffffff;
@johnnyreilly
johnnyreilly / ko.binding.valueNumber.js
Last active April 3, 2018 13:32
A value number style binding for Knockout made using Globalize for parsing / formatting
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 () {
@johnnyreilly
johnnyreilly / Index.js
Last active December 17, 2015 23:59
Cassette and Asset References
// @reference ~/bundles/core
$(document).ready(function () {
var $body = $("#body");
$body.fadeOut(1000, function() {
$body.html(
'<div style="width: 150px; margin: 0 auto;">'+
@johnnyreilly
johnnyreilly / Demo.html
Last active June 18, 2018 13:58
jQuery Validate - using the native unobtrusive support
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
form { padding: 10px; }
.error { color: red; }
</style>
</head>
@johnnyreilly
johnnyreilly / Index.js
Last active December 19, 2015 09:39
TypeScript and Cassette
/// <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();
});
});
//@ sourceMappingURL=Index.js.map
@johnnyreilly
johnnyreilly / jquery.validate.unobtrusive-remote.js
Last active December 22, 2015 23:29
jQuery Remote Validation gets unobtrusively driven additional parameters.
(function($) {
var originalRemote = $.validator.methods.remote;
$.validator.methods.remote = function(value, element, param) {
param.data = {};
if (param.dataSelector) {
var dataToSend = $(element)
.closest(param.dataSelector)
@johnnyreilly
johnnyreilly / confirm.html
Last active December 29, 2015 08:19
Rolling your own confirm mechanism using Q and jQuery UI
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Roll your own confirm</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<style type="text/css">
body {
padding: 0em 1em 0em;
}
@johnnyreilly
johnnyreilly / comparers.js
Last active September 2, 2015 14:53
Helper functions for sorting arrays by multiple criteria
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);
};
<!DOCTYPE html>
<!-- saved from url=(0094)http://johnnyreilly.github.io/jQuery.Validation.Unobtrusive.Native/AdvancedDemo/Globalize.html -->
<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="https://johnnyreilly.github.io/jQuery.Validation.Unobtrusive.Native/Content/
Goals:
- single page application
- code splitting
- ts-loader?
- react
- TypeScript
- .NET backend (C#)
- swagger
- auto-generated TypeScript client
- continuous deployment