This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspiration taken from http://zslabs.com/articles/svg-background-fill/ | |
// Note that this will replace all provided attributes in all elements in the svg, currently limited to two parameters | |
.icon-color(@src, @color, @attr) { | |
@escape-color: escape("@{color}"); | |
@data-uri: data-uri('image/svg+xml;charset=UTF-8', "@{src}"); | |
@attr1: extract(@attr, 1); | |
@attr2: extract(@attr, 2); | |
@val1: replace("@{data-uri}", "@{attr1}%3D%22(.*?)%22", "@{attr1}%3D%22@{escape-color}%22", "gi"); | |
@val2: replace("@{val1}", "@{attr2}%3D%22(.*?)%22", "@{attr2}%3D%22@{escape-color}%22", "gi"); | |
background-image: e(@val2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web.Routing; | |
using Umbraco.Web.Mvc; | |
public class CustomRenderControllerFactory : RenderControllerFactory | |
{ | |
// Attempt to resolve an alternative controller | |
// This methods is called for all controllers in the request pipeline including surface controllers and possibly third party controllers. | |
// We need to make sure we only hijack the actual Umbraco page request. | |
public override Type GetControllerType(RequestContext requestContext, string controllerName) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RazorHelpers | |
{ | |
// This approach is using WebPages, where there is no concept of a Controller | |
public static string RenderTemplate(string template, object model) | |
{ | |
var page = WebPageBase.CreateInstanceFromVirtualPath("~/templates/" + template + ".cshtml"); | |
var context = new WebPageContext(new HttpContextWrapper(HttpContext.Current), page, null); | |
var htmlWriter = new StringWriter(); | |
// Access your model through PageData["Model"] in the view | |
context.PageData["Model"] = model; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
var expander = function (node) { | |
var overlay = $(node); | |
// The toggle is already added, don't do anything | |
if (overlay.find(".overlay-expander--toggle").length > 0) { | |
return; | |
} | |
var toggle = $("<a href class='btn overlay-expander--toggle'><i class='icon icon-navigation-left'></i></a>"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The basic idea is, that I want to avoid writing html in the tag helper class. | |
This poc, if it worked, would simply pass the ModelExpression down to a view component, where the actual html lives. | |
From there we would then render various tag helpers based on the ModelExpression. | |
Unfortunately, it seems that tag helpers in the view component simply creates a ModelExpression of the passed in ModelExpression, inception? | |
So, to make it work, I guess I would need to "trick" tag helpers into accepting an existing ModelExpression? Doable? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0451e06107fce07bfdf8128a88173cf75575dc07c8949bb28f53c76e2481ae80fe7ac196389a4626c5e12abddf45986b875b6c9f2f39beab372a16bc295a97b2b2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://stackoverflow.com/a/4341677/701242 | |
UPDATE [table] | |
SET [column] = CAST(REPLACE(CAST([column] as NVarchar(MAX)),'find','replace') AS NText) | |
WHERE [column] LIKE '%find%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string baseUrl = "https://playgroundapi.ost.com"; | |
private static string key = "xxx"; | |
var name = "apiuser"; | |
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(); | |
var request = $"/users/create?api_key={key}&name={name}&request_timestamp={timestamp}"; | |
var signature = Sign(request); | |
var values = new Dictionary<string, string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("umbraco").controller("SimpleDropDown", | |
function ($scope) { | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PdfModule : IHttpModule | |
{ | |
public void Init(HttpApplication context) | |
{ | |
context.PostAuthorizeRequest += PostAuthorizeRequest; | |
} | |
void PostAuthorizeRequest(object sender, EventArgs e) | |
{ | |
var context = HttpContext.Current; |