Skip to content

Instantly share code, notes, and snippets.

View thosakwe's full-sized avatar
🎯
Focusing

Tobe Osakwe thosakwe

🎯
Focusing
View GitHub Profile
@thosakwe
thosakwe / monad.dart
Created June 28, 2021 21:03
Dart monad [WIP]
abstract class Monad<T> {
abstract MonadInstance<U> bind<U>(FutureOr<Monad<U>> Function(T) f);
abstract MonadInstance<T> wrap(T value);
}
abstract class EitherMonad<L, R> extends Monad<Either<L, R>> {
static EitherMonad<L, Exception> wrapTryCatch<L>(FutureOr<L> Function() f);
abstract EitherMonad<U, R> bindLeft(FutureOr<U> Function(L) f);
abstract EitherMonad<L, U> bindRight(FutureOr<U> Function(R) f);
import <http>
func WrapNum(value) -> { value }
timesTwo = .value * 2
print(timesTwo(WrapNum(2)).value)
srv = HttpServer(ctx {
{req, res} = ctx
@thosakwe
thosakwe / README.md
Last active February 28, 2020 00:10
Angel mailer...

angel_mail

A service for Angel that uses package:mailer to send e-mails. It also supports rendering templates (Jael, mustache, whatever), which makes developing email templates easier. In addition, if given an assetsDir, it will inline CSS stylesheets (use cacheAssets: true in production).

@thosakwe
thosakwe / query.txt
Created November 12, 2019 15:17
Functional database query language
# create table users
schema users =
{
id: serial;
name: string;
age: int;
}
# select * from users
users
@thosakwe
thosakwe / hey.lisp
Last active October 27, 2022 13:02
Flutter in Lisp???
(defclass MyWidget (StatelessWidget)
(defun build (ctx)
(Column
(AppBar
:title (Text "Hello, Disp!")
:actions (list
(Text "A")
(Padding
:padding (EdgeInsets.all 16)
:child (Text "B"))))
@thosakwe
thosakwe / hey.js
Created August 10, 2019 02:51
alert
alert()
@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 {
@thosakwe
thosakwe / about-me.md
Last active July 19, 2020 10:00
About Me
@thosakwe
thosakwe / key.md
Created February 28, 2019 06:49
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA