Skip to content

Instantly share code, notes, and snippets.

View tomquas's full-sized avatar

tom quas tomquas

  • patugo GmbH
  • munich, germany
View GitHub Profile
@simolus3
simolus3 / cipher_db.dart
Last active January 15, 2021 09:08
Template to use moor_ffi with SQLCipher
import 'dart:async';
import 'dart:ffi';
import 'dart:io';
import 'dart:math';
import 'package:moor/backends.dart';
import 'package:moor/moor.dart';
import 'package:moor_ffi/moor_ffi.dart';
import 'package:moor_ffi/open_helper.dart';
@felangel
felangel / main.dart
Created December 13, 2019 00:09
[flutter_bloc] Location Stream Example
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:meta/meta.dart';
import 'package:geolocator/geolocator.dart';
void main() => runApp(MyApp());
@thosakwe
thosakwe / copy_dir.dart
Created July 17, 2019 15:54 — forked from tobischw/copy_dir.dart
Recursively copy directory in Dart (requires "path")
/*
* I'm sure there's a better way to do this, but this solution works for me.
* Recursively copies a directory + subdirectories into a target directory.
* There's also no error handling. Have fun.
*/
import 'dart:io';
import 'package:path/path.dart' as path;
Future<void> copyDirectory(Directory source, Directory destination) async {
@karlredman
karlredman / minio-through-caddy.md
Last active January 26, 2024 15:11
# Serve static pages from minio through caddy
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@felangel
felangel / main.dart
Last active October 2, 2024 03:53
Bloc with SearchDelegate
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@disintegrator
disintegrator / https-during-dev.macos.sh
Last active August 26, 2025 09:55
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {
@Aetherus
Aetherus / scale-out-phoenix-with-websocket.md
Last active February 23, 2024 14:31
How to scale out a Phoenix application with websocket

How to scale out a Phoenix application with websocket

Foreword

It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.

Resources

@njanakiev
njanakiev / overpass_api_recipes.md
Last active October 8, 2024 14:57
Overpass API Recipes

Overpass API Recipes

Get all the peaks in the dolomites

area
  [place=region]
  ["region:type"="mountain_area"]
  ["name:en"="Dolomites"];
out body;
@jochasinga
jochasinga / websocket.ml
Last active February 9, 2018 08:00
Exploring first Bucklescript
type socket
type event
type config = {
reconnect: bool;
debug: bool;
timeout: int;
interval: int
}