Skip to content

Instantly share code, notes, and snippets.

Charles Roper charlesroper

Block or report user

Report or block charlesroper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
charlesroper / gist:f2da6152d6789fa6f25e9d194a42b889
Last active Aug 19, 2019
How to setup a practically free CDN
View gist:f2da6152d6789fa6f25e9d194a42b889

How to setup a practically free CDN

I've been using [Backblaze][bbz] for a while now as my online backup service. I have used a few others in the past. None were particularly satisfactory until Backblaze came along.

It was - still is - keenly priced at a flat $5 (£4) per month for unlimited backup (I've currently got just under half a terabyte backed-up). It has a fast, reliable client. The company itself is [transparent about their operations][trans] and [generous with their knowledge sharing][blog]. To me, this says they understand their customers well. I've never had reliability problems and everything about the outfit exudes a sense of simple, quick, solid quality. The service has even saved the day on a couple of occasions where I've lost files.

Safe to say, I'm a happy customer. If you're not already using Backblaze, [I highly recommend you do][recommend].

Taking on the big boys with B2


I'm doing a training course at work and promised I would list some of the books on progressive leadership I have found useful. Here they are in alphabetical order.

Creativity Inc. by Ed Catmull

I love Pixar movies. They have so very rarely fallen below the benchmark of excellent. Not only are they classic stories in their own right, they are also technical marvels. How does an organisation like Pixar maintain such a successful track record? How does it manage to be hugely commercially successful and critically acclaimed, too? Few studios can lay claim to staying so true to their art, especially when the stakes are so high, with the contemporary movies having typically having a budget in excess of $200 million. In this book, Ed Catmull explains how.

One of my favourite chapters, The Hungry Beast and the Ugly Baby, tells of how Pixar has to carefully balance the tension of feeding the "hungry beast" (that is, keeping the business going) with the need to generate and try new ideas, that enter the world a

View partial.cshtml
@inherits UmbracoViewPage<IRelatedLinks>
var linkCards = Model.LinkCards;
var linkCardsAreEnabled = Model.RelatedLinksEnabled;
if (linkCards == null || !linkCardsAreEnabled)
linkCards = Model.Parent.GetPropertyValue<IEnumerable<IPublishedContent>>("linkCards", true);
linkCardsAreEnabled = Model.Parent.GetPropertyValue<bool>("relatedLinksEnabled", true);
charlesroper / 99BottlesCSharpTest.cs
Created Apr 27, 2017
Tests for 99 Bottles of Beer song
View 99BottlesCSharpTest.cs
using Xunit;
public class BeerSongTest
public void First_generic_verse()
var expected =
"99 bottles of beer on the wall, 99 bottles of beer.\n"+
"Take one down and pass it around, 98 bottles of beer on the wall.\n"+
charlesroper / cf-update-dns-txt.ps1
Last active Jul 15, 2019
PowerShell script to update the _acme-challenge TXT entry on CloudFlare
View cf-update-dns-txt.ps1
# See for background
# Could be enhanced by putting YOUR_CF_API_KEY and YOUR_EMAIL in environment vars
# Usage:
# > cf-update-dns-txt.ps1 -Domain -Value vNx_fpLgvq0l4rqSATuxhxl9pa155SoeKvNZ98AFB_4
param( [string]$domain, [string]$value )
$headers = @{
"X-Auth-Key" = "YOUR_CF_API_KEY"
"X-Auth-Email" = "YOUR_EMAIL"
"Content-Type" = "application/json"

![If you want to wake at 6am, when should you go to sleep?][sleepy_crop]

I have a love-hate relationship with sleep. I love sleeping and I hate not getting enough. I naturally lean towards being a late [chronotype][chronotype] - a night owl. I tend to stay up late and rise late, yet I don't find this rhythm to be particularly productive. I used to get a second wind - or just one long wind - throughout the afternoon and into the late evening, but not any more. Now I'm older, I find I run out of mental steam sooner and end up spinning my wheels. If I'm particularly tired, my eyes will droop and I'll be nodding at the keyboard. Most importantly, a tired person who is grouchy because he didn't achieve what he wanted during the day is no good when an ebullient daughter wants to play. That I am present for my daughter is as important as any work, so I need to pace my energy.

To compound this problem, if I get out of bed early and really do not get enough sleep, I run out of steam much earlier and it can disrupt t

charlesroper / pageName2.cshtml
Created Apr 5, 2016
Using partial view macro parameters
View pageName2.cshtml
@inherits Umbraco.Web.Macros.PartialViewMacroPage
var tag = Model.MacroParameters["tag"].ToString();
var klass = Model.MacroParameters["klass"].ToString();
<@tag class="@klass">
@Umbraco.Field("pageNameOverride", altFieldAlias: "pageName")
charlesroper / view.cshtml
Last active Apr 5, 2016
Calling a partial view macro
View view.cshtml
new {
"tag" = "h1",
"klass" = "page-name"
charlesroper / view.cshtml
Last active Apr 5, 2016
2016-03-23 A partial using ViewData arguments
View view.cshtml
var tag = ViewData["tag"].ToString();
var klass = ViewData["klass"].ToString();
<@tag class="@klass">
@Umbraco.Field("pageNameOverride", altFieldAlias: "pageName")
charlesroper / callPartialWithViewDataDictionary.cshtml
Last active Mar 23, 2016
2016-03-23 Calling a partial with a ViewDataDictionary parameter
View callPartialWithViewDataDictionary.cshtml
new ViewDataDictionary {
{"tag", "h1"},
{"klass", "page-name"}
You can’t perform that action at this time.