Skip to content

Instantly share code, notes, and snippets.

View bradvogel's full-sized avatar

Brad Vogel bradvogel

View GitHub Profile
/**
* This script will automatically sync all updates from one database to another. It is meant to be run while
* syncing the database using mongodump and mongorestore.
*
* Example:
* node livesync.js mongodb://<user>:<pass>@dbhost.com:10645/app-production \
* mongodb://<user>:<pass>@dbhost.com:10499/local?authSource=app-production \
* app-production \
* mongodb://<user>:<pass>@newdbhost.com/app-prod
*/
@bradvogel
bradvogel / bookmark.js
Created March 19, 2020 13:56
Browser bookmark to open a jira in a new tab
javascript:let dest=prompt("Issue ID?");if (dest) window.open("https://[subdomain].atlassian.net/browse/" + dest, '_blank');
// or
javascript:const tab = window.open('about:blank', '_blank');tab.document.write("<script>window.location.href=`https://[subdomain].atlassian.net/browse/${window.prompt('number')}`</script>");tab.document.close();
/**
*
*/
$(window).on('message', function(e) {
var data = e.originalEvent.data;
if (data.method !== 'createIFrame') return;
var proxyUrl = chrome.runtime.getURL('/src/iframeProxy/proxy.html');
<script>
new MixmaxSDK($('.emailer'), {
message: 'Come work on an exciting platform!'
}).render();
</script>
@bradvogel
bradvogel / gist:c2e1e6e26522216f6bdb
Created February 24, 2015 18:37
Uploading to a CDN with Demeteorizer
npm install -g modulus
# Redirect to CDN.
echo "WebAppInternals.setBundledJsCssPrefix('https://d14ym0a63kner.cloudfront.net/${GITSHA}');" > server/cdn.js
# This script is a hack to upload static assets generated by the "modulus deploy" command to our
# CDN, Amazon Cloudfront. This script should be run in the background prior to "modulus deploy"
# being called. It watches for a file named ./demeteorized/programs/web.browser/program.json to be
# created, then it uses gulp to upload assets to S3.
(
// Disconnect Meteor when the tab is in the background.
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
Meteor.disconnect();
} else {
Meteor.reconnect();
}
});
# Add git shell autocompletion
GIT_PS1_SHOWDIRTYSTATE=1
source ~/.git-completion.bash
export PS1='\[\e[1G\e[0;36m\]\u: \W$(__git_ps1 " (%s)")\[\e[m\] '
<img style="max-width:100%; box-sizing:border-box;" src="https://media2.giphy.com/media/iLM4h2qLVS7qo/giphy.gif" width="300"/>
{
"name": "Giphy",
"author": "Mixmax Inc",
"url": "https://mixmax.com",
"appTray": {
"name": "Giphy",
"icon": "public/img/logo_giphy.png",
"editor": "http://yourdomain.com/editor",
"resolver": "http://yourdomain.com/resolver"
}
window.opener.postMessage({
method: 'done',
payload: {
/* Arbitrary serializable configuration data */
}
}, 'https://app.mixmax.com');