Skip to content

Instantly share code, notes, and snippets.

@jnormore
jnormore / bootstrap-alert-modal.js
Last active December 27, 2015 18:58
Bootstrap 2.3 alert and confirm modals. Overrides window.alert normally, but window.confirm override requires a callback function to be passed to get result. Optional arguments for modal title and confirm button label.
window.alert = function(message, title) {
if($("#bootstrap-alert-box-modal").length == 0) {
$("body").append('<div id="bootstrap-alert-box-modal" class="modal hide fade">\
<div class="modal-header" style="min-height:20px;">\
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
<h3></h3>\
</div>\
<div class="modal-body"><p></p></div>\
<div class="modal-footer">\
<a href="#" data-dismiss="modal" class="btn">Close</a>\
@jnormore
jnormore / bootstrap3-alert-box.js
Last active November 10, 2019 13:07
Bootstrap 3 alert and confirm modals. Overrides window.alert normally, but window.confirm override requires a callback function to be passed to get result. Optional arguments for modal title and confirm button label.
window.alert = function(message, title) {
if($("#bootstrap-alert-box-modal").length == 0) {
$("body").append('<div id="bootstrap-alert-box-modal" class="modal fade">\
<div class="modal-dialog">\
<div class="modal-content">\
<div class="modal-header" style="min-height:40px;">\
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
<h4 class="modal-title"></h4>\
</div>\
<div class="modal-body"><p></p></div>\
let repl = require('repl');
let models = require('./db/models');
Object.keys(models).forEach((modelName) => {
global[modelName] = models[modelName];
});
let replServer = repl.start({
prompt: 'app > ',
});
@jnormore
jnormore / gist:abe729f77b9f7f16c1e5170c970d1084
Created June 16, 2026 22:10
shopify app session exchange for contact capture
/* client side */
if (typeof shopify !== "undefined") {
//get the current session token from shopify
const sessionToken = await shopify.idToken();
// send the session token to your server to exchange it for an online token with the user info
const response = await fetch(GET_USER_INFO_FROM_SESSION_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
// TODO: add your server api auth headers here