Skip to content

Instantly share code, notes, and snippets.

View bradvogel's full-sized avatar

Brad Vogel bradvogel

View GitHub Profile
@bradvogel
bradvogel / deploy_production.sh
Last active April 8, 2018 01:54
CodeShip, Modulus, and Meteor 0.9 deploy script
# This script is used to deploy a Meteor 0.9 project to Modulus.io hosting using CodeShip.
# Install Meteor.
curl https://install.meteor.com > ./install_meteor
sed -i'' -e 's/PREFIX=.*/PREFIX="$HOME"/g' ./install_meteor
chmod u+x ./install_meteor
./install_meteor
# Install Modulus.
npm install -g modulus
@bradvogel
bradvogel / client_errorlogging.js
Created September 19, 2014 17:46
Meteor JS and Sentry / Raven logging integration
// Setting up Raven and Meteor on the CLIENT side.
var clientDSN = 'https://<key>@app.getsentry.com/30405';
Raven.config(clientDSN, {}).install();
// Set the user automatically.
Meteor.autorun(function() {
var user = Meteor.user();
if (!user) Raven.setUser( /* Unset */ );
else {
drawMultiTimingChart('draft-timings', 'last_14_days', 'daily', [
['deleting a gmail draft', 'duration', 'Deleting a draft'],
['updating a gmail draft', 'duration', 'Updating a draft'],
['creating a gmail draft', 'duration', 'Creating a draft'],
]);
// Draw multiple lines in the same chart.
// See https://github.com/keen/keen-js/blob/master/docs/recipes.md#combine-two-line-charts
@bradvogel
bradvogel / gist:cff0935f91734d119273
Created January 8, 2015 19:26
Segment events bridge
/**
* Provides a fake analytics object that sends all calls to the analytics bridge. Why do we use
* an analytics bridge? Well, we can't load Segment's analytics snippet in this extension source or
* in the chrome extension content script because it will conflict with the Gmail DOM. By loading a standalone file (hosted
* by the app), we can sandbox Segment and its dependencies away from Gmail, while providing a
* postMessage bridge to be able to call its methods.
*/
var analytics = (function() {
var loaded = false;
var eventQueue = [];
Accounts.onLogin(function(e) {
// Do this async so we don't block login.
Meteor.setTimeout(function() {
var userId = e.user._id;
maybeSyncGoogleContacts(userId);
}, 100);
});
@bradvogel
bradvogel / file 2
Created January 11, 2015 04:58
test files
Accounts.onLogin(function(e) {
// Do this async so we don't block login.
Meteor.setTimeout(function() {
var userId = e.user._id;
maybeSyncGoogleContacts(userId);
}, 100);
});
function $initHighlight(block, flags) {
try {
if (block.className.search(/\bno\-highlight\b/) != -1)
return processBlock(block.function, true, 0x0F) + ' class=""';
} catch (e) {
/* handle exception */
var e4x =
<div>Example
<p>1234</p></div>;
}
@bradvogel
bradvogel / fibonacci.js
Last active April 8, 2018 02:53
Fibonacci
function fib(n) {
return function(n, a, b) {
return n > 0 ? arguments.callee(n - 1, b, a + b) : a;
}(n, 0, 1);
}
@bradvogel
bradvogel / index.html
Created January 12, 2015 01:28
JQuery example
<!doctype html>
<html>
<head>
<script src="script.js"></script>
</head>
<body>
<button id="hello">Hello</button>
</body>
</html>