Skip to content

Instantly share code, notes, and snippets.

@hexsprite
hexsprite / gist:9193161
Created February 24, 2014 17:46
Python tracing decorator
def trace(fun):
def decorated(*args, **kwargs):
import traceback
print '-' * 20
print repr(fun), "\n"
print "args=", repr(args), "kwargs=", repr(kwargs)
traceback.print_stack()
print '-' * 20
return fun(*args, **kwargs)
return decorated
@hexsprite
hexsprite / ignore_warning.py
Created July 3, 2014 17:24
Python: ignore specific warning using context manager
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.filterwarnings('ignore', category=DeprecationWarning)
fxn()
@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()
# 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: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(); });
@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 / 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 / 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 / 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 / .babelrc
Last active January 23, 2019 04:10
Using Istanbul wth Meteor
{
"env": {
"meteor:coverage": {
"plugins": ["istanbul"]
}
}
}