Skip to content

Instantly share code, notes, and snippets.

@mattlevine
mattlevine / create_certificate.cfm
Last active May 16, 2023 20:09
Create certificate and use it to sign an xml document
<cfscript>
/*
Required Jars need to be downloaded from https://www.bouncycastle.org/
bcpkix-jdk18on-173.jar
bcprov-ext-jdk18on-173.jar
bcutil-jdk18on-173.jar
*/
KeyFactory = createObject("java", "java.security.KeyFactory");
PKCS8EncodedKeySpec = createObject("java", "java.security.spec.PKCS8EncodedKeySpec");
version: '3.8'
services:
#Mura Server
mura:
image: murasoftware/mura-dxp:latest
environment:
LUCEE_JAVA_OPTS: "-Xms1024m -Xmx2048m"
MURA_ADMIN_USERNAME: admin
MURA_ADMIN_PASSWORD: admin
@mattlevine
mattlevine / Dockerfile.mura
Last active July 1, 2020 16:37
Example Mura configurations
FROM murasoftware/mura:latest
MAINTAINER Matt Levine, matt.levine@getmura.com
ARG admin_hspw=
ARG web_hspw=
RUN sed -i "s/hspw=\"\"/hspw=\"$admin_hspw\"/" /opt/lucee/server/lucee-server/context/lucee-server.xml \
&& sed -i "s/hspw=\"\"/hspw=\"$web_hspw\"/" /opt/lucee/web/lucee-web.xml.cfm
# Logs
@mattlevine
mattlevine / index.html
Last active October 9, 2020 10:10
Headless Comment
<!--
This would run on a page that has an inited Mura.js instance. You would need to do this in a normal layout manager.
//Init Mura so you can make an initial api call to get the current page
Mura.init({
siteid:'default',
rootpath: 'http://localhost:8888',
processMarkup:false
}};
@mattlevine
mattlevine / OAuth2.md
Last active January 27, 2020 19:08
OAuth2 cheat sheet
@mattlevine
mattlevine / config.xml.cfm
Created April 10, 2019 15:59
An example of how to conditionally load a config.xml.cfm
<cfscript>
// this is to avoid loading the config if it is already up to date in the DB
loadXML = checkLoad(siteBean, rsSites);
function checkLoad(siteBean, rsSites) {
var loadXML = false;
var siteid = siteBean.getSiteID();
// read the JSON file, which contains the modification date of the last loaded config for each site
var themeDir = expandPath(siteBean.getThemeAssetPath());
@mattlevine
mattlevine / simple widget manager
Last active January 23, 2019 17:44
Super Simple example of use Mura.js to manage an entity with VueJS. It assumes you created an entity named widget in your admin assembler with two atributes named `name` and `description`.
<script>
app=()=>{
var app = new Vue({
template: '#app-template',
el: '#app',
data: function(){
return{
entityName:'widget',
collection:false,
entity:false,
<script>
window.queuedMuraCmds=[],window.queuedMuraPreInitCmds=[],window.mura=window.m=window.Mura=function(u){window.queuedMuraCmds.push(u)},window.Mura.preInit=function(u){window.queuedMuraPreInitCmds.push(u)};
</script>
@mattlevine
mattlevine / index.cfm
Created June 7, 2018 22:45
Example of a custom Mura category summary display object that shows the parent name
<cfparam name="objectparams" default="#structNew()#">
<cfparam name="objectparams.displayRSS" default="false">
<cfparam name="useRss" default="#objectparams.displayRSS#">
<cfif not isValid('uuid',arguments.objectid)>
<cfset crumbIterator=$.content().getCrumbIterator()>
<cfloop condition="crumbIterator.hasNext()">
<cfset crumb=crumbIterator.next()>
<cfif listFindNoCase('Folder',crumb.getType())>
<cfset arguments.objectid=crumb.getContentID()>