Skip to content

Instantly share code, notes, and snippets.

@alexaleluia12
alexaleluia12 / stubfs.js
Created June 2, 2019 13:05 — forked from devarajchidambaram/stubfs.js
How to stub fs.readFile functions
const fs = require('fs')
function readFile (filename) {
if (fs.existsSync(filename)) {
return fs.readFileSync(filename, 'utf8')
}
throw new Error('Cannot find file ' + filename)
}
describe('mocking individual fs sync methods', () => {
@alexaleluia12
alexaleluia12 / flask_logging_requests.py
Last active March 19, 2024 13:49
Flask Logging (every request)
#/usr/bin/python
# http://exploreflask.com/en/latest/views.html
# https://stackoverflow.com/questions/51691730/flask-middleware-for-specific-route
# https://dev.to/rhymes/logging-flask-requests-with-colors-and-structure--7g1
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
@alexaleluia12
alexaleluia12 / ifood-dev-week.ipynb
Created June 29, 2023 23:47 — forked from falvojr/ifood-dev-week.ipynb
ifood-dev-week.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.