Skip to content

Instantly share code, notes, and snippets.

public class MajesticResolver
{
public class Results
{
public string Error { get; set; }
public Result Result { get; set; }
public Results()
{
Result = new Result();
using System.Text.RegularExpressions;
namespace App.Extensions
{
/// <summary>
/// Generate slug from string
/// </summary>
public static class SlugExtensions
{
/// <summary>
@hallojoe
hallojoe / namespaced-bootstrap.css
Last active July 29, 2016 14:40
This show how to wrap a custom namespace around boostrap css.
/*
when build, this will prefix all rules with "namespaced-bootstrap"
*/
.namespaced-bootstrap {
@import (less) url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css');
}
@hallojoe
hallojoe / kebab-case.js
Last active June 5, 2018 10:21
Javascript kebab case helpers
/*
https://run.plnkr.co/plunks/Sv54t4/
*/
function anyToKebab(s) {
if('string' !== typeof s) return s;
var result = '', i = 0, len = s.length;
for(; i < len; i++)
if(s[i] === s[i].toUpperCase())
result += '-' + s[i].toLowerCase();
else
@hallojoe
hallojoe / select-with-prevalues.html
Last active August 26, 2016 08:54
Dropdown prevalues with angular
<!--
https://plnkr.co/edit/MaCgoj
--><!DOCTYPE html>
<html ng-app="myApp">
<head>
<link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
<script data-require="angularjs@1.5.8" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script>
<script>
var myApp = angular.module('myApp',[]);
myApp.controller('TestController', ['$scope', function($scope) {
[
{
"abbr": "a-",
"origin": "atom"
},
{
"abbr": "AB",
"origin": "andelsboligforening"
},
{
@hallojoe
hallojoe / index.html
Created February 4, 2017 20:33
BS quickdirty
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>j</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
@hallojoe
hallojoe / GetAliasOfAllFieldsOfDataTypeTags.gist.cs
Created October 23, 2017 17:18
Get alias of all fields that have an umbraco.tags property editor on top.
/// <summary>
/// Get the alias of all document type fields
/// where property editor alias is Umbraco.Tags
/// </summary>
/// <param name="applicationContext"></param>
/// <returns></returns>
internal List<string> GetAliasOfAllFieldsOfDataTypeTags(ApplicationContext applicationContext)
{
var result = new List<string>();
var documentTypes = applicationContext.Services.ContentTypeService.GetAllContentTypes();
@hallojoe
hallojoe / LuceneIndexerExtensions.cs
Last active November 29, 2017 08:40
A set of extentsion methods to get field names of indexes
using System.Collections.Generic;
using System.Linq;
using Examine.LuceneEngine.Providers;
using Lucene.Net.Index;
using Examine;
namespace UmbracoExamineApi
{
public static class LuceneIndexerExtensions
{
@hallojoe
hallojoe / StringExtensions.cs
Created January 17, 2018 14:00
String extensions
using System;
using System.Collections.Generic;
using System.Linq;
namespace Cabana.UmbracoExamineApi
{
public static class StringExtensions
{
/// <summary>
/// VanDamme split