Skip to content

Instantly share code, notes, and snippets.

View Swimburger's full-sized avatar
🍔
Creating full snack content

Niels Swimberghe Swimburger

🍔
Creating full snack content
View GitHub Profile
@Swimburger
Swimburger / index.html
Created January 1, 2017 20:20
jQuery sortChildren() extension
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<button>sort</button>
<ul>
@Swimburger
Swimburger / jsbin.higohi.js
Last active June 15, 2017 08:14
calculate grid item width
function getWidth(width, spacing, amountOfColumns){
return (width - (spacing * (amountOfColumns - 1))) / amountOfColumns;
}
console.log(getWidth(921, 10, 3));
console.log(getWidth(921, 10, 2));
console.log(getWidth(921, 10, 1));
@Swimburger
Swimburger / SassMeister-input.scss
Last active June 24, 2017 11:53
Generate margin utility classes. Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@mixin margin-class($side, $number) {
$firstLetter: str-slice($side, 0, 1);
.m-#{$firstLetter}-#{$number}{
margin-#{$side}: #{$number}px;
}
@Swimburger
Swimburger / App.config
Created October 12, 2017 14:57
Change username, password and lockout from console application Asp.net identity
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<connectionStrings>
<add name="core" connectionString="yourconnectionstring" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<membership defaultProvider="sql" hashAlgorithmType="SHA512">
@Swimburger
Swimburger / index.js
Created October 25, 2017 15:44
Small hash parser and generator
var path1 = "/slfkj/sadfkl#cat=5,id=dfsklsdkajf";
var path2 = "/slfkj/sadfkl#cat=a,id=dAS";
var path3 = "/slfkj/sadfkl#cat=asf,id=BL";
function getHashValues(path){
var result = {};
var hash = path.slice(path.indexOf('#') + 1);
var keyValues = hash.split(',');
@Swimburger
Swimburger / BlogPostUrlProvider.cs
Last active August 10, 2018 01:51
BlogPostUrlProvider
public class BlogPostUrlProvider : IUrlProvider
{
public IEnumerable<string> GetOtherUrls(UmbracoContext umbracoContext, int id, Uri current)
{
return Enumerable.Empty<string>();
}
public string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
{
var content = umbracoContext.ContentCache.GetById(id);
@Swimburger
Swimburger / GenerateRewriteMap.ps1
Created September 27, 2018 20:46
PowerShell script to generate Rewrite Maps config files based on as CSV file
param([string] $csvPath, [string] $configOutputPath, [string] $rewriteMapName)
$csv = Import-Csv -Delimiter ";" -Path $csvPath
$xml = New-Object -TypeName XML
$xml.Load($configOutputPath)
$rewriteMap = Select-XML -Xml $xml -XPath "//rewriteMap[@name='$rewriteMapName']"
$rewriteMap.Node.SelectNodes('//add') | ForEach { $_.ParentNode.RemoveChild($_) } | Out-Null
@Swimburger
Swimburger / MigrateDnsToAzure.ps1
Last active May 27, 2020 15:21
(DO NOT USE, OUT OF DATE) Move Domain name registrar to Azure DNS
#Based on https://www.lieben.nu/liebensraum/2017/07/transferring-a-domain-to-azure-dns-and-billing/
Connect-AzureRmAccount
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.DomainRegistration
$rgName = "MY_RESOURCE_GROUP_NAME" #Azure Resource Group to put DNS in
$ResourceName = "MY_DOMAINNAME.COM" #Your domain name
$AuthCode = "YOUR AUTH CODE" #transfer authentication code form Domain Registrar (GoDaddy)
$ResourceLocation = "Global"
@Swimburger
Swimburger / TriggerError500.ascx
Last active October 4, 2018 21:01
TriggerError500.ascx DNN
public partial class TriggerError500 : PortalModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
if(UserId == -1)
{
throw new NotImplementedException();
}
}
}
@Swimburger
Swimburger / PingFilter.cs
Last active September 20, 2019 21:44
ITelemetryProcessor for Application Insights to filter out Umbraco's ping requests, learn more at https://swimburger.net/blog/umbraco/ignoring-umbraco-ping-from-azure-application-insights
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using System;
namespace YourApp.ApplicationInsights
{
public class PingFilter : ITelemetryProcessor
{
//next processor in the pipeline