Skip to content

Instantly share code, notes, and snippets.

Mitchell Porter mitchellporter

Block or report user

Report or block mitchellporter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mitchellporter /
Created Feb 20, 2019 — forked from pbojinov/
Two way iframe communication- Check out working example here:

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.


Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')


mitchellporter / selectors.js
Created Nov 20, 2018 — forked from carolineschnapp/selectors.js
Shopify jQuery selectors.
View selectors.js
To test things out, in your JavaScript console, use selector followed by
.css('outline','1px solid red');
to see what you get.
A sandbox to test all this:
Product Page and Quick View
mitchellporter / ad_account_campaigns_edge.js
Created Oct 17, 2018
Fetching ad account campaigns with Facebook Business Node.js SDK
View ad_account_campaigns_edge.js
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
* @flow
const adsSdk = require('facebook-nodejs-ads-sdk');
mitchellporter / facebook-wca-standard-events.html
Created Oct 16, 2018 — forked from danielmcclure/facebook-wca-standard-events.html
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
View facebook-wca-standard-events.html
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
View async-for-each.js
async function test(){
let arr = [1,2,3];
await* (num) => {
let result = await getData(num);
console.log('after foreach');

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$" "$extension_id%26uc" 
unzip -d "$extension_id-source" "$"

Thx to crxviewer for the magic download URL.

mitchellporter / json_postgres.js
Created Sep 4, 2018 — forked from lucdew/json_postgres.js
Example of json document storage in postgresql and querying (with knex.js)
View json_postgres.js
var connectionString = 'postgres://localhost:5432/postgres';
var Promise=require('bluebird');
var knex = require('knex')({
client: 'pg',
connection: {
user: 'postgres',
database: 'postgres',
port: 5432,
mitchellporter /
Created Aug 18, 2018 — forked from NigelEarle/
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

mitchellporter / flash-app.js
Created Aug 10, 2018 — forked from brianmacarthur/flash-app.js
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
View flash-app.js
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
You can’t perform that action at this time.