Skip to content

Instantly share code, notes, and snippets.

@rbaty-barr
rbaty-barr / ItemSkuIndex_ALL_bob103119.jsx
Created October 31, 2019 16:16
get all skus from indesign
pStyles = ['Table Cat. No./Price', 'Table Cat. No./Price+', 'CHEM cat no.', 'CHEM cat no.+', 'cat no for pg 176', 'cat no for pg 176+', 'MicroSlides CatNo./Price', 'MicroSlides CatNo./Price+', 'Slide Pricee', 'Slide Price+', 'ChemTopic_CatNo./Price', 'ChemTopic_CatNo./+']
myRegXp = /([A-Z]){1,2}([0-9]){3,4}/
my2RegXp = /([A-Z]){1}([0-9]){1}/
my3RegXp = /([A-Z]){2}/
my5RegXp = /(^[A-Z]+)([0-9]+)/
app.findPreferences = app.changePreferences = null
doc = app.activeDocument
u = undefined
if( doc.indexes.length == 0 )
@rbaty-barr
rbaty-barr / removeArticles.xml
Created October 14, 2019 15:52
regex for url rewrite
<rule name="removeArticles" stopProcessing="true">
<match url="(\/[^\/]*?)\/articles(\/.*)"/>
<action type="Rewrite" url="{R:1}{R:2}" appendQueryString="true" />
</rule>
@rbaty-barr
rbaty-barr / insightsBlock.cshtml
Created September 4, 2019 13:29
display custom list of insights, the most recent five OR filter by tag
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
@*
topInsights
filterByTag
*@
@if (Model.Items.Any())
{
var isFrontEnd = Lecoati.LeBlender.Extension.Helper.IsFrontEnd();
@rbaty-barr
rbaty-barr / feed.xml
Created December 6, 2018 16:58
podbeen rss
<?xml version="1.0" encoding="UTF-8"?><!-- generator="podbean/5.5" -->
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:spotify="http://www.spotify.com/ns/rss"
>
@rbaty-barr
rbaty-barr / getData.js
Created December 4, 2018 01:35
ajax construct reminder
$.ajax({
url: siteUrl,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
//do something
},
error: function (data) {
console.log(JSON.stringify(data));
}
@rbaty-barr
rbaty-barr / opengrap.cshtml
Created November 28, 2018 15:43
Adding Opengraph tags for umbraco sites...
@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) : "6759";
@rbaty-barr
rbaty-barr / clean-table.js
Created November 2, 2018 13:18
JavaScript to make compliant tables
$(document).ready(function () {
$("table").each(function(){
var thisTable = $(this);
thisTable.attr("border","").removeAttr("style").addClass("table table-striped");
$("tr").removeAttr("style");
// $("td").removeAttr("style");
var firstRow = thisTable.find('tr:first-child');
@rbaty-barr
rbaty-barr / hideshow.cshtml
Created October 15, 2018 16:43
leblender hide show region
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
@if (Model.Items.Any())
{
var isFrontEnd = Lecoati.LeBlender.Extension.Helper.IsFrontEnd();
foreach (var item in Model.Items)
{
var idNum = Guid.NewGuid();
if(isFrontEnd){
@rbaty-barr
rbaty-barr / ajaxCall.js
Created September 24, 2018 15:54
the jquery to call
$('#support').click(function () {
$(this).fadeOut();
$.ajax({
async: true,
type: "POST",
url: "/umbraco/surface/votenowsurface/castvote",
data: "1",
dataType: "html"
})
.done(function (data) {
@rbaty-barr
rbaty-barr / updateNode.cs
Created September 24, 2018 15:27
update an umbraco node with a class
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;