Skip to content

Instantly share code, notes, and snippets.

@BARJ
BARJ / main.dart
Last active January 21, 2020 02:49
Dart Exceptions
/**
* DartPad Sharing Guide: https://github.com/dart-lang/dart-pad/wiki/Sharing-Guide
* Share: https://dartpad.dev/2989349c665a2ee2408bd9004d28a92a
*/
class CustomException implements Exception {
final String message;
CustomException(this.message);
@BARJ
BARJ / log_mixin.py
Created January 23, 2019 08:19
Mixin Context Logger
import logging
import os
import uuid
from logging.handlers import TimedRotatingFileHandler
from typing import Dict, List
from pythonjsonlogger import jsonlogger
# root logger
log = logging.getLogger()
@BARJ
BARJ / pre-commit.run-pytest.sh
Created April 16, 2018 03:56
pre-commit hook that runs pytest
#!/bin/sh
RED='\033[0;31m'
NC='\033[0m' # No Color
test_results=$(script -q /dev/null pipenv run python -m pytest ./test -v --tb=no)
if [ $? -eq 1 ]; then
printf "${RED}CANNOT COMMIT, PYTEST FAILED\n\nPYTEST RESULTS:\n"
echo "$test_results"
exit 1
fi