Skip to content

Instantly share code, notes, and snippets.

View JimBobSquarePants's full-sized avatar
💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)

James Jackson-South JimBobSquarePants

💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)
View GitHub Profile
@joeriks
joeriks / 404handlers.config
Last active December 17, 2015 15:19
Catching all requests to URLs beneath a node if it has umbracoCatchAll=1, or at the same level if it's named * Example 1: add a document named * wherever and it will catch all "sibling" url calls (for example /products/* will catch /products/foo and /products/bar) Example 2: add a property umbracoCatchAll to a document and set it to 1 and it wil…
<?xml version="1.0" encoding="utf-8" ?>
<NotFoundHandlers>
<notFound assembly="umbraco" type="SearchForAlias" />
<notFound assembly="umbraco" type="SearchForTemplate"/>
<notFound assembly="umbraco" type="SearchForProfile"/>
<notFound assembly="CatchAllRouteHandler" namespace="Our" type="CatchAll"/>
<notFound assembly="umbraco" type="handle404"/>
</NotFoundHandlers>
@leekelleher
leekelleher / MyApplication.cs
Last active December 19, 2015 13:59
Example of Umbraco 6.1's IContentFinder
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
namespace Our.Umbraco
{
public class MyApplication : ApplicationEventHandler
{
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='/js/lib/dummy.js'></script>
@erikporter
erikporter / FileStorage.cs
Last active January 2, 2016 18:39
Example of using a Mutex to lock some async file system calls in WP8.
public class FileStorage : IDisposable {
private static readonly Dictionary<string, Mutex> Mutexes = new Dictionary<string, Mutex>();
public async Task DoSomethingAsync(string accountId) {
var mutex = GetMutex(accountId);
try {
mutex.WaitOne();
// Do something to files
}
module tweak {
function getViewUrl(viewName: string) {
return `/App_Plugins/tweaks/views/${viewName}.html`;
}
export class views {
static mediaPicker = getViewUrl("media-picker");
}
public struct Fast2DArray<T>
{
public T[] Data;
public int Width;
public int Height;
public Fast2DArray(T[,] data)
{
this.Height = data.GetLength(0);
public class Configuration
{
public MemoryManager MemoryManager { get; set; } = SharedPoolingManagedMemoryManager.Instance;
public static Configuration Default { get; }
// ...
}
public interface IDecoderOptions
@MehdiNS
MehdiNS / bayer_matrix.cpp
Created October 31, 2016 13:49
Generate the bayer matrix of order n (of dimension 2^n x 2^n) iteratively
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
using uint = unsigned int;
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec)
{
@mkchandler
mkchandler / DisableNuGetPackageRestore.ps1
Last active February 13, 2018 04:07
Disable the NuGet Package Restore functionality in a Visual Studio solution.
# Usage: .\DisableNuGetPackageRestore.ps1 C:\Path\To\Solution.sln
# Get the path that the user specified when calling the script
$solution = $args[0]
$solutionPath = Split-Path $solution -Parent
$solutionName = Split-Path $solution -Leaf
# Delete the .nuget directory and all contents
Remove-Item (Join-Path $solutionPath ".nuget") -Force -Recurse -ErrorAction 0
@terrajobst
terrajobst / SplitByNamespace.cs
Created July 10, 2018 23:36
Split files by namespace
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace NetStandardCleanup