Skip to content

Instantly share code, notes, and snippets.

@zwily
zwily / expo-firestore-persistence-hack.js
Last active October 24, 2024 05:29
A fragile weaving of various modules together to convince the Firestore web SDK to use persistence in an un-ejected Expo app.
/*
expo-firestore-persistence-hack
A fragile weaving of various modules together to convince the Firestore
web SDK to use persistence in an un-ejected Expo app.
To use, first:
```
$ expo install expo-sqlite
@zwily
zwily / useFirebaseUpdater.js
Created March 10, 2019 20:56
Firebase throttled updater hook
import { useState, useRef } from "react";
import { useDocument } from "react-firebase-hooks/firestore";
import throttle from "lodash/throttle";
// Hook that gives you an updater function that will do throttled
// updates to a firebase document, and provide back to you views of
// the updated data (before it has persisted).
//
// arguments: a Document ref, and time in ms to throttle
// returns an object with following fields:
var setupLTIScrollRequest = function() {
window.addEventListener('message', function(e) {
try {
var message = JSON.parse(e.data);
if (message.subject === 'lti.scrollTop') {
$('html,body').animate({
scrollTop: $('.tool_content_wrapper').offset().top + message.scrollTop
}, message.animate);
}
} catch(err) {
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: download.sh file ..."
exit 1
fi
for fn in "$@"
do
if [ -r "$fn" ] ; then
printf '\033]1337;File=name='`echo -n "$fn" | base64`";"
wc -c "$fn" | awk '{printf "size=%d",$1}'
This is a table | testing
---------------- | --------
Oh hi there | blah
This is a table testing
Oh hi there blah
whoizach-laptop-2:~ zach $ whois noticeablyunprofessional.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: NOTICEABLYUNPROFESSIONAL.COM
Registrar: GODADDY.COM, LLC

Keybase proof

I hereby claim:

  • I am zwily on github.
  • I am zwily (https://keybase.io/zwily) on keybase.
  • I have a public key whose fingerprint is 4BEE 0C59 A509 E13B 5F1F 253B D41E B637 61AA 492F

To claim this, I am signing this object:

@zwily
zwily / sshsa.rb
Last active September 19, 2016 16:34
#!/usr/bin/env ruby
# sshsa (SSH Switch Agent)
#
# sshsa manages multiple ssh-agents with different sets of keys. It
# lets you switch between them with one command. It was written on OS X
# with Keychain stuff in mind, so probably won't work unmodified on
# Linux.
#
# To use:
@zwily
zwily / sortable_table.js
Last active August 29, 2015 14:03
simple sortable table react component
/** @jsx React.DOM */
var React = require('react'),
types = React.PropTypes,
_ = require('underscore');
module.exports = React.createClass({
propTypes: {
columns: types.arrayOf(
types.shape({