Skip to content

Instantly share code, notes, and snippets.

View hexsprite's full-sized avatar

Jordan Brant Baker hexsprite

View GitHub Profile
@hexsprite
hexsprite / windows_and_office_kms_setup.adoc
Created February 3, 2024 20:58 — forked from jerodg/windows_and_office_kms_setup.adoc
Activate Windows and Office Using KMS Server

Microsoft Windows and Office KMS Setup

@hexsprite
hexsprite / Output.png
Created October 5, 2023 18:22 — forked from sughodke/Output.png
Read Mail.app Database
Output.png
@hexsprite
hexsprite / onLoginUser.js
Created May 22, 2020 18:29
Meteor JS: client-side version of Accounts.onLogin
// client-side version of Accounts.onLogin
export function onLoginUser(hook) {
Meteor.subscribe('allUserData', () =>
Tracker.autorun(function (computation) {
// waiting for user subscription to load
if (!_.get(Meteor.user(), 'services.google')) {
return
}
// cancel autorun now that we've authenticated
computation.stop()
@hexsprite
hexsprite / mongoUpdate.ts
Created February 17, 2020 15:34
MeteorJS: apply a mongo update to an object "in-memory"
/** Given an object, apply a Mongo update and return the resulting document */
function mongoUpdate(obj: Action, update: any): Action {
const collection = new Mongo.Collection<Action>(null)
const objId = collection.insert(obj)
collection.update(objId, update)
return collection.findOne(objId)!
}
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"/imports/*": "./*"
}
}
}
---
@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
}