Skip to content

Instantly share code, notes, and snippets.

View jtsternberg's full-sized avatar
😎
Awesome Motive-ing

Justin Sternberg jtsternberg

😎
Awesome Motive-ing
View GitHub Profile
@jazzsequence
jazzsequence / download-sternberg-gifs.md
Last active January 24, 2024 16:59
Download JT$ gif collection

Download Sternberg Gifs

When I worked at WebDevStudios, we spoke in gifs. I guess, these days, that makes me old. Whatever. I miss them. It represented a shared language even when the source of the gif was unknown. (I remember distinctly how it felt when I found the Key and Peele sketch from which this gem was taken:)

noice

(It kinda felt like that ☝️)

Justin Sternberg even wrote an Alfred workflow called WDS Giffy which predated (in practice, if not in actuality) the gif-sharing service Giphy that pointed to his personal collection of gifs. I can't say for certain, but I think most of us used that, at least while I was there.

@jtsternberg
jtsternberg / om-validate-first-last-name.js
Created January 7, 2021 16:30
OptinMonster, validation to require first/last name
<script>
document.addEventListener('om.Campaign.afterShow', function(event) {
var campaign = event.detail.Campaign;
if ( '{{id}}' !== campaign.id ) {
return;
}
var validationError = 'A last name is required.';
var $nameField = document.getElementById( '{{ns}}-field-name' );
@jtsternberg
jtsternberg / wpforms-to-optin-monster.php
Last active December 5, 2019 20:10
Automatically trigger an OptinMonster form to show, filled out, when an WP Form is submitted.
<?php
/*
* Plugin Name: WP Forms to OptinMonster
* Plugin URI: http://optinmonster.com
* Description: Automatically trigger an OptinMonster form to show, filled out, when an WP Form is submitted.
* Version: 0.1.0
* Author: Justin Sternberg
* Author URI: http://optinmonster.com
*/
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@jtsternberg
jtsternberg / load-api-js-async.js
Last active March 24, 2020 17:53
load OM api.js asynchronously
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'https://a.omappapi.com/app/js/api.min.js';
s.setAttribute('data-user', USERID);
s.setAttribute('data-account', ACCOUNTID);
(document.getElementsByTagName('body')[0] || document.documentElement).appendChild(s);
})();
@jtsternberg
jtsternberg / hide-campaign-on-load-replace-with-button.html
Last active September 6, 2018 13:37
OM campaign JS which hides the campaign initially and waits for a button to be clicked
<style id="removeMe">
body:not(.app) #om-vxgsvpbsp3jq2n3y5z5r {
display: none !important;
}
</style>
<script>
// CSS class for the bottom slide in button
var buttonClass = 'popup-slide-in';
// Button text of the bottom slide in button
@jtsternberg
jtsternberg / om-track-impressions-conversions.js
Created May 7, 2018 18:23
optinmonster track impressions/conversions when Google Analytics are disabled
jQuery( function( $ ) {
$( document )
.on( 'OptinMonsterOnShow', function( event, props, app ) {
// Track Impression
}).on( 'OptinMonsterOptinSuccess', function( event, props, app ) {
// Track Conversion
});
});
@jtsternberg
jtsternberg / optin-monster-alternate-adobe-analytics.js
Last active July 23, 2018 21:09
Track OptinMonster impressions/conversions to Adobe Analytics
jQuery( function( $ ) {
var campaignEventMap = {
'nklsasuw43ypqumlh7mn' : { // Campaign #1
'OptinMonsterOnShow' : 'event6', // Event ID from created event in Adobe for impressions.
'OptinMonsterOptinSuccess' : 'event7' // Event ID from created event in Adobe for conversions.
},
'l4eprc5lai8yn7f3vguq' : { // Campaign #2
'OptinMonsterOnShow' : 'event8', // Event ID from created event in Adobe for impressions.
'OptinMonsterOptinSuccess' : 'event9' // Event ID from created event in Adobe for conversions.
}
@jtsternberg
jtsternberg / grunt-bell-say.js
Created February 7, 2018 01:55
replace grunt-bell with a "say" command
/*
* grunt-bell
* https://github.com/dragonworx/grunt-bell
*
* Copyright (c) 2013 Ali Chamas
* Licensed under the MIT license.
*/
var start = process.hrtime();
@jtsternberg
jtsternberg / gc-pull-filters.php
Last active January 24, 2018 16:25
Working with the GatherContent pull filters
<?php
/**
* Modify post data when GatherContent does a pull.
*
* @param array $post_data Array of post data to be updated/modified.
* @param GatherContent\Importer\Sync\Pull $pull_object The GC Pull object.
* @param boolean $update Whether this is a post update (vs new). Default: false.
*
* @return array Array of post data to be updated/modified.