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
mitchellporter / iterm2-solarized.md
Created Jul 22, 2019 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@mitchellporter
mitchellporter / README.md
Created May 30, 2019 — forked from acrookston/README.md
Xcode pre-action to build custom Info.plist
View README.md

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@mitchellporter
mitchellporter / README.md
Created Feb 20, 2019 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/
View README.md

Two way iframe communication

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

Parent

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

iframe

@mitchellporter
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:
https://shopify-selectors.myshopify.com/admin/themes
*/
/*====================================
Product Page and Quick View
@mitchellporter
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
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 -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
View async-for-each.js
async function test(){
let arr = [1,2,3];
await* arr.map(async (num) => {
let result = await getData(num);
console.log(result);
});
console.log('after foreach');
}
View how-to-view-source-of-chrome-extension.md

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

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@mitchellporter
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,
You can’t perform that action at this time.