Skip to content

Instantly share code, notes, and snippets.

View hartviglarsen's full-sized avatar

Morten Hartvig hartviglarsen

View GitHub Profile
[user]
name = Hartviglarsen
email = morten@hartviglarsen.com
[alias]
a = add
appendtocommit = commit -a --amend -C HEAD
b = branch
changed = show --stat --oneline
cim = commit -m
cob = checkout -b
@hartviglarsen
hartviglarsen / Bulma.cshtml
Last active March 9, 2018 21:48
Simple Bulma grid for Umbraco
@inherits UmbracoViewPage<dynamic>
@if (Model != null && Model.sections != null)
{
bool oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
<div class="umb-grid">
@if (oneColumn)
{
foreach (var section in Model.sections)
@hartviglarsen
hartviglarsen / Pagination.cs
Created March 31, 2018 19:52
Simple Umbraco pagination
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Home>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
Layout = "Master.cshtml";
Home home = Model.Content as Home;
int page = 1;
var postsPerPage = home.PostsPerPage;
let date = new Date().toJSON().slice(0, 10).split("-").reverse().join("-")
@hartviglarsen
hartviglarsen / Master.cshtml
Created April 24, 2018 08:44
Umbraco breadcrumbs
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
Layout = null;
var crumbs = Model.Content
.Ancestors()
.Where(x => x.IsVisible())
.OrderBy("Level");
}
@hartviglarsen
hartviglarsen / BenQ
Created April 28, 2018 11:04
Monitors
Picture
Brightness 81
Contrast 45
Sharpness 5
Gamma 2
Color Temp Bluish
Picture Advanced
Picture Mode Low Standard
Overscan Off
@hartviglarsen
hartviglarsen / web.config
Last active July 9, 2018 19:43
IIS Rewrites
<system.webServer>
<rewrite>
<rules>
<rule name="Remove WWW" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="https://{C:2}/{R:1}" appendQueryString="true" redirectType="Found" />
@hartviglarsen
hartviglarsen / RefreshPreVal.cs
Created June 19, 2018 10:12
Umbraco prevalues cache
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Logging;
public class RefreshPreVal : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
using Hartviglarsen.Core.ViewModels;
using Hartviglarsen.Factories;
using System.Web.Mvc;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
namespace Hartviglarsen.Core.Controllers
{
public class BlogController : RenderMvcController
{
function getProducts() {
var url = "url.com/children";
var options = {
"method" : "get",
"contentType": "application/json"
};
var response = UrlFetchApp.fetch(url, options);
response = JSON.parse(response);