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
void main() async { | |
Stopwatch stopwatch = Stopwatch()..start(); | |
List<int> nums = [1, 2, 3, 4, 5]; | |
print(await usingForeach(nums)); | |
print('usingForeach() executed in ${stopwatch.elapsed}'); | |
// Reeset timer | |
stopwatch.reset(); | |
print(await usingWait(nums)); |
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
import 'dart:async'; | |
import 'dart:typed_data'; | |
import 'package:flutter/services.dart'; | |
class ImageGallerySaver { | |
static const MethodChannel _channel = | |
const MethodChannel('image_gallery_saver'); | |
/// save image to Gallery |
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 shuffle_class(classArray, guide): | |
if not isinstance(classArray, list): | |
return [] | |
if not isinstance(guide, int) or len(classArray) == 0: | |
return classArray | |
guide %= len(classArray) |
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
import random as r | |
class WordGame: | |
word_list = ['programmer', 'python', 'defenestrate'] | |
secret_word = r.choice(word_list).upper() | |
guessed_letters = [] | |
def __init__(self, guesses=9, letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'): | |
self.guesses = guesses |
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
import random as r | |
guesses = 9 | |
letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') | |
def format_word(guessed_letters, word): | |
''' | |
This function helps to format our secret word with | |
the letters that have been guessed correctly. For |
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 number_of_unique_elements (array): | |
return len(set(array)) |
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
void main() { | |
// List<int> numbers = [1,2,3,4,5,6,7,8,9]; | |
// print('FOREACH METHOD'); | |
// numbers.forEach((number){ | |
// print(number*number); | |
// }); | |
// print('\nFOR LOOP'); | |
// for(int number in numbers){ | |
// print(number*number); |
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
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
static const String _title = 'Flutter Code Sample'; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
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
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, |
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
// 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()); | |
class MyApp extends StatelessWidget { | |
@override |
NewerOlder