Skip to content

Instantly share code, notes, and snippets.

View warrenbuckley's full-sized avatar

Warren Buckley warrenbuckley

View GitHub Profile
$scope.toggleVideo = function(video) {
//Create new JSON object as we don't need full object passed in here
var newVideoObject = {
"id": video.id.videoId,
"title": video.snippet.title
};
//See if we can find the item or not in the array
var tryFindItem = $scope.model.value.map(function (e) { return e.id; }).indexOf(newVideoObject.id);
@warrenbuckley
warrenbuckley / umbracoNotification.js
Last active August 29, 2015 14:10
This is a POC idea to hook into when content node is Saved or Saved & Published do a $http Get/Post to perform some action such as auto create media folder. Then once successful show a notification with notificationService. This is a POC way to try and get around the current lack of firing a notification from an eventHandler like V6 style.
//Get the same base module that Umbraco uses
var app = angular.module("umbraco");
//When the module runs/excutes...
app.run(["$rootScope", "notificationsService", "eventsService", function ($rootScope, notificationsService, eventsService) {
//Let's listen for any time formSubmitting
eventsService.on("formSubmitting", function (e, args) {
console.log("e", e);
console.log("args", args);
@warrenbuckley
warrenbuckley / Azure WebJob Output
Last active August 29, 2015 14:17
Azure WebJob
[03/14/2015 12:00:04 > 73746b: SYS INFO] Status changed to Initializing
[03/14/2015 12:00:08 > 73746b: SYS INFO] Run script 'uHangout.WebJob.exe' with script host - 'WindowsScriptHost'
[03/14/2015 12:00:08 > 73746b: SYS INFO] Status changed to Running
[03/14/2015 12:00:09 > 73746b: INFO] WEBJOBS_PATH:D:\local\Temp\jobs\triggered\uHangout-WebJob\kh5oaqlx.pvr\
[03/14/2015 12:00:09 > 73746b: INFO] Created D:\local\Temp\jobs\triggered\uHangout-WebJob\kh5oaqlx.pvr\App_Data
[03/14/2015 12:00:09 > 73746b: INFO] Created D:\local\Temp\jobs\triggered\uHangout-WebJob\kh5oaqlx.pvr\App_Plugins
[03/14/2015 12:00:09 > 73746b: INFO] Created D:\local\Temp\jobs\triggered\uHangout-WebJob\kh5oaqlx.pvr\media
[03/14/2015 12:00:09 > 73746b: INFO] uHangout YouTube Importer
[03/14/2015 12:00:09 > 73746b: INFO] ==================================
[03/14/2015 12:00:12 > 73746b: INFO] ******
@warrenbuckley
warrenbuckley / gist:7498daadb52f9e8c65c1
Created March 14, 2015 20:02
SQL Azure - Y U SO FLAKY!!
[03/14/2015 20:00:25 > 73746b: INFO] Try and get 'videos' doctype
[03/14/2015 20:00:55 > 73746b: INFO] Exception Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
[03/14/2015 20:00:55 > 73746b: INFO] Exception Source: .Net SqlClient Data Provider
[03/14/2015 20:00:55 > 73746b: INFO] Exception StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
[03/14/2015 20:00:55 > 73746b: INFO] at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
[03/14/2015 20:00:55 > 73746b: INFO] at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
[03/14/2015 20:00:55 > 73746b: INFO] at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkC
@{
//Obviously get header from umbraco value
var header = string.empty;
var mainHeader = Model.Content.GetPropertyValue<string>("mainHeader");
var secondaryHeader = Model.Content.GetPropertyValue<string>("secondaryHeader");
var nodeName = Model.Content.Name;
//Check if we have mainHeader value, fallback to secondaryHeader
header = !string.IsNullOrEmpty(mainHeader) : mainHeader ? secondaryHeader;
@warrenbuckley
warrenbuckley / Navi.cshtml
Created January 29, 2012 22:08
Umbraco V5 Example - Navi
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
//Maximum level you want to loop down to
var maxLevel = String.IsNullOrEmpty(Model.MacroParameters.maxLevel) ? 8 : Convert.ToInt32(Model.MacroParameters.maxLevel);
//Get the current page
@warrenbuckley
warrenbuckley / breadcrumbs.cshtml
Created January 30, 2012 16:38
Umbraco V5 Example - Breadcrumbs
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
<ul id="breadcrumbs">
@foreach (var page in DynamicModel.Ancestors.OrderBy("Level"))
{
<li><a href="@page.Url">@page.Name</a> &raquo;</li>
}
@warrenbuckley
warrenbuckley / MediaPicker.cshtml
Created January 30, 2012 16:55
Umbraco V5 Example - Media Picker
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
//Output an image from the media picker
//Property alias of mediaPicker
@warrenbuckley
warrenbuckley / ListItemsFromMediaFolder.cshtml
Created January 30, 2012 21:28
Umbraco V5 Example - Media Picker List Images from Folder
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
//Output an image from the media picker
//Property alias of mediaPicker
@warrenbuckley
warrenbuckley / MediaUploadProperty.cshtml
Created January 31, 2012 11:05
Umbraco V5 Example - Media Upload Property
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
//Output an image from an upload property on current doctype
//Property alias of upload field
var uploadPropAlias = String.IsNullOrEmpty(Model.MacroParameters.uploadPropAlias) ? "myUploadPropertyAlias" : Model.MacroParameters.uploadPropAlias;