Skip to content

Instantly share code, notes, and snippets.

@jikanter
jikanter / ldap.py
Created October 16, 2023 00:09
[ldap items]
import fileinput
for line in fileinput.input():
# only print description and displayName lines that do not contain '$'
if (((line.find('description') != -1) or (line.find('displayName') != -1)) and (line.find('$') == -1)):
if line.find('displayName') != -1:
print(line, '\n')
else:
print(line)
@jikanter
jikanter / trackanalytics.js
Created May 14, 2023 18:10
[Demo _trackAnalytics] Simple TrackAnalytics implementation for Tealium
function _trackAnalytics() { }
// tealium code comes down
// the below typically happens when the devs do not implement it
window._trackAnalytics = function(o) {
if (o.type === "link") {
utag.link(o);
}
@jikanter
jikanter / commands.sh
Last active May 14, 2023 17:39
[Maven Commands] Maven commands and snippets
#!/bin/bash
# see https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html
# install a jar locally
mvn install:install-file \
-Dfile=oak-run-1.10.3.jar \
-DgroupId=com.perficient.tools \
-DartifactId=oak-run \
-Dversion=1.10.3 \
-Dpackaging=jar
# deploy a jar
@jikanter
jikanter / dashcode.js
Last active March 14, 2023 04:20
[Dashcode Element Framework]
var dashcodePartSupport = {
"imageBgParts": {
"detailHeader": ["Parts/Images/detailHeader.png", 1, 1]
}
};
if (!window.dashcode) {
dashcode = new Object()
}
dashcode.setupParts = function() {
@jikanter
jikanter / xml2sexp.py
Last active December 11, 2024 15:34
[Customized S-Expression Generator] Generates S-Expressions #Python
#!/usr/bin/env python
import os, sys
import subprocess, shlex
# A mechanism for transforming xml to s-expressions
# in python
# shells out to xsltproc
DEBUG = 0
@jikanter
jikanter / sample-dL.js
Created November 18, 2022 20:38
[Data Layer Example] #datalayer
var digitalData = {
"page": {
"partner": "victoriasecret",
"responsiveDisplayType": "tablet",
"lob": "consumer",
@jikanter
jikanter / teknkl-simpledto-1.0.4.js
Last active November 18, 2022 20:35
[Simple Data Transfer Object] #data #marketo
/*
@author Sanford Whiteman, TEKNKL (blog.teknkl.com / sandy@teknkl.com)
@version v1.0.4
@copyright Copyright 2016, 2017, 2018, 2019 FigureOne, Inc.
@license MIT License: You must include this license and the above credits in all uses & reproductions of this software.
*/
function SimpleDTO(a) {
var e = Function.prototype.call.bind(Array.prototype.slice);
try {
a.debug && console.log("SimpleDTO: Unifying domains " + [document.domain, a.domain].join(", ")), document.domain = a.domain;
@jikanter
jikanter / vanilla-js-hash.js
Last active December 26, 2024 20:26
Crypto Vanilla JS Hash #utilities #crypto
(function () {
'use strict';
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var jschacha20 = createCommonjsModule(function (module) {
/*
* Copyright (c) 2017, Bubelich Mykola
@jikanter
jikanter / proxy-object.js
Last active November 18, 2022 20:40
[Javascript Proxy Object] GTM Data Push LIstener #datalayer #proxy
/*JavaScript has a Proxy object with which you can set traps whenever an operation is executed on an object. Arrays are also objects and can be used with proxies.
When calling the push method on an array, a new value will be set to the array. So setting a trap for the set method should allow us to add behavior to the push method.
In the trap, create a CustomEvent event and dispatch it. You can name this event anything you want. Whenever a value has been added to the dataLayer array, an event will be emitted. You can listen from every file to this event to act on whenever a value is added to the dataLayer array.
With Reflect we can make sure that the original behavior of the push method is restored while keeping the added behavior.*/
/* We had to use this in a case where the GTM dataLayer.push call did not have a first argument of the 'event' */
@jikanter
jikanter / TPC_TrackAnalytics.html
Created September 13, 2022 15:43
_trackAnalytics #trackanalytics #javascript #demos
<script>
window._trackAnalytics = function(o){
try{
if( typeof o === "object" ){
var siteEvents = o.site_events,
gtmDataLayer = "gaDataLayer",
generateBaseGtmObject = function(){
var obj = {};
for( var i = 1; i <= 100; i++ ){
obj["cd"+i] = obj["cm"+i] = null;