This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool isNumber(String value) { | |
if (value.isEmpty) return false; | |
final numb = num.tryParse(value); | |
return numb == null ? false : true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randrange | |
parts = { | |
"USA": randrange(1, 100), | |
"Germany": randrange(1, 100), | |
"Russia": randrange(1, 100) | |
} | |
keys = list(parts.keys()) | |
values = list(parts.values()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def karatsuba(x, y): | |
if x < 16 or y < 16: | |
return x * y | |
max_len = max(x.bit_length(), y.bit_length()) // 2 | |
bitwise_filter = (1 << max_len) - 1 | |
a, b = x >> max_len, x & bitwise_filter | |
c, d = y >> max_len, y & bitwise_filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Flutter Screen": { | |
"prefix": "fl-page", | |
"body": [ | |
"import 'package:flutter/material.dart';", | |
"", | |
"/// TODO: Finish the docs", | |
"/// ${1:name}Page to...", | |
"class ${1:name}Page extends StatelessWidget {", | |
"", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future callToAPI() async { | |
await http.get('url_to_my_api.dev/api'); | |
} | |
Future anotherCallToAPI() async { | |
await http.get('url_to_my_api.dev/api/another'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Image imageFile = Image.asset('assets/img/my_image.png'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aquí toda la configuración de flutter_gen | |
# ojo con las indentaciones | |
flutter_gen: | |
# por defecto, los archivos generados van en `lib/gen/` | |
# se puede sobreescribir con `lib/src/gen` usando [output] | |
output: lib/src/gen/ | |
# si utilizamos algún linter sensible a la cantidad de | |
# líneas de código, podemos complacerlo con [lineLength] | |
# que por defecto viene en 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Text( | |
'Esto es usando las fuentes con FlutterGen', | |
style: TextStyle(fontFamily: FontFamily.googleSans), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class API { | |
static const url = 'url_to_my_api.dev/api'; | |
} | |
Future callToAPI() async { | |
await http.get(API.url); | |
} | |
Future anotherCallToAPI() async { | |
await http.get('${API.url}/other'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assets.images.background.image(); |
OlderNewer