This file contains hidden or 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
// based on: https://www.youtube.com/watch?v=ZHRhSFXqHJY | |
// but better modularied | |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains hidden or 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
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains hidden or 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
/// Example of a Flutter app with screens with different appbars | |
/// gist: https://gist.github.com/kranfix/32dca6442c57ebf3e1dbdc02f431072f | |
/// dartpad: https://dartpad.dev/32dca6442c57ebf3e1dbdc02f431072f | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
This file contains hidden or 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
/// Dart extension example for parsing dates. | |
/// | |
/// gist: https://gist.github.com/kranfix/0b16ce2c2e9c94199dbd77b1abe54945 | |
/// dartpad: https://dartpad.dev/0b16ce2c2e9c94199dbd77b1abe54945 | |
extension DateTimeFormatterX on DateTime { | |
String get spanishDateString => '${this.day}/${this.month}/${this.year}'; | |
} | |
void main() { | |
const backendDate = '2020-04-09T14:22:32.789'; |
This file contains hidden or 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
// Fx for https://gist.github.com/stegrams/a2d17dc45bdae1ddfcc92cf6af96b80b/revisions#diff-a4501314e2bb2871a1a84da5ed71b87b | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { |
This file contains hidden or 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
// Python example: https://gist.github.com/kranfix/f3b8cf554b25b6c6f7e9524aec6bf0af | |
// JavaScript example: https://gist.github.com/kranfix/4b1774e940cc112098e7e559fb5a8323 | |
// Dart example: https://gist.github.com/kranfix/82ccca5089150eadbf24a258d9d5be02 | |
// Dartpad: https://dartpad.dev/82ccca5089150eadbf24a258d9d5be02 | |
void main() { | |
final foo = Foo(name: "Simple", counter: 20); | |
print(foo); | |
foo.counter = 21; | |
foo.name = "Not simple"; | |
print(foo); |
This file contains hidden or 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 Foo(): | |
def __init__(self): | |
self.bar = "Hello!" | |
foo = Foo() | |
print(foo.__dir__()) | |
print("-----------------------") | |
print(foo.bar) | |
print(getattr(foo,"bar")) |
This file contains hidden or 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
// Reference: https://talks.golang.org/2014/go4java.slide#41 | |
// DartPad: https://dartpad.dev/bda7024a78cf0b819028b1435a5ed735 | |
// Gist: https://gist.github.com/kranfix/bda7024a78cf0b819028b1435a5ed735 | |
void main() { | |
const List<Task> tasks = [Task("one"), Task("two"), Task("three")]; | |
final runner = ExtendedRunCounter("My run counter"); | |
//final runner = ComposedRunCounter("My run counter"); | |
runner.runAll(tasks); | |
print("${runner.name} ran ${runner.count} tasks"); |
This file contains hidden or 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
// Reference: https://talks.golang.org/2014/go4java.slide#41 | |
void main() { | |
RunCounter runner = RunCounter("my runner"); | |
List<Task> tasks = [Task("one"), Task("two"), Task("three")]; | |
runner.runAll(tasks); | |
print("${runner.name} ran ${runner.count} tasks"); | |
} |
This file contains hidden or 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
include $(GOROOT)/src/Make.inc | |
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4 | |
all: | |
$(GC) jsontest.go | |
$(LD) -o jsontest.out jsontest.$O | |
format: | |
$(GOFMT) -w jsontest.go |