This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Enabled again with | |
# sudo nvram -d SystemAudioVolume | |
sudo nvram SystemAudioVolume=%00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
Hack to enable source maps in with gulp-sourcemaps and autoprefixer. | |
Created by null on 12/08/14. | |
npm --save-dev install through2 | |
npm --save-dev install autoprefixer | |
npm --save-dev install vinyl-sourcemaps-apply |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DS_Store | |
*.swp | |
*.app | |
*.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (angular) { | |
angular.module('lorem', []) | |
.factory('lorem', function () { | |
// Stolen from https://github.com/knicklabs/lorem-ipsum.js and slightly modified | |
/* output = loremIpsum({ | |
count: 1 // Number of words, sentences, or paragraphs to generate. | |
, units: 'sentences' // Generate words, sentences, or paragraphs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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) }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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()"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import os | |
def kmi_props_setattr(kmi_props, attr, value): | |
try: | |
setattr(kmi_props, attr, value) | |
except AttributeError: | |
print("Warning: property '%s' not found in keymap item '%s'" % | |
(attr, kmi_props.__class__.__name__)) | |
except Exception as e: |
OlderNewer