Skip to content

Instantly share code, notes, and snippets.

@jamescoxhead
jamescoxhead / Redirects.config.xml
Last active January 25, 2016 17:28
Hygiene Umbraco redirect rules (based on http://24days.in/umbraco/2014/redirect-rules/)
<?xml version="1.0"?>
<rules>
<rule name="Whitelist" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="^/(umbraco|install)(.*)" />
</conditions>
<action type="None" />
</rule>
@jamescoxhead
jamescoxhead / Brackets.json
Last active September 11, 2016 18:18
Brackets configuration
{
"fonts.fontSize": "12px",
"fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",
"healthData.healthDataTracking": false,
"dragDropText": true,
"insertHintOnTab": true,
"pane.mergePanesWhenLastFileClosed": true,
"styleActiveLine": true,
}
@jamescoxhead
jamescoxhead / Reshaper7.DotSettings.xml
Last active January 25, 2016 17:27
Config for Resharper 7
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/IntelliSenseCompletingCharactersSettingCSharp/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/LookupWindow/ShowSignatures/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/LookupWindow/ShowSummary/@EntryValue">True</s:Boolean>
<s:Int64 x:Key="/Default/CodeEditing/Intellisense/ParameterInfo/AutopopupDelay/@EntryValue">100</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Full Cleanup</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAI
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteBasicCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ExtensionMethodsInSmartCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/LookupWindow/ShowSignatures/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Full Cleanup</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUER
@jamescoxhead
jamescoxhead / RolesOwnedByUser.sql
Created January 11, 2016 09:49
Lists any roles associated with a SQL Server user
select DBPrincipal_2.name as role, DBPrincipal_1.name as owner
from sys.database_principals as DBPrincipal_1 inner join sys.database_principals as DBPrincipal_2
on DBPrincipal_1.principal_id = DBPrincipal_2.owning_principal_id
where DBPrincipal_1.name = 'USER_NAME'
@jamescoxhead
jamescoxhead / UmbracoUnusedDatatypes.sql
Last active November 23, 2016 12:59
Lists Umbraco datatypes which haven't been used on document types. Care is needed if using packages like Archetype as this script will show datatypes as unused if they are only used on an archetype.
SELECT distinct [nodeId]
FROM [cmsDataType]
EXCEPT
SELECT distinct dataTypeId
FROM [cmsPropertyType]
@jamescoxhead
jamescoxhead / uCommerceDeleteProduct.sql
Created January 11, 2016 09:55
Hard deletes a uCommerce product. When a product is deleted from the back office it is only soft deleted, there is no way to hard-delete a product from the back office.
BEGIN TRANSACTION
BEGIN TRY
DECLARE @ProductId int;
SET @ProductId = 142;
DELETE FROM uCommerce_PriceGroupPrice
where ProductId = @ProductId
@jamescoxhead
jamescoxhead / applicationHost.config.xml
Created February 8, 2016 10:49
IIS URL Compression for SVG and fonts (under C:\Windows\System32\inetsrv\config)
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
@jamescoxhead
jamescoxhead / DeleteNodeModules.cmd
Last active February 17, 2016 16:52
Force delete the node_modules folder and contents (from https://github.com/CrumpledDog/SkriftBuildingBlocks)
mkdir temp
robocopy temp node_modules /MIR
rd temp
rd node_modules
@jamescoxhead
jamescoxhead / HMACSHA1-Encode.linq
Created February 26, 2016 17:19
Linqpad Queries
<Query Kind="Statements">
<Reference>&lt;RuntimeDirectory&gt;\System.Security.dll</Reference>
<Namespace>System.Security.Cryptography</Namespace>
</Query>
string unhashed = "password";
HMACSHA1 hash = new HMACSHA1();
hash.Key = Encoding.Unicode.GetBytes(unhashed);