1
function add(a, b) {
return a + b;
}
2
function add($a, $b)
1
function add(a, b) {
return a + b;
}
2
function add($a, $b)
| [layout] { | |
| display: flex; | |
| } | |
| [layout="row"] { | |
| flex-direction: row; | |
| } | |
| [layout="column"] { | |
| flex-direction: column; |
| Match (Movie, {'name': 'Avatar'}) -[#r]>> n(#actor, Actor). | |
| Where ([#r, {'role': Do.exist}]). | |
| Optional (Match (#actor) -['actedIn']- n(#movie, Movie)). | |
| Return ([#actor, #movie]); | |
| Match (Movie, {'name': 'Avatar'}) <<_([#r, 'rated'])- n(User). | |
| Where ([#r, {'rating': Is.greaterThan(4.5)}]). | |
| Return ([#r]); |
| import 'dart:mirrors'; | |
| import 'package:guinness/guinness.dart'; | |
| class Test { | |
| Iterable iterable; | |
| Iterable<int> typedIterable; | |
| } | |
| main() { | |
| describe('Dart', () { |
| new RestServer() | |
| ..clientRoutes = ['/page'] | |
| ..static(STATIC_PATH, jailRoot: false) | |
| ..route(new Route('/api/auth') | |
| ..post = authorization.register | |
| ..put = authorization.login) | |
| ..preprocessor(authorization.checkLogin) | |
| ..route(new Route('/api/checkAuth') | |
| ..get = authorization.success) | |
| ..route(new Route('/api/page/{id}') |
| /** | |
| * Shortcut method for GET requests. See [Http.call] for a complete description | |
| * of parameters. | |
| */ | |
| Future<HttpResponse> get(String url, {String data, Map<String, dynamic> params, | |
| Map<String, String> headers, xsrfHeaderName, | |
| xsrfCookieName, interceptors, cache, timeout} | |
| ) => _http.get(url, data: data, params: params, | |
| headers: headers, xsrfHeaderName: xsrfHeaderName, | |
| xsrfCookieName: xsrfCookieName, interceptors: interceptors, |
| part of cogito; | |
| class User { | |
| /// Email validation according to WHATWGs HTML5 type="email" standard. | |
| final EMAIL_REGEX = new RegExp(r'''^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'''); | |
| String email = ''; | |
| String password = ''; | |
| String hash = ''; |
| register(Request request) { | |
| var user = new User.fromJson(request.json); | |
| if (!user.emailIsValid || !user.hashIsValid) { | |
| return new Response('invalid data', status: Status.ERROR); | |
| } | |
| return db.open().then((_) { | |
| DbCollection users = db.collection('Users'); |
| Name: dart | |
| Cartridge-Short-Name: DART | |
| Display-Name: Dart Cartridge | |
| Description: A dart cartridge | |
| Version: 0.6.3 | |
| License: MIT | |
| Vendor: google | |
| Cartridge-Version: 0.0.1 | |
| Cartridge-Vendor: filirom1 | |
| Categories: |
| Future<Response> helloPost(HttpRequest request) { | |
| return request.toList().then((List<List<int>> buffer) { | |
| var name = new String.fromCharCodes(buffer.expand((i) => i).toList()); | |
| name = name.isNotEmpty ? name : 'World'; | |
| return new Response("Hello, $name!"); | |
| }); | |
| } |