Skip to content

Instantly share code, notes, and snippets.

@rubgithub
rubgithub / main.py
Created November 7, 2023 21:07
Python Firebird SQLAlchemy Connection (windows)
from sqlalchemy import create_engine, text
import os
# I'm using the 'portable' version of firebird 2.5 32bits and Python 3.11 32bits
# setting the firebird client path
os.environ['PATH'] = r'D:\Portable\database\firebird\Firebird25\bin;%PATH%'
# if you're running on the cmd line terminal set the path:
# set PATH=D:\Portable\database\firebird\Firebird25\bin;%PATH%
@rubgithub
rubgithub / search_change_state.dart
Created October 17, 2020 21:08
Search change state
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@rubgithub
rubgithub / main.dart
Last active May 27, 2020 20:22
Dart Generic Workaround
class FirestoreServiceMock {}
abstract class IModel {
String _uid;
Map<String, dynamic> toJson();
fromJson(Map<String, dynamic> json);
String get uid => _uid;
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'dart:async';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
void main() {
Nome(null).imprimir();
}
class Nome {
Nome(this.nome) : assert(nome != null && nome.isNotEmpty);
final String nome;
imprimir(){
print('Meu nome é $nome');
import 'dart:async';
Stream<int> contStream() async* {
for (var k = 0; k < 10; k++) {
yield k;
}
}
Stream<int> timedCounter() async* {
int i = 0;
@rubgithub
rubgithub / lista.dart
Created March 23, 2020 18:38
Replicar item Lista
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
final defaultColor = Colors.blueAccent;
@rubgithub
rubgithub / navegacao.dart
Created March 23, 2020 12:54
Navegação básica
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: 'Navigation Basics',
home: FirstRoute(),
));
}
class FirstRoute extends StatelessWidget {
@rubgithub
rubgithub / main.dart
Last active February 25, 2020 13:30
Gerenciamento de Estado com StatelessWidget
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',