Skip to content

Instantly share code, notes, and snippets.

@charlieanstey
charlieanstey / colorpicker.html
Last active April 1, 2019 13:37 — forked from pbres/colorpicker.html
ColorPicker for Umbraco Grid DataType Settings/Style sections
<div ng-controller="Umbraco.PropertyEditors.ColorPickerController">
<ul class="thumbnails color-picker">
<li ng-repeat="preval in model.prevalues" ng-class="{active: model.value === preval.value}">
<a ng-click="toggleItem(preval)" class="thumbnail" hex-bg-color="{{preval.color}}">
</a>
<span class="color-label" ng-bind="preval.key"></span>
</li>
</ul>
<input type="hidden" name="modelValue" ng-model="model.value" val-property-validator="validateMandatory"/>
@charlieanstey
charlieanstey / the-bind-problem.jsx
Created November 14, 2017 09:28 — forked from Restuta/the-bind-problem.jsx
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));
@charlieanstey
charlieanstey / field-helpers.cshtml
Created July 22, 2014 09:15 — forked from willprice76/field-helpers.cshtml
Tridion :: Razor helpers for Experience Manager in 2013 SP1
@using Tridion.ContentManager.Templating.Expression
@using Tridion.ContentManager.ContentManagement
@using Tridion.Extensions.Mediators.Razor.Models
@* --------------- IDENTIFYING FIELDS ---------------------- *@
@helper FieldStartMarker(string fieldExpression)
{
var fn = new BuiltInFunctions(TridionHelper.Engine, TridionHelper.Package);
@fn.FieldStartMarker(fieldExpression)
@charlieanstey
charlieanstey / 0_reuse_code.js
Created March 5, 2014 15:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console