1
function add(a, b) {
return a + b;
}
2
function add($a, $b)
interface MathOperators { | |
int add(int a, int b); | |
int subtract(int a, int b); | |
} | |
int calculate(MathOperators operators, int a, int b) { | |
return operators.add(a, operators.subtract(a, b)); | |
} | |
class IntegerMath { |
declare module "react-native" { | |
import * as React from 'react'; | |
import {ComponentClass, ReactType, ReactNode, ReactElement} from 'react'; | |
export * from 'react'; | |
/** | |
* Represents the completion of an asynchronous operation | |
* @see lib.es6.d.ts |
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'); |