Skip to content

Instantly share code, notes, and snippets.

@hexsprite
hexsprite / node_2017-09-21-205122-1_jbbmbp-2.crash
Created September 22, 2017 04:28
Meteor 1.6b27 Crash Details
Process: node [48757]
Path: /Users/USER/*/node
Identifier: node
Version: ???
Code Type: X86-64 (Native)
Parent Process: node [48750]
Responsible: node [48757]
User ID: 501
Date/Time: 2017-09-21 20:51:22.136 -0700
@hexsprite
hexsprite / methodQueueWarning.js
Created September 20, 2017 00:41
Show browser confirmation when Meteor methods are pending in the queue
window.addEventListener('beforeunload', function (e) {
const hasOutstandingRequests =
Meteor.connection._outstandingMethodBlocks.length
if (hasOutstandingRequests) {
// Note: modern browsers don't show a custom message but still confirm
const confirmationMessage =
'WARNING: There are outstanding requests. Really close this window? If you do you may lose data!'
e.returnValue = confirmationMessage // Gecko, Trident, Chrome 34+
return confirmationMessage // Gecko, WebKit, Chrome <34
@hexsprite
hexsprite / .babelrc
Last active January 23, 2019 04:10
Using Istanbul wth Meteor
{
"env": {
"meteor:coverage": {
"plugins": ["istanbul"]
}
}
}
@hexsprite
hexsprite / Failure
Last active August 31, 2017 23:14
Meteor #9026 Mongo logs
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] MongoDB starting : pid=68530 port=9001 dbpath=/private/var/folders/sr/45xc_4j93svghrd2mcxsx0vr0000gn/T/meteor-test-run66k341.s0sym/.meteor/local/db 64-bit host=jbb-imac.local
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] db version v3.2.15
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] git version: e11e3c1b9c9ce3f7b4a79493e16f5e4504e01140
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] allocator: system
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] modules: none
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] build environment:
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] distarch: x86_64
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-08-31T21:42:21.245+0000 I CONTROL [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 9001 }, replication: { oplogSizeMB: 8, replSet: "meteor" }, storage: { dbPath: "/private/var/folders/sr/45xc_4j93svghrd2mcxsx0vr000
@hexsprite
hexsprite / serviceworker-errors.js
Created August 18, 2017 16:00
service worker error tracking example
/* eslint-env browser, serviceworker */
self.addEventListener('error', function (event) {
logError(event.error)
})
self.addEventListener('unhandledrejection', function (event) {
let { reason, detail } = event
if (!reason && detail) {
reason = detail.reason
}
@hexsprite
hexsprite / range.js
Created June 8, 2017 19:50 — forked from runfalk/range.js
Old interval implementation for JavaScript
function InvalidSetException(message) {
this.message = message
}
function DateRange(lower, upper) {
this.empty = false;
this.lower = lower;
this.upper = upper;
if (this.lower) {
this.lower = this.lower.clone();
@hexsprite
hexsprite / deploy_aws.sh
Created October 20, 2016 22:12 — forked from wearhere/deploy_aws.sh
CI script to convert a Meteor application into a Node.js application then deploy it to AWS Elastic Beanstalk.
#!/bin/bash
#
# This script will convert a Meteor application into a Node.js application
# then deploy it to AWS Elastic Beanstalk.
#
# Run like `deploy_aws.sh my_eb_app my_eb_app-production`.
#
# That will deploy the Meteor application containing this script
# to the `my_eb_app-production` environment of the `my_eb_app` EB application.
@hexsprite
hexsprite / gist:fcffe47f814f41402a41273d2e79029f
Created October 15, 2016 05:06
Profiling Meteor with v8-profiler from meteor shell
profiler = require('v8-profiler')
profiler.startProfiler()
profile = profiler.stopProfiler()
profile.export().pipe(fs.createWriteStream('profile.json')).on('finish', function() { profile.delete(); });
# Example Docker Cloud Stackfile
# app
app:
image: 'jshimko/todos:latest'
environment:
- 'MONGO_URL=mongodb://appUser:appUserPass@mongo1:27017,mongo2:27017/dbName?replicaSet=repSetName'
- 'MONGO_OPLOG_URL=mongodb://appUser:appUserPass@mongo1:27017,mongo2:27017/local?authSource=dbName'
- 'ROOT_URL=http://example.com'
links:
@hexsprite
hexsprite / gist:1c5de32266f8e77d0d1a
Created May 17, 2015 15:33
Meteor, Blaze - get template instance from DOM Element
Blaze.getView($("div.now-view")[0])._templateInstance.currentAction.get()