Skip to content

Instantly share code, notes, and snippets.

Avatar
💯
keep it one hunnid

Tobias Lopez ninjaonsafari

💯
keep it one hunnid
View GitHub Profile
@ninjaonsafari
ninjaonsafari / umbraco.overrides.memberresource.js
Created Oct 10, 2016
over ride the umbraco memberResource facotry
View umbraco.overrides.memberresource.js
function customMemberResource($q, $http, umbDataFormatter, umbRequestHelper) {
function saveMember(content, action, files) {
// custom code
}
return {
getPagedResults: function (memberTypeAlias, options) {
// custom code
},
View Base.cshtml
@model GridControl
@{
string view = Model.Editor.Render != null ? Model.Editor.Render.ToString() : Model.Editor.View.ToString();
view = view.ToLower().Replace(".html", ".cshtml");
if (!view.Contains("/"))
{
view = "grid/editors/" + view;
}
View IPublishedContentExtensions.cs
namespace Opten.Umbraco.Components.Web.Extensions
{
/// <summary>
/// Provides extension methods for <c>IPublishdedContent</c>.
/// </summary>
public static class IPublishedContentExtensions
{
/// <summary>
/// Gets node from contentpicker
/// </summary>
@ninjaonsafari
ninjaonsafari / LanguagePickerDataSource.cs
Created Jul 15, 2016
Umbraco nuPickers DataSource for a language picker
View LanguagePickerDataSource.cs
using nuPickers.Shared.DotNetDataSource;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Web;
namespace Opten.NAMESPACE.Web.DataSources
{
public class LanguagePickerDataSource : IDotNetDataSource
{
IEnumerable<KeyValuePair<string, string>> IDotNetDataSource.GetEditorDataItems(int contextId)
@ninjaonsafari
ninjaonsafari / DynamicRobotsTxt.cs
Created Feb 22, 2016
Dynamic Robots.txt => Sitemap: http://{HTTP_HOST}/sitemap source code from this package https://our.umbraco.org/projects/website-utilities/cultiv-dynamicrobots
View DynamicRobotsTxt.cs
using System;
using System.IO;
using System.Web;
namespace Cultiv.DynamicRobots
{
public class RobotsTxt : IHttpHandler
{
public bool IsReusable
{
View stDefaultSelection.js
app.directive('stDefaultSelection', function() {
return {
require: 'stTable',
restrict: 'A',
scope: {
selection: '=stDefaultSelection',
},
link: function link(scope, element, attrs, controller) {
var pagination = null,
hasLoaded = false,
@ninjaonsafari
ninjaonsafari / MobileHandler.cs
Created Jan 30, 2015
This code snippet changes the template on the request if its a mobile
View MobileHandler.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using umbraco;
using umbraco.BusinessLogic;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;