Skip to content

Instantly share code, notes, and snippets.

@McNull
McNull / Binder.cs
Created November 27, 2012 18:29
Json Model Binding with Knockout and ASP.NET MVC
namespace System.Web.Mvc {
public class JsonModelBinder : IModelBinder {
private readonly static System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
var stringified = controllerContext.HttpContext.Request[bindingContext.ModelName];
if (string.IsNullOrEmpty(stringified))
return null;
return serializer.Deserialize(stringified, bindingContext.ModelType);
}
@McNull
McNull / fl
Last active November 29, 2020 08:52 — forked from elentok/fl
Open current directory in forklift
#!/bin/bash
# Open current directory in forklift
# Adapted from https://gist.github.com/elentok/6218781
# Adapted from comment https://gist.github.com/elentok/6218781#comment-891115
# Added optional path argument and removed using the clipboard buffer.
set -e
if [ -z "$@" ]; then
@McNull
McNull / .gitignore
Last active June 4, 2016 10:29 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
DS_Store
*.swp
*.app
*.log
@McNull
McNull / index.html
Created September 14, 2016 07:35 — forked from anonymous/index.html
SVG ring 4
<div class="container" ng-app="app">
<div ng-controller="MyCtrl as vm">
<svg width="400" viewbox="-300 -300 600 600">
<g id="circle" style="transform: rotate({{vm.circleRotate}}deg)" ng-class="{ dragging: vm.dragStart }">
<circle fill="#F1F1F1" cy="0" cx="0" ng-attr-r="{{ ::vm.circleRadius }}"></circle>
<g ng-repeat="icon in vm.icons" class="icon" ng-attr-transform="{{ 'rotate(-' + vm.iconRotate * $index + ') translate(0, ' + (vm.circleRadius - vm.iconSize) + ')' }}">
<rect ng-attr-width="{{ ::vm.iconSize }}"
ng-attr-height="{{ ::vm.iconSize }}"
ng-attr-fill="{{ icon.color }}"
ng-attr-x="{{ ::-(vm.iconSize/2) }}"
@McNull
McNull / gulpfile.js
Created September 19, 2016 08:04 — forked from grifdail/gulpfile.js
Simple babel livereload
var gulp = require('gulp'),
babel = require('gulp-babel'),
livereload = require('gulp-livereload'),
http = require('http'),
st = require('st'),
transform = require('vinyl-transform'),
browserify = require('browserify');
gulp.task('js', ["es6"],function() {
@McNull
McNull / app.html
Created September 21, 2016 19:05 — forked from haiau79/app.html
Aurelia RequireJS Gist
<template>
<object type="image/svg+xml" id="svgId"
data="e-3.svg" height="50" width="50" viewBox="0 0 50 50"
mouseover.delegate="domouseover()" mouseout.delegate="domouseout()"
click.delegate="doClickSVG()">
</object>
<div>
<img src="e-3.svg" click.delegate="doClickSVG()"/>
@McNull
McNull / bitinn.py
Created September 12, 2018 16:08 — forked from bitinn/bitinn.py
Blender keymap for busy Maya / Unity / Substance Designer users
# version: 1.0.1
# latest source: https://gist.github.com/bitinn/22f6fefe026d8d9e83468864edb8f835
import bpy
import os
def kmi_props_setattr(kmi_props, attr, value):
try:
setattr(kmi_props, attr, value)
@McNull
McNull / proton.sh
Created October 14, 2023 20:38 — forked from chez14/proton.sh
Proton script to run non-Steam Apps on Linux. Supposedly you have to install Steam first (requires Steam account). Then put this to `/usr/bin/proton.sh` and add required file permissions.
#!/bin/bash
# Credits: https://pastebin.com/NJxfe8Ex
PROTON_VERSION="5.0"
PROTON_DIR=$HOME/.steam/steam/steamapps/common/Proton\ $PROTON_VERSION
RUNNING="$1"
if [ ! -f "$PROTON_DIR/proton" ] ; then
echo "Proton version $PROTON_VERSION not found!";