Skip to content

Instantly share code, notes, and snippets.

@pythoneer
pythoneer / main.dart
Created April 7, 2022 10:46
demo pattern for offline behavior
void main() {
print("wir machen ein update\n");
doUpdate();
}
void doUpdate() async {
var currentValue = "";
try {
TestCase := Window {
preferred-width: 400px;
preferred-height: 600px;
background: red;
Path {
width: 100%;
height: 100%;
fill: white;
[package]
name = "herold"
version = "0.1.0"
authors = ["Dustin Bensing <[email protected]>"]
[dependencies]
#actix-web = "0.6"
actix-web = { git = "https://github.com/actix/actix-web.git" }
serde = "1.0.66"
serde_derive = "1.0.66"
#[macro_use]
extern crate serde_derive;
extern crate actix_web;
extern crate fcm;
extern crate tokio;
extern crate futures;
use actix_web::{server, App, Responder, Json, http, HttpResponse, Error, client::SendRequestError};
use fcm::{MessageBuilder, Client, NotificationBuilder, FcmError};
use futures::{
@pythoneer
pythoneer / Main.java
Last active August 3, 2017 08:33
super generic container
public class Main {
//a container holding all kinds of stuff
interface Container<S, F, M, L> { //S (self) is not really safe here .. can be anything
boolean contains(F f, M m, L l);
F first();
M middle();
L last();
S create(F f, M m, L l);
}
@pythoneer
pythoneer / iterator.rs
Created August 2, 2017 20:58
generic iteratos
//a container holding all kinds of stuff
trait Container {
type F: Copy;
type M: Copy;
type L: Copy;
fn contains(&self, first: &Self::F, middle: &Self::M, last: &Self::L) -> bool;
fn first(&self) -> &Self::F;
fn middle(&self) -> &Self::M;
fn last(&self) -> &Self::L;
public class Main {
//Java has no `add` interface
interface Addition<T> {
T add(T other);
T init();
}
//fucked up wrapper for Integers, Java has no `add` interface
public static class AInteger implements Addition<AInteger> {
@pythoneer
pythoneer / iterator.rs
Created August 2, 2017 17:52
rust monomoph
extern crate num;
use std::ops::{Add, AddAssign};
use std::fmt::Display;
use num::traits::Zero;
//an Iterator over types that can be added
trait AIterator {
type Output: Add + AddAssign + Display + Clone + Zero;
@pythoneer
pythoneer / Main.rs
Last active August 2, 2017 18:28
rust_generic_concrete
//a container holding all kinds of stuff
trait Container {
type F;
type M;
type L;
fn contains(&self, first: &Self::F, middle: &Self::M, last: &Self::L) -> bool;
fn first(&self) -> &Self::F;
fn middle(&self) -> &Self::M;
fn last(&self) -> &Self::L;
@pythoneer
pythoneer / Main.java
Last active August 2, 2017 18:23
java_generic_concrete
public class Main {
//a container holding all kinds of stuff
interface Container<F,M,L> {
boolean contains(F f, M m, L l);
F first();
M middle();
L last();
}