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
function ajax(method, url, data) { | |
var request = new XMLHttpRequest(); | |
return new Promise(function (resolve, reject) { | |
request.onreadystatechange = function () { | |
if (request.readyState === 4) { | |
if (request.status === 200) { | |
resolve(request.responseText); | |
} else { | |
reject(reject(reject.status)); | |
} |
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 http = require("http"); | |
const https = require("https"); | |
const fs = require("fs"); | |
const express = require("express"); | |
const app = express(); | |
// http server | |
const http_server = http.createServer(app); | |
http_server.listen(80, "0.0.0.0"); | |
const options = { |
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
void main() { | |
Car myCar = Car(); | |
print(myCar.numberOfSeat); | |
myCar.drive(); | |
ElectriCar myTesla = ElectriCar(); | |
myTesla.drive(); | |
print(myTesla.batteryLevel); | |
} |
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'; | |
void main() { | |
performTask(); | |
} | |
void performTask() async { | |
task1(); | |
String task2result = await task2(); | |
task3(task2result); |
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:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
initialRoute: "/", | |
routes: { |
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:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Screen1(), | |
); |
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
void main() { | |
Human jenny = Human(15, 40); | |
print(jenny.height); | |
Human jemes = Human(110, 10); | |
print(jemes.height); | |
print(jemes.weight); | |
jemes.talk("hello"); | |
} |
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
void main() { | |
Human jenny = Human(startingHeight: 15); | |
print(jenny.height); | |
Human jemes = Human(startingHeight: 20); | |
print(jemes.height); | |
jemes.talk("hello"); | |
} |
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:flutter/material.dart'; | |
import 'package:audioplayers/audio_cache.dart'; | |
void main() => runApp(XylophoneApp()); | |
class XylophoneApp extends StatelessWidget { | |
static AudioCache player = AudioCache(); | |
void playAudio(int audioNumber) { | |
player.play('note$audioNumber.wav'); |
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:flutter/material.dart'; | |
import 'dart:math'; | |
void main() => runApp( | |
MaterialApp( | |
home: Scaffold( | |
backgroundColor: Colors.blueAccent, | |
appBar: AppBar( | |
title: Text("Ask Me Anything"), | |
), |