Skip to content

Instantly share code, notes, and snippets.

Avatar
🧩
Taking care of my mental health and in spare moments coding sometimes.

Samuel Matias samuelematias

🧩
Taking care of my mental health and in spare moments coding sometimes.
View GitHub Profile
@samuelematias
samuelematias / doom.txt
Created Feb 11, 2021 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
View doom.txt
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@samuelematias
samuelematias / auth_interceptor.dart
Created Jan 29, 2021 — forked from douglasiacovelli/auth_interceptor.dart
This is a code for an auth interceptor for Dio, which uses a header to avoid retrying indefinitely to refresh the token.
View auth_interceptor.dart
/// This interceptor is simplified because is doesn't contemplate
/// a refresh token, which you should take care of.
/// I haven't tested this code, but I believe it should work.
/// If you have some feedback, please leave a comment and I'll review it :) Thanks.
class AuthInterceptor extends InterceptorsWrapper {
final Dio loggedDio;
final Dio tokenDio;
@samuelematias
samuelematias / Install_tmux
Created Oct 27, 2020 — forked from simme/Install_tmux
Install and configure tmux on Mac OS X
View Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@samuelematias
samuelematias / README.md
Created Oct 27, 2020 — forked from kasperpeulen/README.md
How to get a timestamp in Dart.
View README.md
View dart_enum_description.dart
enum MyEnum {
simple,
special,
complex,
}
extension MyEnumUtils on MyEnum {
String get description {
switch (this) {
case MyEnum.simple:
@samuelematias
samuelematias / unused_dependencies.js
Created Sep 4, 2020 — forked from lukepighetti/unused_dependencies.js
Search a Flutter project for unused dependencies
View unused_dependencies.js
/// Finds unused dependencies from pubspec.yaml
///
/// Achieves this by parsing pubspec.yaml and recursively
/// searching the lib folder for an import statement that
/// contains the name of each package. Prints out the results.
const fs = require("fs");
const YAML = require("yaml");
const { execSync } = require("child_process");
/// Read pubspec.yaml
@samuelematias
samuelematias / links.md
Created Aug 26, 2020 — forked from irvine5k/links.md
TDC SP 2020 TESTES DE WIDGET
View links.md
View analysis_options.yaml
include: all_lint_rules.yaml
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
# This is generated from the i18n vscode extension
- "**/i18n.dart"
strong-mode:
implicit-casts: false
implicit-dynamic: false
View all_lint_rules.yaml
linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_specify_types
- annotate_overrides
- avoid_annotating_with_dynamic
- avoid_as
View future_extension.dart
extension FutureExtension on Future {
Widget toBuild<T>({Widget Function(T data) onSuccess, Widget onError, dynamic data}) {
return FutureBuilder<T>(
future: this,
initialData: data,
builder: (BuildContext context, AsyncSnapshot snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
case ConnectionState.active:
return Center(child: CircularProgressIndicator());