Skip to content

Instantly share code, notes, and snippets.

View damrem's full-sized avatar

Damien Remars damrem

View GitHub Profile
@mandarinx
mandarinx / NormalsVisualizer.cs
Last active May 3, 2024 01:53
Visualize mesh normals in Unity3D
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(MeshFilter))]
public class NormalsVisualizer : Editor {
private const string EDITOR_PREF_KEY = "_normals_length";
private Mesh mesh;
private MeshFilter mf;
private Vector3[] verts;
@BrainCrumbz
BrainCrumbz / directives.js
Created June 18, 2013 19:24
Reusing an AngularJS Directive core code. The idea is to: 1. conceal the actual directive behaviour in a separate JS "class", 2. store that in an Angular Module value, 3. inject that value into an Angular directive, and then 4. just have the directive factory function return the constructed instance of the "class".
// Define core directive code + attributes and store that as a module value
angular.module('com.namespace.directives').value('MyDirectiveCore', MyDirectiveCore);
function MyDirectiveCore($compile) {
this.restrict = 'A';
this.priority = 10;
this.link = postLink;
return this;