Skip to content

Instantly share code, notes, and snippets.

View johnnyreilly's full-sized avatar

John Reilly johnnyreilly

View GitHub Profile
@johnnyreilly
johnnyreilly / README.md
Created November 17, 2023 07:30
Get your MVP data for your records

MVP Application

Get your data from the API and write it to a file.

Read index.js for more information.

To run this:

@johnnyreilly
johnnyreilly / CarController.cs
Last active November 6, 2023 22:05
Unit testing ModelState using Moq
using System.Web.Mvc;
namespace MyApp
{
public class CarController : Controller
{
//...
public ActionResult Edit(CarModel model)
{
@johnnyreilly
johnnyreilly / PdfGenerator.cs
Created April 9, 2012 05:58
C# Wrapper for WKHTMLtoPDF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
using System.Web.Hosting;
namespace PdfGenerator
{
public class PdfGenerator
@johnnyreilly
johnnyreilly / sh
Last active February 21, 2021 19:29
markdown blogpost with sed
// with markdown
npx markdown README.md | sed -e 's|<pre>|<pre class="prettyprint json">|'
// with showdown
npx showdown makehtml -i README.md
Goals:
- single page application
- code splitting
- ts-loader?
- react
- TypeScript
- .NET backend (C#)
- swagger
- auto-generated TypeScript client
- continuous deployment
@johnnyreilly
johnnyreilly / DemoAreaRegistration.cs
Last active October 29, 2019 13:43
What you need to unit test MVC controllers using MOQ.
using System.Web.Mvc;
namespace DemoApp.Areas.Demo
{
public class DemoAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
@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 / 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 / BloombergApi.cs
Created November 13, 2012 13:41
Giving OpenBloomberg a nicer API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bloomberglp.Blpapi;
namespace BloombergConsole
{
class BloombergApi
@johnnyreilly
johnnyreilly / DateTimeJavaScriptConverter.cs
Created April 25, 2012 14:10
The 3 elements needed to have a nice JavaScriptSerializer DateTime experience in older browsers and using ASP.NET WebForms
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace MyNamespace
{
/// <summary>
/// A custom DateTime JavaScriptConverter courtesy of these good folks: http://blog.calyptus.eu/seb/2011/12/custom-datetime-json-serialization/
/// Using this forces DataTimes to be serialised as ISO 8601 rather "\/Date(1249335477787)\/" style