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'; | |
// http://en.wikipedia.org/wiki/Bubble_sort | |
void bubble(List list) { | |
var n = list.length; | |
while (n != 0) { | |
var newn = 0; | |
for (var i = 1; i < n; i++) { | |
if (list[i-1] > list[i]) { |
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'; | |
@lazy | |
import 'big_lib.dart' as big show soManyFunctions; | |
const lazy = const DeferredLibrary('big', uri: 'big.js'); | |
void main() { | |
lazy.load().then((_) { | |
big.soManyFunctions(); |
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:collection'; | |
void main() { | |
var list = new WatchList([1,2,3,4,5]); | |
var mapped = list.where((x) => x.isEven).map((x) => x*2); | |
// What is printed here? | |
print(list.accessCount); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Addtotable</title> | |
<link rel="stylesheet" href="addtotable.css"> | |
<link rel="import" href="my_table.html"> | |
<script type="application/dart">export 'package:polymer/init.dart';</script> |
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 Person { | |
String firstName, lastName; | |
Person(List<String> raw) : firstName = raw[0], lastName = raw[1]; | |
String toString() => '$firstName $lastName'; | |
} | |
/** | |
* Expects one person per line, each line containing a first and last name | |
* separated by a single space. | |
*/ |
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
I am a null (ID: 177863854) and I am ready | |
I am a null (ID: 924578920) and I am ready | |
I am a null (ID: 394322034) and I am ready | |
I am a null (ID: 854832235) and I am ready | |
I am a null (ID: 587923908) and I am ready | |
I am a null (ID: 763736301) and I am ready |
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 'package:polymer/polymer.dart'; | |
import "package:google_oauth2_client/google_oauth2_browser.dart"; | |
import "package:js/js.dart" as js; | |
import 'dart:html'; | |
import 'package:logging/logging.dart'; | |
typedef OnSignInCallback(SimpleOAuth2 authenticationContext, [Map authResult]); | |
typedef OnSignOutCallback(); | |
final Logger log = new Logger('google-sign-in-element'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sample app</title> | |
<link rel="stylesheet" href="testme.css"> | |
<!-- import the click-counter --> | |
<link rel="import" href="clickcounter.html"> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sample app</title> | |
<script src="packages/polymer/boot.js"></script> | |
</head> | |
<body> | |
<polymer-element name="x-c"> |
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
#!/bin/sh | |
DARTFILENAME=$1.dart | |
HTMLFILENAME=$1.html | |
ELEMENTNAME=$2 | |
LIBNAME=`echo $2 | sed -e "s/-/_/g"` | |
CLASSNAME=$3 | |
echo > $HTMLFILENAME | |
echo "<head>" >> $HTMLFILENAME |