Skip to content

Instantly share code, notes, and snippets.

View banjerluke's full-sized avatar

Luke banjerluke

View GitHub Profile
@banjerluke
banjerluke / GroundedCollection.ts
Created December 1, 2021 14:41
GroundedCollection (rewrite of ground:db for Meteor 2.4+)
import Dexie from 'dexie';
import { EJSON } from 'meteor/ejson';
import type { Mongo } from 'meteor/mongo';
import type { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { throttle } from 'underscore';
import { PendingCounter } from './PendingCounter';
interface LocalCollectionInternal {
queries: Record<any, any>;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@banjerluke
banjerluke / Dockerfile
Created April 11, 2019 13:47
Meteor-building and Sentry-uploading Dockerfile
# --- Stage 1: build Meteor app and install its NPM dependencies ---
# Make sure both this and the FROM line further down match the
# version of Node expected by your version of Meteor -- see https://docs.meteor.com/changelog.html
FROM node:8.15.1 as builder
# METEOR_VERSION should match the version in your .meteor/release
# APP_SRC_FOLDER is path the your app code relative to this Dockerfile
# BUILD_SRC_FOLDER = /opt/src is where app code is copied into the container
# BUILD_OUTPUT_FOLDER = /opt/app is where app code is built within the container
@banjerluke
banjerluke / main.js
Last active February 2, 2019 22:52
How to unlock Web Audio API audio on iOS devices with the ringer is off
import silenceDataURI from './silence-datauri';
// load a data url of short silence so that we can unlock web audio even when ringer is off
var audioTag = document.createElement("audio");
audioTag.controls = false;
audioTag.preload = "auto";
audioTag.loop = false; // looping this seems to cause clicking on older iOS devices
audioTag.src = silenceDataURI;
document.addEventListener("visibilitychange", function() {
if( document.visibilityState == 'visible' ) audioTag.play();

Keybase proof

I hereby claim:

  • I am banjerluke on github.
  • I am lukeabbott (https://keybase.io/lukeabbott) on keybase.
  • I have a public key ASABK1hUz2EzikiqHBGyzJvblk---2OPckwv0fFPQ8AzcQo

To claim this, I am signing this object:

@banjerluke
banjerluke / hit-testing-with-hammer.html
Created February 23, 2014 04:40
Paper.js hit-testing example (from http://paperjs.org/examples/hit-testing/) hacked to work with touch events from Hammer.js, Feel the possibility...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<xlink rel="stylesheet" href="http://paperjs.org/assets/css/style.css"/>
<script src="http://paperjs.org/assets/js/jquery.js"></script>
<script src="http://paperjs.org/assets/js/paper.js"></script>
<script src="/hammer.js"></script>
<title>Paper.js - Paper.js</title>
@banjerluke
banjerluke / gist:1975056
Created March 4, 2012 22:12
Installing ruby-debug with ruby-1.9.3 (any p-number)
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1975056)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-`ruby --version | grep -o 'p[0-9]*'` ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem