Skip to content

Instantly share code, notes, and snippets.

View perploug's full-sized avatar

Per Ploug perploug

View GitHub Profile
@perploug
perploug / edit.controller.js
Created November 14, 2017 14:33
exercise 7
angular.module("umbraco")
.controller("My.Workshop.EditController", function ($routeParams) {
var vm = this;
vm.workshop = {};
vm.buttonState = "init";
vm.properties = {
description: { label: "Description", description: "Workshop description" }
};
@perploug
perploug / Exercise 9
Last active December 8, 2017 14:32
Multi-index
<add name="TownIndexer"
type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
indexSet="ukTownsIndexSet"
dataService="ExamineBootcamp.BusinessLogic.Indexer.DbIndexer, ExamineBootcamp.BusinessLogic"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexTypes="ukTowns" runAsync="true"/>
<add name="TownSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine"
indexSet="ukTownsIndexSet"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
@perploug
perploug / gist
Created August 17, 2017 15:11
examine sample
@using Examine.LuceneEngine.SearchCriteria;
@{
var criteria = Examine.ExamineManager.Instance
.CreateSearchCriteria()
.Field("artist", "pnk".Fuzzy())
.And()
.Field("title", "wall")
.Compile();
@perploug
perploug / editor.controller.js
Created August 15, 2017 13:01
complex editor sample code
angular.module("umbraco").controller("my.forumsearcher.controller",
function ($scope, $http) {
if (angular.isArray($scope.model.value) === false) {
$scope.model.value = [];
}
$scope.add = function (result) {
$scope.model.value.push(result);
@perploug
perploug / editor.html
Last active August 15, 2017 09:57
Twitter Username
<div class="twitter-username thumbnail" style="width: 220px">
<!-- here we display the updated value using ng-src to display it as part of a image pulled from twitter - by default it pulls the image from the twitter account -->
<img ng-src="https://twitter.com/{{model.value || 'Twitter'}}/profile_image?size=original" class="img-circle">
<!-- this is where we input our username and bind it to the value of the field -->
<input type="text" placeholder="Username" ng-model="model.value">
</div>
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
@perploug
perploug / gist:7334403
Last active October 11, 2016 12:57
how to hook into tree menus in V7
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
namespace Meh.App_Code
{
public class ChangeMenu : ApplicationEventHandler
{
@perploug
perploug / userscript
Created May 7, 2013 08:33
Userscript for hiding eb.dk/nationen and fb comments, use tampermonkey in chrome to load
// ==UserScript==
// @name AntiStupidity
// @description Hides facebook and EB nationent comments on all sites
// @author pph
// @include http://*
// @include https://*
// ==/UserScript==
(function() {
var css = "#comments.widget-container, .fb_ltr, .fbComments, .fbTimelineUFI{ display: none !important; }";
if (typeof GM_addStyle != "undefined") {
@perploug
perploug / gist:1957553
Created March 2, 2012 10:22 — forked from warrenbuckley/gist:1957541
List Child pages from site root (1st level)
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
//declare variables
var rootNode = DynamicModel.AncestorsOrSelf.Last();
}