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" show Future; | |
main() async { | |
print("Sample size: ${samples.length}"); // Ensure samples generated. | |
for (var i = 0; i < 5; i++) { | |
// Measure the overhead of the benchmarking using the [nop] test. | |
bench("base", nop); | |
await new Future.delayed(Duration.zero); // prevent blocking when run in browser. | |
bench("re-case", fre1); | |
await new Future.delayed(Duration.zero); |
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:convert"; | |
import "dart:io"; | |
var multitestRE = RegExp(r"//#[ \t]*(\w+)[ \t]*:(.*)"); | |
var filenameRE = RegExp(r"(?=(_test)?\.dart$)"); | |
main(List<String> args) { | |
for (var fileName in args) { | |
if (!fileName.endsWith(".dart")) { | |
stderr.writeln("Not a Dart file: $fileName. Must end with \".dart\"."); |
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
abstract class Locale { | |
String get languageCode; | |
String get scriptCode; | |
String get regionCode; | |
const factory Locale(String languageCode, | |
[String regionOrScriptCode, String regionCode]) = _Locale._select; | |
} | |
class _Locale implements Locale { |
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
abstract class Locale { | |
String get languageCode; | |
String get scriptCode; | |
String get regionCode; | |
const factory Locale(String languageCode, | |
[String regionOrScriptCode, String regionCode]) = _Locale._select; | |
} | |
class _Locale implements Locale { |
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
const int count = 100000; | |
void test(String s) {} | |
void main() { | |
Stopwatch t = new Stopwatch(); | |
// Run more than once to account for JIT compilation and optimization. | |
for (int i = 0; i < 3; i++) { | |
// USING STRING |
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 sublime | |
import sublime_plugin | |
import re | |
class DartCodeUnitCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
rd = re.compile(r'r?([\'"])(.)\1\.codeUnitAt\(0\)'); | |
for selection in self.view.sel(): | |
selectionText = self.view.substr(selection); | |
matches = list(rd.finditer(selectionText)) |
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
/// A parser of (some) JSON source. | |
/// | |
/// Each type of parser must implement [parseInput]. | |
/// For example, a pure boolean-parser can have a [parseInput] that | |
/// only accepts the words "true" and "false". | |
abstract class TypedJsonParser<T> { | |
const TypedJsonParser(); | |
/// Parse a JSON value expression from [input] to a [T]. | |
/// |
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:io"; | |
bool verbose = false; | |
bool dryRun = false; | |
main(List<String> args) { | |
int unchanged = 0; | |
for(var path in args) { | |
if (path == "-v") { | |
verbose = true; | |
continue; |
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
#! /usr/bin/perl | |
my $format = "%2.2X"; | |
if ($ARGV[0] eq "-l") { | |
$format = "%2.2x"; | |
shift @ARGV; | |
} | |
if ($#ARGV >= 0) { | |
my @hex = (); | |
for $a (@ARGV) { | |
for $c ( split("", $a) ) { |
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 sublime | |
import sublime_plugin | |
# Rotate contents of selections forwards. | |
class RotateSelectionCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
view = self.view | |
prevText = view.substr(view.sel()[-1]) | |
for selection in view.sel(): | |
text = view.substr(selection); |