Skip to content

Instantly share code, notes, and snippets.

View jondjones's full-sized avatar

Jon jondjones

View GitHub Profile
@jondjones
jondjones / EPiServer
Last active December 24, 2015 23:59
EPiServer 6
/// <summary>
/// </summary>
/// <param name="pageReference"></param>
/// <param name="isInEditMode"></param>
/// <returns></returns>
public static IEnumerable<PageData> GetChildren(PageReference pageReference, bool isInEditMode)
{
IEnumerable<PageData> pages = null;
try
location = CallGeoTaggingService(address);
if (location != null)
{
var dp = new DataProvider(ReturnFields.All);
var itemToEdit = dp.GetItem(itemUrl);
if (itemToEdit.Editable)
{
itemToEdit.ForceEditState();
@jondjones
jondjones / How To Get A List Of Scheduled Pages Within Umbraco 8 - 1
Last active March 11, 2020 09:17
How To Get A List Of Scheduled Pages Within Umbraco 8 - 1
public SearchByIndex(string indexName)
{
ExamineManager.Instance.TryGetIndex(indexName, out var index);
var searcher = index.GetSearcher();
ISearchResults results = searcher
.CreateQuery()
.Field("__Published", "n")
.Execute();
return results;
@jondjones
jondjones / How To Get A List Of Scheduled Pages Within Umbraco 8 2
Last active March 11, 2020 08:43
How To Get A List Of Scheduled Pages Within Umbraco 8
public class ScheduledPosts
{
private readonly IContentService _contentService;
public ContentServiceHelper(
IContentService contentService)
{
_contentService = contentService;
}
}
@jondjones
jondjones / How To Get A List Of Scheduled Pages Within Umbraco 8 - 3
Last active April 13, 2021 07:25
How To Get A List Of Scheduled Pages Within Umbraco 8 - 3
var results = SearchByIndex("TutorialIndex");
using (var umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext())
{
foreach (var result in results)
{
var contentPage = _contentService.GetById(Convert.ToInt32(result.Id));
if (contentPage == null)
{
continue;
}
@jondjones
jondjones / Yarn Resolutions To The Rescue - 1
Created March 11, 2020 09:18
Yarn Resolutions To The Rescue - 1
{
"name": "my-package",
"dependencies": {
"packageOne":"~1.0.1",
"packageTwo":"2.0.1"
}
}
@jondjones
jondjones / Yarn Resolutions To The Rescue - 2
Created March 11, 2020 09:19
Yarn Resolutions To The Rescue - 2
{
"name": "packageOne",
"dependencies":
{
"packageTwo": "^3.0.0"
}
}
@jondjones
jondjones / Yarn Resolutions To The Rescue - 2
Created March 11, 2020 09:19
Yarn Resolutions To The Rescue - 2
{
"name": "my-package",
"dependencies": {
"packageOne":"~1.0.1",
"packageTwo":"2.0.1"
}
"resolutions": {
"packageTwo": "^2.0.0",
}
}
@jondjones
jondjones / How To Create a JSON API Within Umbraco 8 - 1
Created March 11, 2020 09:20
How To Create a JSON API Within Umbraco 8 - 1
public class ObjectToReturn
{
public string SomeData { get; set; }
}
@jondjones
jondjones / How To Create a JSON API Within Umbraco 8 - 2
Created March 11, 2020 09:21
How To Create a JSON API Within Umbraco 8 - 2
public class MyApiController : UmbracoApiController
{
[HttpGet]
public JsonResult<List<SomeData>> GetJson()
{
var json = new List<PostInfo>();
// call umbraco, get data, do whatever
return Json(json);