Skip to content

Instantly share code, notes, and snippets.

View naepalm's full-sized avatar

Janae Cram naepalm

View GitHub Profile
@naepalm
naepalm / TheEnd.md
Last active October 14, 2019 01:03
People say you only die once, but Bryce Kenoyer knows the unlucky ones have a chance to die twice.

The Witching Hour, October 12, 2019

She spent an entire five minutes standing in the woods a short walk from her house, screaming. It doesn't matter. Screaming her pain into the void has only resulted in something happening once over the last two years she's done it when the night has been particularly bad. And in that moment, there had been a gorgon. But tonight, with the worst news she's had in three years, Bryce needed to do something - even if it's entirely futile - to let it out.

That was a half an hour ago. Now, she's sitting in the treehouse, burrowed in her insulated sleeping bag with half a bottle of whiskey left and no end to the misery. But a crisp, clear October night means the stars are out and beautiful against the dark sky. So Bryce stares at it as she takes pulls from the bottle, body warm but face cold against the air, and she remembers.


Early Evening, January 17, 2016

@naepalm
naepalm / MarkdownConverter.gs
Created January 8, 2019 18:19
Converts a Google Doc into Markdown and e-mails it to the account attached to the document. Open a doc and go to Tools > Script Editor then paste this code in and run it.
/*
Usage:
Adding this script to your doc:
- Tools > Script Manager > New
- Select "Blank Project", then paste this code in and save.
Running the script:
- Tools > Script Manager
- Select "ConvertToMarkdown" function.
- Click Run button.
- Converted doc will be mailed to you. Subject will be "[MARKDOWN_MAKER]...".
@naepalm
naepalm / RadioButtonValueConverter.cs
Created August 31, 2018 15:30
Converts the core radio button automagically with ModelsBuilder from the value Id to the prevalue string. This does not use Dependency Injection, but it does work, so feel free to use it if you'd like!
using System;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
namespace Offroadcode.Web.PropertyConverters
{
class RadioButtonValueConverter : PropertyValueConverterBase, IPropertyValueConverterMeta
{
@naepalm
naepalm / HasGridRow.cs
Last active July 20, 2018 15:06
Checks to see if a grid has a specific row.
public static bool HasGridRow(this GridDataModel model, string rowName)
{
if (model.Sections.Any())
{
foreach (var section in model.Sections)
{
if (section.HasRows)
{
foreach (var row in section.Rows)
{

How to set up ModelsBuilder & AutoMapper on a Project

AutoMapper is used to map the ModelsBuilder Api to Umbraco ViewModels. Dave Woestenborghs has written an excellent article on 24 Days that you can read for more information. This step-by-step is basically a paired down version of his article and a heads up for gotchas we encountered when setting up our project.

Step 1: Install the Visual Studio Extension for ModelsBuilder

(If this isn't your first project using this method, you already have this installed, so don't worry about it!)

Download and Install Stephan's custom ModelsBuilder tool for VS:

@naepalm
naepalm / ExampleCode.cshtml
Last active August 3, 2017 16:35
The handy CheckboxListFor Html extension.
@using(Html.BeginUmbracoForm<ExampleSurfaceController>("SubmitForm", FormMethod.Post))
{
@Html.CheckBoxListFor(x => x.CheckboxListField, Model.CheckboxListSelectItems)
<button type="submit">Submit</button>
}
@naepalm
naepalm / GridExtensions.cs
Last active July 20, 2017 15:48
Grid extensions for use with Ditto, Skybrud, DocType Grid Editor, and the DocType Grid Editor Reusable Content package
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Our.Umbraco.Ditto;
using Offroadcode.Web.Models.Widgets;
using Skybrud.Umbraco.GridData;
using Skybrud.Umbraco.GridData.Values;
using Umbraco.Core.Models;
using Umbraco.Web;
@naepalm
naepalm / DocTypeGridEditorReusableContentExample.cshtml
Created June 8, 2017 20:19
An example for how a DocType Grid Editor partial view should look with the DTGE: Reusable Content Extension
@inherits UmbracoTemplatePage
@{
// Set a variable to use the default content if no linked content has been selected
var content = Model.Content;
// Check to see if there's a linked page value
if(Model.Content.HasProperty("dtgeLinkedId") && Model.Content.HasValue("dtgeLinkedId"))
{
// Run the linked page value through Umbraco.TypedContent() to get the IPublishedContent page
var dtgePage = Umbraco.TypedContent(Model.Content.GetPropertyValue("dtgeLinkedId"));
@naepalm
naepalm / ZoomAreaCropperView.cshtml
Last active May 26, 2017 16:58
A simple example of how to use the Zoom Area Cropper in a view.
@inherits UmbracoTemplatePage
@using ZoomAreaCropper.Models
@{
Layout = null;
}
@if (Model.Content.HasValue("photo"))
{
var photo = Model.Content.GetPropertyValue<ZoomAreaCropper>("photo");
if (photo.HasMedia)

Skrift headquarters resides in Bellingham, WA, at whatever restaurant or coffee house of choice suits Erica, Janae, and Kyle for their weekly meetings. At it's core, the magazine was contrived to bring the global Umbraco community together and find a localized place to promote uWestFest and other festivals around the world. Having worked together for seven years, each member of the team brings their own unique skills to Skrift's management. As a freelance UX designer, Erica is in charge of design, user testing, and statistics, Janae specializes in the C#, HTML, and CSS of the site as their resident code junkie, and Kyle puts his skills to use both as their Javascript guru and Editor In Chief (he's an award winning journalist and cartoonist, you know!*). Passionate about the web and Umbraco with skills developed working together in an agency bef