Skip to content

Instantly share code, notes, and snippets.

View bradvogel's full-sized avatar

Brad Vogel bradvogel

View GitHub Profile
# 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\] '
// Disconnect Meteor when the tab is in the background.
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
Meteor.disconnect();
} else {
Meteor.reconnect();
}
});
@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.
(
<script>
new MixmaxSDK($('.emailer'), {
message: 'Come work on an exciting platform!'
}).render();
</script>
{
"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');
curl -H "Content-Type: application/json" -X POST -d '{"src":"https://media2.giphy.com/media/iLM4h2qLVS7qo/giphy.gif","width":"300"}' http://localhost:3000/resolve
<img style="max-width:100%; box-sizing:border-box;" src="https://media2.giphy.com/media/iLM4h2qLVS7qo/giphy.gif" width="300"/>
var timing = window.performance.timing;
keen.addEvent('page load time to first byte', {
ttfb: timing.responseStart - timing.connectEnd
});
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.2/handlebars.runtime.min.js"></script>
<!-- Our application Javascript -->
<script src="https://d14s452uta6ylv.cloudfront.net/63f05514e61391320f7915439f20f128a86c2ac5/build.js"></script>