Skip to content

Instantly share code, notes, and snippets.

@dunossauro
dunossauro / app.py
Created May 12, 2021 12:52
Flask 2.0 async support + SQLAlchemy 1.4 async ORM
from flask import Flask, request
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.future import select
from sqlalchemy.orm import declarative_base, sessionmaker
engine = create_async_engine('sqlite+aiosqlite:///./db.db')
async_session = sessionmaker(
engine, expire_on_commit=False, class_=AsyncSession
)
@ultraon
ultraon / build.gradle
Last active August 19, 2020 18:10
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@trobalik
trobalik / FlakyTests.java
Created June 2, 2016 21:49
Flaky Espresso Tests and the RetryTestRule
package com.yourapp.test;
// import statements...
public class FlakyTests {
@Rule
RetryTestRule retry = new RetryTestRule(3); // will attempt each test up to 3 times
@Test