Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mannuelf's full-sized avatar
👾

Mannuel Ferreira mannuelf

👾
View GitHub Profile
@mannuelf
mannuelf / keychron_linux.md
Created September 11, 2022 07:47 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes. By default, this driver uses the F-keys as multimedia shortcuts and you have to press Fn + the key to get the usual F1 through F12 keys.

@mannuelf
mannuelf / main.dart
Created August 7, 2022 16:11
Dartpad Nanochat using FlutterFire (Auth + Firestore)
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
const messageLimit = 30;
@mannuelf
mannuelf / main.dart
Last active July 21, 2022 07:33
abstract-classes
void main() {
PowerGrid grid = PowerGrid();
NuclearPlant nuclear = NuclearPlant();
SolarPlant solar = SolarPlant();
grid.addPlant(nuclear);
grid.addPlant(solar);
}
class PowerGrid {
@mannuelf
mannuelf / main.dart
Last active July 18, 2022 12:24
bloc-pattern-login-form
import 'dart:async';
void main() {
final bloc = Bloc();
// bad pattern
// bloc.emailController.stream.listen((value) {
// print(value);
// });
@mannuelf
mannuelf / index.html
Created July 18, 2022 12:08
email-validation-with-streams
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>email-validation-with-streams</title>
<link rel="stylesheet" href="styles.css">
<script type="application/dart" src="main.dart"></script>
</head>
@mannuelf
mannuelf / index.html
Created July 18, 2022 09:11
dom-select-streams
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dom-select-streams</title>
<link rel="stylesheet" href="styles.css">
<script type="application/dart" src="main.dart"></script>
</head>
@mannuelf
mannuelf / main.dart
Created July 18, 2022 08:11
reactive-dart
import 'dart:async';
void main() {
String chosenCake = 'chocolate';
// Stream Controller
final controller = StreamController();
final order = Order(chosenCake);
final baker = StreamTransformer.fromHandlers(handleData: (cakeType, sink) {
if (cakeType == 'chocolate') {
@mannuelf
mannuelf / main.dart
Created July 18, 2022 07:37
handle-json-ImageModel
import 'dart:convert';
void main() {
var rawJson = '{ "id": 1, "url": "https://google.com" }';
var parsedJson = json.decode(rawJson);
var imageModel = ImageModel.fromJson(parsedJson);
print(imageModel.id);
print(imageModel.url);
@mannuelf
mannuelf / main.dart
Created July 18, 2022 07:36
HTTP example
import 'dart:convert' as convert;
import 'package:http/http.dart' as http;
void main(List<String> arguments) async {
// This example uses the Google Books API to search
// for books about HTTP. For details, see
// https://developers.google.com/books/docs/overview
final url = Uri.https(
'www.googleapis.com',
@mannuelf
mannuelf / main.dart
Created July 18, 2022 07:34
handle-json
import 'dart:convert';
void main() {
var rawJson = '{ "id": 1, "url": "https://google.com" }';
var parsedJson = json.decode(rawJson);
var imageModel = ImageModel.fromJson(parsedJson);
print(imageModel.id);
print(imageModel.url);