Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#define da_append(xs, x) \
do { \
if ((xs)->count >= (xs)->capacity) { \
if ((xs)->capacity == 0) (xs)->capacity = 256; \
else (xs)->capacity *= 2; \
(xs)->items = realloc((xs)->items, (xs)->capacity*sizeof(*(xs)->items)); \
} \
@irazasyed
irazasyed / outbound-email-with-cloudflare.md
Last active July 23, 2024 05:06
Using Gmail SMTP with Cloudflare Email Routing: A Step-by-Step Guide

Using Gmail SMTP with Cloudflare Email Routing: Step-by-Step Guide

Learn how to send emails through Gmail SMTP with Cloudflare Email Routing in this comprehensive guide.

Step 1: Enable 2-Factor Authentication

To proceed with this method, ensure that you have enabled two-factor authentication for your Google account. If you haven't done so already, you can follow the link to set it up → Enable 2FA in your Google account.

Step 2: Create an App Password for Mail

@Myndex
Myndex / WCAG2vsAPCA_someLightReading.md
Last active June 20, 2024 23:45
WCAG 2 vs APCA • A Contrast in Applied Maths

WCAG 2 vs APCA Contrast Shootout

A Response to Comments Regarding APCA vs WCAG2/1.4.3

We have on occasion heard the comment "APCA produces less contrast" — this is not true, though I see how some might come to that conclusion, it does not consider the totality of the new guidelines.

APCA does not produce contrast. APCA does nothing to the colors, it only predicts how a human will perceive them, and their effect on readability. And yes, if you try to compare APCA to the WCAG2 math it might appear that APCA allows lower contrast in some specific cases where one color is white or very bright, but across the entire range, APCA clearly, consistently, and correctly predicts contrast, while WCAG2 more often than not allows lower contrasts to pass that have even been shown to be unreadable, even with normal vision.

Here's an example a user brought to my attention recently:

@lukepighetti
lukepighetti / example.dart
Last active March 27, 2021 00:54
Simple route generator that exposes arguments and query params to route builders
main() {
BuildContext context;
final router = NavigationService(context);
return MaterialApp(
onGenerateRoute: (settings) => router.handleGenerateRoute(
settings,
routes: {
'/': (params, context) => HomeView(),
@maks
maks / repl.dart
Created January 12, 2021 08:55
Example of basic Dart REPL using vm_service package
import 'dart:developer' as dev;
import 'dart:io';
import 'package:vm_service/vm_service.dart' show InstanceRef, VmService;
import 'package:vm_service/vm_service_io.dart' as vms;
import 'package:vm_service/utils.dart' as vmutils;
// based on early version of:
// https://github.com/BlackHC/dart_repl/
// and example in:
// https://github.com/dart-lang/sdk/blob/master/pkg/vm_service/example/vm_service_tester.dart
@lesnitsky
lesnitsky / inherited_widget_override_example.dart
Last active May 26, 2020 12:35
InheritedWidget override
import 'package:flutter/material.dart';
class Service {
final String authToken;
Service({this.authToken});
getData() async {
if (authToken == null) {
fetchAnonymous();
} else {
@lukepighetti
lukepighetti / client.dart
Last active September 7, 2021 20:54
Logging service using extensions for channels with multiple outputs
import 'package:logger/logger.dart';
void main() async {
/// Setup logging service
final remoteUrl = Uri.parse('http://localhost:8080');
final logger = LoggingService(
loggers: {
ConsoleLogger(),
RemoteLogger(baseUrl: remoteUrl),
},
@dnfield
dnfield / image_size_data.dart
Created March 3, 2020 22:08
Image size parsing in Dart
import 'dart:typed_data';
import 'package:meta/meta.dart';
/// Image formats supported by Flutter.
enum ImageFormat {
/// A Portable Network Graphics format image.
png,
/// A JPEG format image.
///
@rodydavis
rodydavis / flutter_github_ci.yml
Last active May 30, 2024 00:11
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
@MattPD
MattPD / analysis.draft.md
Last active July 18, 2024 21:09
Program Analysis Resources (WIP draft)