Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Colin Mackay colinangusmackay

🏠
Working from home
View GitHub Profile
@colinangusmackay
colinangusmackay / bva-data.js
Created Jul 22, 2012
The getData function to support articles on Kendo UI on my blog: http://colinmackay.co.uk/tag/kendo-ui/
View bva-data.js
// Data source: http://www.guardian.co.uk/news/datablog/2011/feb/23/british-tourist-attractions-visitor-figures
// Usages of this gist: http://colinmackay.co.uk/tag/kendo-ui/
function getData()
{
var result = [{"Site":"British Museum","Visitors":5842138,"FreeCharge":"F","Change":0.05},{"Site":"Tate Modern","Visitors":5061172,"FreeCharge":"F","Change":0.07},{"Site":"National Gallery","Visitors":4954914,"FreeCharge":"F","Change":0.04},{"Site":"Natural History Museum","Visitors":4647613,"FreeCharge":"F","Change":0.13},{"Site":"Science Museum (South Kensington)","Visitors":2751902,"FreeCharge":"F","Change":-0.01},{"Site":"V&A (South Kensington)","Visitors":2629065,"FreeCharge":"F","Change":0.16},{"Site":"National Maritime Museum","Visitors":2419802,"FreeCharge":"F","Change":0.02},{"Site":"Tower of London (HRP)","Visitors":2414541,"FreeCharge":"C","Change":0.01},{"Site":"St Paul\u0027s Cathedral","Visitors":1892467,"FreeCharge":"F/C","Change":0.04},{"Site":"National Portrait Gallery","Visitors":1819442,"FreeCh
@colinangusmackay
colinangusmackay / economic-data.js
Created Jul 26, 2012
A javascript file used by some blog posts on the Kendo UI : http://colinmackay.co.uk/tag/kendo-ui/
View economic-data.js
function getData() {
var result = [{"Date":"1948-06-01","Rpi":9.7,"Cpi":null,"BoeRate":2},{"Date":"1948-07-01","Rpi":7.2,"Cpi":null,"BoeRate":2},{"Date":"1948-08-01","Rpi":7.9,"Cpi":null,"BoeRate":2},{"Date":"1948-09-01","Rpi":7.6,"Cpi":null,"BoeRate":2},{"Date":"1948-10-01","Rpi":7,"Cpi":null,"BoeRate":2},{"Date":"1948-11-01","Rpi":5.1,"Cpi":null,"BoeRate":2},{"Date":"1948-12-01","Rpi":4.9,"Cpi":null,"BoeRate":2},{"Date":"1949-01-01","Rpi":4.6,"Cpi":null,"BoeRate":2},{"Date":"1949-02-01","Rpi":2.9,"Cpi":null,"BoeRate":2},{"Date":"1949-03-01","Rpi":2.3,"Cpi":null,"BoeRate":2},{"Date":"1949-04-01","Rpi":0.6,"Cpi":null,"BoeRate":2},{"Date":"1949-05-01","Rpi":2.6,"Cpi":null,"BoeRate":2},{"Date":"1949-06-01","Rpi":1.3,"Cpi":null,"BoeRate":2},{"Date":"1949-07-01","Rpi":3,"Cpi":null,"BoeRate":2},{"Date":"1949-08-01","Rpi":3.1,"Cpi":null,"BoeRate":2},{"Date":"1949-09-01","Rpi":3.2,"Cpi":null,"BoeRate":2},{"Date":"1949-10-01","Rpi":3.6,"Cpi":null,"BoeRate":2},{"Date":"1949-11-01","Rpi":3.3,"Cpi":null,"BoeRate":2},{
@colinangusmackay
colinangusmackay / list-columns-as-wiki-markup.sql
Created Jul 2, 2012
A T-SQL script that renders media wiki markup of a list of columns in a table that can be used when creating a data dictionary in a media wiki.
View list-columns-as-wiki-markup.sql
-- For more information about this script and how to use it, visit:
-- http://colinmackay.co.uk/2012/06/15/creating-a-data-dictionary-with-sql-server-and-mediawiki-part-two-a-list-of-columns/
-- Edit these parameters to suit your needs.
DECLARE @catalogue SYSNAME = 'AdventureWorks';
DECLARE @schema SYSNAME = 'Production'
DECLARE @table SYSNAME = 'Product'
View Invoke-CallOperator.psm1
function Invoke-CallOperator
{
[CmdletBinding(DefaultParameterSetName="Verbose")]
param
(
[parameter(Mandatory=$true)]
[string]$ExeFilePath,
[parameter(Mandatory=$true)]
@colinangusmackay
colinangusmackay / List-tables-as-wiki-markup.sql
Created Jul 2, 2012
A T-SQL script that renders media wiki markup of a list of tables or views that can be used in the creation of a data dictionary. More details on my blog: http://colinmackay.co.uk/2012/06/14/creating-a-data-dictionary-with-sql-server-and-mediawiki-part-on
View List-tables-as-wiki-markup.sql
-- For more information about this script and its uses, visit:
-- http://colinmackay.co.uk/2012/06/14/creating-a-data-dictionary-with-sql-server-and-mediawiki-part-one-a-list-of-tables/
DECLARE @Type NVARCHAR(100) = 'BASE TABLE' -- 'VIEW' OR 'BASE TABLE'
DECLARE @catalogue SYSNAME;
DECLARE @schema SYSNAME;
DECLARE @name SYSNAME;
SET NOCOUNT ON
View ControllerAccessTests.cs
//
// This code is referenced in the following blog posts:
// * https://colinmackay.scot/2018/08/17/ensure-controller-actions-classes-have-authorisation/
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
@colinangusmackay
colinangusmackay / Custom.css
Last active Dec 13, 2018
Custom CSS file for Chrome
View Custom.css
/*
This is a custom css file for Chrome. It can be used to create an
initial stylesheet for a document.
It should be placed in the following location:
Windows: C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets
Mac: Mac: ~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css
Linux (Chromium): ~/.config/chromium/Default/User StyleSheets/Custom.css
View PreprocessorSymbols.cs
public static class PreprocessorSymbols
{
public static string StringList => string.Join("; ", ArrayOfSymbols);
public static readonly string[] ArrayOfSymbols = new string[]
{
#if NETFRAMEWORK
"NETFRAMEWORK",
#endif