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
| getMe() { | |
| print("get me! heavy computation here or maybe set up a reusable API client (or something else) here"); | |
| return 3; | |
| } | |
| class X { | |
| int? _ethersProvider; // this variable is visible only in this file, so basically this works as a "private" variable (as there is no "private" in dart) | |
| int? get ethersProvider => _ethersProvider ?? (_ethersProvider = getMe()); | |
| } |
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
| // fisher yates: | |
| mapping(uint256 => uint256) private _fyAlreadySeen; // defaults to zero, so stores indexes from 1 | |
| function fyGetMapping(uint256 ridx) private view returns (uint256) { | |
| uint256 m = _fyAlreadySeen[ridx]; | |
| if (m != 0) return m - 1; | |
| return ridx; | |
| } | |
| function fySetMapping(uint256 ridx, uint256 idx) private { | |
| _fyAlreadySeen[ridx] = idx + 1; |
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
| // timeout tests | |
| let times = []; | |
| let n_times = 5; | |
| let cnt = 0; | |
| for (let i = 0; i < n_times; i++) { | |
| setTimeout(() => { | |
| const myI = i; | |
| const now = Date.now(); | |
| times[myI] = now; | |
| cnt++; |
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:async'; | |
| import 'package:flutter/widgets.dart'; | |
| abstract class StreamBuilderBase<T, S> extends StatefulWidget { | |
| /// Creates a [StreamBuilderBase] connected to the specified [stream]. | |
| const StreamBuilderBase({ Key key, this.stream }) : super(key: key); | |
| /// The asynchronous computation to which this builder is currently connected, |
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
| @override | |
| Widget build(BuildContext context) { | |
| return Container( | |
| decoration: BoxDecoration(color: Colors.white), | |
| child: buildHomePage("my first function") | |
| ); | |
| } | |
| Widget buildHomePage(String title) { | |
| final titleText = Container( | |
| padding: EdgeInsets.all(20), |
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
| package pe.tumicro.android.ui.common; | |
| import android.databinding.ListChangeRegistry; | |
| import android.databinding.ObservableList; | |
| import android.support.annotation.MainThread; | |
| import android.support.v7.util.DiffUtil; | |
| import android.support.v7.util.ListUpdateCallback; | |
| import java.util.AbstractList; |
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 <vector> | |
| #include <list> | |
| #include <map> | |
| #include <set> | |
| #include <queue> | |
| #include <deque> | |
| #include <stack> | |
| #include <bitset> | |
| #include <algorithm> | |
| #include <functional> |
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 <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <ctime> | |
| #include <cstring> | |
| #include <cmath> | |
| #include <climits> | |
| using namespace std; | |
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
| // Planchota con modificaciones de Josue | |
| #include <vector> | |
| #include <list> | |
| #include <map> | |
| #include <set> | |
| #include <queue> | |
| #include <deque> | |
| #include <stack> | |
| #include <bitset> | |
| #include <algorithm> |
NewerOlder