Skip to content

Instantly share code, notes, and snippets.

ericmacfa

Block or report user

Report or block ericmacfa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericmacfa
ericmacfa / index.js
Last active Jul 5, 2019
Fastify 1733 -- Lifecycle is not interrupted when onSend executes asynchronously
View index.js
'use strict';
const fastify = require('fastify')();
const promiseTimeout = ms =>
new Promise(resolve => {
setTimeout(resolve, ms);
});
// This issue occurs with both callback and promise based `onSend` hooks
@ericmacfa
ericmacfa / index.js
Last active Jul 3, 2019
fastify-session -- Request handler called even when response.redirect() is called in preHandler
View index.js
const fastify = require('fastify')();
const fastifyCookie = require('fastify-cookie');
const fastifySession = require('fastify-session');
const MemoryStore = require('memorystore')(fastifySession);
const ms = require('ms');
// region Plugins =============================================================
fastify.register(fastifyCookie);
fastify.register(fastifySession, {
cookieName: 'id',
@ericmacfa
ericmacfa / DemoTestGoogle.js
Created Jul 23, 2016
StackOverflowGist_nightwatchjs-how-to-check-if-element-exists-without-creating-an-error-failure-exception
View DemoTestGoogle.js
// Example adapted from the examples at http://nightwatchjs.org/guide#writing-tests
module.exports = {
'Navigate to google': function (browser) {
browser.windowMaximize();
browser.url('http://www.google.com');
browser.waitForElementVisible('body', 1000);
},
'Try a junk selector that doesnt exist, using .elements': function (browser) {
// Note that the status is 0
You can’t perform that action at this time.