Skip to content

Instantly share code, notes, and snippets.

@rbaty-barr
rbaty-barr / rewriteRule.xml
Last active July 19, 2017 17:02
Rewrite rules example for web.config
<rewrite>
<rules>
<rule name="orgRewrite" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
</conditions>
<action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Redirects umbraco.io to actual domain" stopProcessing="true">
@rbaty-barr
rbaty-barr / resetAdmin.txt
Last active April 21, 2017 17:38
If you get stuck type resources and references
The situation is this... you can no longer get into the umbraco backoffice for one reason or another... trust me it happens!
So, there is a package you can download and it works in most cases:
https://our.umbraco.org/projects/developer-tools/umbraco-admin-reset/
With this package you simply upload the dll to the server via ftp and place it in the .bin folder and you can login in with Admin and Admin1234!
===================================================
however, if you are doing local dev with a compact SQL DB you will have to open the db in web matrix or similar then you can use this command:
UPDATE umbracoUser set userdisabled=0, userLogin='admin', userPassword='bnWxWyFdCueCcKrqniYK9iAS+7E=' where id=0
@rbaty-barr
rbaty-barr / relatedDocs.cshtml
Created March 19, 2017 19:16
simple list of related documents using rjpMultiUrlPicker - umbraco add-on
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using RJP.MultiUrlPicker.Models
@{
var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("relatedItems");
if (multiUrlPicker.Any())
{
<div id="relatedDocs">
<h3>Related Documents & Links</h3>
<ul class="list-unstyled">
@rbaty-barr
rbaty-barr / formsDocsHome.cshtml
Created March 19, 2017 18:42
Forms and Documents rendering
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
<div id="formsDocsArea">
@if(@Model.Content.HasValue("docsFolder") && @Model.Content.GetPropertyValue<string>("asHideShow") == "True"){
var mediaRoot = @Model.Content.GetPropertyValue("docsFolder");
<!-- comment -->
foreach( var item in Umbraco.TypedMedia(mediaRoot).Children){
if(@item.ContentType.Alias =="Folder" && Umbraco.TypedMedia(@item.Id).Children.Count() > 0){
@listFolders("hs", @item, Umbraco.TypedMedia(@item.Id).Children.Count().ToString())
@rbaty-barr
rbaty-barr / 3dbtn.css
Created March 9, 2017 14:26
3d Button treatment for Bootstrap
.btn3d {
position:relative;
top: -6px;
border:0;
transition: all 40ms linear;
margin-top:10px;
margin-bottom:10px;
margin-left:2px;
margin-right:2px;
text-transform: uppercase;
@rbaty-barr
rbaty-barr / wantTo.cshtml
Last active February 27, 2017 14:38
I want to dropdown
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using RJP.MultiUrlPicker.Models;
@{
var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("wantToItems");
if (multiUrlPicker.Any())
{
<div class="row">
<div class="col-sm-4">
<p class="wantToHeader">I want to...</p>
</div>
@rbaty-barr
rbaty-barr / openGraphTags.cshtml
Created February 21, 2017 15:31
render some social sharing meta data to your page.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
string domain = "http://" + HttpContext.Current.Request.Url.Host;
var canonicalUrl= String.Empty;
var theDescr = Model.Content.HasValue("socialShareDescription") ? Model.Content.GetPropertyValue<string>("socialShareDescription") : Model.Content.GetPropertyValue<string>("metaDescription");
var theTitle = Model.Content.HasValue("socialShareTitle") ? Model.Content.GetPropertyValue<string>("socialShareTitle") : Model.Content.GetPropertyValue<string>("pageHeadging");
var twitterDesc = Model.Content.HasValue("twitterSocialShareDescription") ? Model.Content.GetPropertyValue<string>("twitterSocialShareDescription") : theDescr;
var ultimateDefault = Model.Content.HasValue("defaultSocialMediaShareImage", true) ? Model.Content.GetPropertyValue<string>("defaultSocialMediaShareImage", true) : "1155";
var pubImageDefault = Model.Content.HasValue("publicationDefaultSocialMediaImage", true) ? Model.Content.GetPropertyValue<string>("publicationDefaultSocialMed
@rbaty-barr
rbaty-barr / socialShareButtons.cshtml
Created February 21, 2017 15:30
Render social sharing buttons on a page.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var pageID = ViewData["id"] != null ? ViewData["id"] : "1048";
var thePage = Umbraco.TypedContent(@pageID);
var theUrl = thePage.UrlAbsolute().ToString();
var theTitle = thePage.HasValue("socialShareTitle") ? thePage.GetPropertyValue("socialShareTitle") : "Important information from Segal Marco Advisors";
var theSummary = thePage.HasValue("socialShareDescription") ? thePage.GetPropertyValue("socialShareDescription") : "Need Default Summary";
var tweet = thePage.HasValue("twitterSocialShareDescription") ? thePage.GetPropertyValue("twitterSocialShareDescription") : theTitle;
var emailBody = theTitle + ": " + theSummary + " -- " + HttpUtility.UrlEncode(theUrl.ToString());
var emailSubject = "Information for you from Segal Marco Advisers";
@rbaty-barr
rbaty-barr / homepage.cshtml
Created February 10, 2017 17:19
basic start point for HTML template
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.HomePage>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
Layout = null;
}
<!DOCTYPE html>
<html lang="en" itemscope itemtype="http://schema.org/Article">
<head>
<meta charset="utf-8">
@rbaty-barr
rbaty-barr / simpleSend.cshtml
Last active January 30, 2017 17:43
starting point for custom form sending
@using System.Net.Mail;
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
string comments = Request["comments"];
string pageID = Request["theID"];
if(Request.Headers["X-Requested-With"] == "XMLHttpRequest"){
var pageNode = Umbraco.TypedContent(pageID.ToString());
MailMessage message = new MailMessage();
string fromEmail = "";