Skip to content

Instantly share code, notes, and snippets.

@jamestalmage
jamestalmage / forward.md
Last active April 9, 2024 17:21
Using Firebase to Authenticate to Google Drive

Note: There is a lot of information here, but if I have provided a link, it is probably something you should click on and read. OAuth is a complex enough subject on it's own, and hacking these two services together only adds to it.

Even so, I have found Firebase's API to be simpler than almost any other OAuth solution I have explored. When all is said and done, the important bits of code related to authentication is actually less than 10 lines. If you have ever tried to implement your own OAuth flow before, you know how amazing that is.

In the end, it may be worth using Firebase for authentication, even if that's the ONLY thing you use it for.

@jamestalmage
jamestalmage / How_Require_Extensions_Work.md
Last active February 28, 2024 18:22
Breakdown of How Require Extensions Work

Why

Doing require extensions correctly is essential, because:

  1. Users should be able to install multiple extensions in succession, and have them work together.
  2. Coverage tools like nyc need it to reliably supply coverage information that takes into account sourcemaps from upstream transforms.
  3. Because non-standard, un-predictable behavior causes hard to solve bugs, and major headaches for project maintainers.

What is a require extension anyways?

Full Disclosure: I'm a member of the AVA team

Q: How much faster is AVA than Mocha (tap, tape, ...).

A: It depends.

First things first:

I should start by saying there are lots of reasons to choose AVA, and I don't think speed is (necessarily) the most import one. Other good reasons include:

babel.transform(`foo()`, {
plugins: [
function () {
return {
visitor: {
CallExpression() {
console.log('plugin 1');
}
}
@jamestalmage
jamestalmage / NPM INIT DEFAULTS.md
Last active November 25, 2018 13:55
Set up npm.init defaults

copied from iamsim

$ npm config set init.author.name "James Talmage"
$ npm config set init.author.email james@talmage.io
$ npm config set init.author.url http://iamsim.me/
$ npm config set init.license MIT
@jamestalmage
jamestalmage / output.md
Last active May 11, 2018 15:58
Test what features firebase-server supports

Got Value: { DC: 'District of Columbia', DE: 'Delaware', FL: 'Florida', FM: 'Federated States of Micronesia', GA: 'Georgia', GU: 'Guam', HI: 'Hawaii', ID: 'Idaho', IL: 'Illinois', IN: 'Indiana'

@jamestalmage
jamestalmage / AngularJS.xml
Last active August 1, 2017 10:39
Intellij Live Templates I have found usefull
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="AngularJS">
<template name="ngdcf" value="function compile(tElement, tAttrs, transclude) { &#10; $END$&#10; return function (scope, element, attrs) { &#10; }&#10;}" description="A compile function" toReformat="false" toShortenFQNames="true">
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
@jamestalmage
jamestalmage / AVA vs Mocha.md
Last active July 19, 2016 19:46
2016.01.26 - Current State of AVA performance

Full Disclaimer: I am a member of the AVA team

Between babel-plugin-espower#12 and ava#466 we are starting to see some pretty good performance compared to mocha:

I used emoji-aware for the benchmarks, it's a real life test suite with 4,300+ tests. It's a good candidate for benchmarking the efficiency of AVA's test Runner because:

  1. All the tests are synchronous. AVA is at an incredible advantage when it comes to async tests. If your tests need to interact with the disk or network, then AVA is almost guaranteed to be faster - simply because it allows concurrent execution of tests.
  2. 1 or 2 simple assertions per test. (The goal of this exercise was to measure test runner performance, not assertion libraries).
  3. Multiple test files. This allows AVA to flex it's process forking muscle.
  4. Lots of tests per file. Even with the multi-proces
@jamestalmage
jamestalmage / Normal Require.txt
Last active January 2, 2016 00:30
time-require of bluebird
// code
require('time-require')
require('bluebird')
// output
Start time: (2016-01-02 00:25:23 UTC) [treshold=1%]
# module time %
1 pretty-ms (node_modules/pretty-ms/index.js) 1ms ▇ 2%
2 ansi-styles (node_modu...tyles/ansi-styles.js) 1ms ▇ 2%
3 strip-ansi (node_modul.../strip-ansi/index.js) 1ms ▇ 2%
@jamestalmage
jamestalmage / output.txt
Created December 31, 2015 05:43
Tap Repro
TAP version 13
# Subtest: (unnamed test)
1..1
ok 1 - should be equal
ok 1 - (unnamed test) # time=10.216ms
1..1
# time=36.141ms