Skip to content

Instantly share code, notes, and snippets.

View benmccallum's full-sized avatar

Ben McCallum benmccallum

View GitHub Profile
@benmccallum
benmccallum / MSSQL Server - Kill all processes on a DB.sql
Last active August 29, 2015 14:24
MSSQL Server - Kill all processes on a DB
USE master;
GO
ALTER DATABASE AdventureWorks
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE AdventureWorks
SET MULTI_USER;
GO
@benmccallum
benmccallum / CSS - Vertical align.css
Created July 3, 2015 02:08
CSS - Vertical align
.parent-element {
transform-style: preserve-3d;
}
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@benmccallum
benmccallum / ChangeSearchProvider.ps1
Last active February 15, 2016 12:43 — forked from patrickperrone/ChangeSearchProvider.ps1
This PowerShell script will change your Sitecore instance search provider from Lucene to Solr or vice versa. It can be called from a build process to do so.
Function Set-SCSearchProvider
{
param([string]$choice, [string]$rootPath)
$validInput = $true;
#test that path is valid
If (!(Test-Path -Path $rootPath))
{
Write-Host "The supplied path was invalid or inaccessible." -ForegroundColor Red;
$validInput = $false;
@benmccallum
benmccallum / PostWFFM800Script.ashx
Created January 11, 2016 11:01
Web Forms for Marketers rev. 141217 manual fixes script
<%@ WebHandler Language="C#" Class="PostWFFM800Script" %>
using System;
using System.Linq;
using Sitecore.sitecore.admin;
using Sitecore.Data.Items;
using Sitecore.Data;
using System.Xml.Linq;
using System.Collections.Generic;
using Sitecore.SecurityModel;
@benmccallum
benmccallum / Test.ps1
Created January 31, 2016 23:21
Automate VM shutdown/startup with timezone offset
$TimezoneOffset = -6
$currentTime = (Get-Date).ToUniversalTime()
Write-Output "Runbook started"
Write-Output "Current UTC/GMT time [$($currentTime.ToString("dddd, yyyy MMM dd HH:mm:ss"))] will be checked against schedules"
Write-Output "A TimeZone offset of [$TimezoneOffset] will be used in comparisons"
$TimeRange = "29 January"
# Initialize variables
@benmccallum
benmccallum / Query.sql
Created January 31, 2016 23:21
Find all Sitecore items under /sitecore/content with $name in a field
WITH ItemsWithFullPath (id, name, fullpath)
AS
(
SELECT ID, Name, cast(name as nvarchar(max)) as fullpath
FROM [dbo].Items
WHERE ParentID = '00000000-0000-0000-0000-000000000000'
UNION ALL
SELECT i.ID, i.Name, cast((fullpath +'/' + i.name) as nvarchar(max)) as fullpath
FROM [dbo].items i
INNER JOIN ItemsWithFullPath a on i.ParentID = a.id
@benmccallum
benmccallum / Index.cshtml
Last active August 3, 2016 04:37
EPiServer - Detecting Block editing
@using EPiServer.Core
@using EPiServer.Editor
@using EPiServer.Web.Mvc.Html
@model MyWebsite.Models.BlockTypes.EmergencyNotificationBlock
<div class="card-static full">
<div class="emergency-notification">
<div class="icon @Model.AlertType.ToString().ToLower()"></div>
<div class="wrapper">
@benmccallum
benmccallum / deploy.cmd
Last active October 19, 2020 18:35
Purge an Azure CDN cache with cURL, jq and deploy.cmd batch file
:: Below is an example of extending a deploy.cmd file (see kudu custom deployment scripts) to clear an Azure CDN endpoint
:: using the Azure Resource Manager (ARM) API with help of cURL.exe and jq.exe utils.
:: 4. Purge CDN cache of all caches files
:: Requires an application to be setup in the Azure Active Directory on the same tenant,
:: with a client id and key/secret, and permissions to the Azure CDN Endpoint (CDN Endpoint Contributor)
::SET CLIENT_ID="from-app-settings"
::SET CLIENT_SECRET="from-app-settings"
IF NOT DEFINED CLIENT_ID (
echo 4. Skipping Azure CDN cache purge. App Setting "CLIENT_ID" was not found. Potentially this is a local test deployment run.
@benmccallum
benmccallum / ..Instructions
Last active February 28, 2020 09:00 — forked from benosman/.deployment
Hosting Nuxt on Azure App Service (iisnode) with custom Git based deployment (kudu)
Previously this gist had a series of files showing a working setup, but,
@burkeholland found a much easier way and demonstrates it here:
https://github.com/burkeholland/nuxt-appservice-windows
Essentially, you'll:
1. add a .deployment file to instruct kudu to run `npm install` for you,
2. leverage npm tasks' `postinstall` hook in package.json to trigger the full nuxt build,
3. add a server.js file in the root that `require`s the default server\index.js file that a nuxt app will already have
Step 3 will be noticed by kudu, which will:
@benmccallum
benmccallum / _Instructions.md
Last active July 25, 2021 03:35
nuxtjs, bootstrap-vue with custom bootstrap build

Important! This guide is out of date (circa 2017) and should no longer be used. For the latest advice, please refer to the BootstrapVue docs and their Nuxt.js module. https://bootstrap-vue.org/docs#nuxt-js

General setup:

  1. Install bootstrap as a dev dependency, and its dependencies (node-sass and sass-loader) npm install --save-dev bootstrap@4.0.0-beta.2 node-sass sass-loader