Skip to content

Instantly share code, notes, and snippets.

@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) }}"
(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.
@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 / gulp-autoprefixer-map.js
Last active August 29, 2015 14:05
Hack to enable source maps in with gulp-sourcemaps and autoprefixer.
#!/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
@McNull
McNull / disable-boot-chime.sh
Last active August 29, 2015 13:58
Disable the Mac Boot Chime
#!/bin/bash
# Enabled again with
# sudo nvram -d SystemAudioVolume
sudo nvram SystemAudioVolume=%00
@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 / 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);
}