Skip to content

Instantly share code, notes, and snippets.

@thiagosouza
thiagosouza / 0 setup test.sh
Last active May 7, 2022 05:14
[Unit tests in Typescript] #typescript #tests #tdd #jest #mocha #chai #jasmine
//https://medium.com/@RupaniChirag/writing-unit-tests-in-typescript-d4719b8a0a40
npm i -D chai mocha nyc ts-node typescript
npm i -D @types/chai @types/mocha
#Test Script
"scripts": {
"test": "mocha -r ts-node/register tests/**/*.test.ts",
"coverage": "nyc -r lcov -e .ts -x \"*.test.ts\" npm run test"
}
@codediodeio
codediodeio / index.js
Created July 10, 2017 16:03
Simple Stripe Payments with Firebase Cloud Functions
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp(functions.config().firebase);
const stripe = require('stripe')(functions.config().stripe.testkey)
exports.stripeCharge = functions.database
@alkrauss48
alkrauss48 / Dockerfile
Last active November 10, 2022 16:24
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@abhijeetchopra
abhijeetchopra / 0-README.md
Last active April 24, 2024 20:40
Creating automatic scheduled backup copies of your Google Sheets using Google Apps Script

How to "Schedule Automatic Backups" of your Google Sheets

This tutorial demonstrates how to use Google Apps Script to:

  • Create copies of the Google Sheet in the desired destination folder automatically at set intervals.

  • Append the time stamp with each backup file's name.

  • Adjust time trigger for backing up every day/hour/minute.

@swaroopch
swaroopch / flask-boilerplate-tmux.bash
Created December 5, 2010 07:00
A command that scripts a tmux session
#!/bin/bash
function flask-boilerplate-tmux
{
# https://github.com/swaroopch/flask-boilerplate
BASE="$HOME/code/flask-boilerplate"
cd $BASE
tmux start-server
tmux new-session -d -s flaskboilerplate -n model