Skip to content

Instantly share code, notes, and snippets.

Avatar

kiasyn kiasyn

  • Auckland, New Zealand
View GitHub Profile
@kiasyn
kiasyn / Dump.razor
Created Apr 30, 2020
Blazor json dump object for debugging
View Dump.razor
@using System.Text.Json
<div>
@if (!string.IsNullOrEmpty(Label))
{
<h5>@Label</h5>
}
<code style="display: block; white-space: pre">@json</code>
</div>
@kiasyn
kiasyn / angular-autoNumeric.js
Last active Mar 12, 2019 — forked from kwokhou/angular-autoNumeric.js
AngularJS directive for autoNumeric.js - updated to allow clearing value
View angular-autoNumeric.js
// Directive for autoNumeric.js
// Require AngularJS, jQuery and autoNumeric.js
angular.module('crunch.ui.numeric', []).directive('numeric', [function () {
'use strict';
// Declare a empty options object
var options = {};
return {
// Require ng-model in the element attribute for watching changes.
require: '?ngModel',
// This directive only works when used in element's attribute (e.g: cr-numeric)
@kiasyn
kiasyn / MultiNodeTreePickerIdToUdiMigrator.cs
Created Aug 9, 2018
Migrate Ids to Udis for Umbraco.MultiNodeTreePicker
View MultiNodeTreePickerIdToUdiMigrator.cs
using System;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Web;
namespace Sniper.Umbraco
{
public static class MultiNodeTreePickerIdToUdiMigrator
{
View MagicModelBinder.cs
public class MagicModelBinder : IModelBinder
{
public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
{
var model = Activator.CreateInstance(bindingContext.ModelType);
MagicRecursive(string.Empty, bindingContext.ModelType, bindingContext, model);
bindingContext.Model = model;
bindingContext.ValidationNode.ValidateAllProperties = true;
return true;