Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
@osa1
osa1 / main.dart
Last active January 24, 2023 17:35
Strange Dart 8
class A {
@override
Type get runtimeType => int;
}
class B<T> {}
void main() {
print(A().runtimeType); // int
print(B<A>().runtimeType); // B<A>
@osa1
osa1 / main.dart
Last active January 20, 2023 09:43
Strange Dart 7
// Almost by definition, if I'm able to pass X where Y is expected, then X is a
// subtype of Y.
//
// In Dart, this mostly holds, but `dynamic` is an exception. I can pass
// `dynamic` everywhere, but it's not really a subtype of anything.
void f(int a) {}
class C<A> {}
@osa1
osa1 / main.dart
Created December 20, 2022 19:05
Strange Dart 5
class C {
dynamic get a {
print('C.a getter called');
return (x) => print('C.a return value called');
}
}
void main() {
var x = C();
@osa1
osa1 / main.dart
Last active November 30, 2022 13:33
Strange Dart 4
class A {
void f() {
print('A.f called');
}
}
class B implements A {
void f({int test}); // optional non-nullable with no default value, also not a valid override
// `f` above is not valid without a `noSuchMethod`
@osa1
osa1 / main.dart
Created November 19, 2022 09:26
Strange Dart 3
class A {
void f() {}
}
extension B on A {
void g() {}
}
void main() {
final a = A();
@osa1
osa1 / main.dart
Created November 11, 2022 20:01
Strange Dart 2
class A {
void f() {
print('A.f called');
}
}
class B extends A {
@override
void f();
}
@osa1
osa1 / main.dart
Created November 11, 2022 19:57
Strange Dart 1
void voidFun() => 123;
class A<T> {
T x;
A (this.x);
Object? getX() => x;
}
@osa1
osa1 / share_send_app_endpoints.md
Created June 23, 2022 20:12 — forked from StephenBlackWasAlreadyTaken/share_send_app_endpoints.md
DexcomShare Endpoints for the Uploader App
  • these are the calls used by the dexcom uploader app
  • these are in no particular order!
  • User-Agent: Dexcom%20Share/3.0.2.11 CFNetwork/672.0.2 Darwin/14.0.0

General

Read Dexcoms System time clock

GET

@osa1
osa1 / dotfiles
Created October 14, 2021 18:58 — forked from rosghub/dotfiles
Manjaro i3 Hi-DPI config
#
# Configuration files for Manjaro i3 on Lenovo Yoga 2 pro
# to scale properly on HiDPI (3200x1800)
#
#####################################################
~/.profile #
#####################################################
# UI element scaling, icons
export GDK_SCALE=2
@osa1
osa1 / replace_char_codes.rs
Last active June 18, 2021 08:41
Replace '\u{...}' with '<char>'
use std::convert::TryFrom;
use std::io::{stdin, BufRead};
use std::process::exit;
use regex::{Captures, Regex};
fn main() {
let re = Regex::new(r"'\\u\{([0-9A-Fa-f]+)\}'").unwrap();
let stdin = stdin();