Skip to content

Instantly share code, notes, and snippets.

View mdecourse's full-sized avatar

KMOLab mdecourse

  • KMOL
  • Taiwan
View GitHub Profile
@mdecourse
mdecourse / index.html
Last active September 2, 2019 07:51
Ping-Pong Game in Dartpad
<canvas id="canvas" width="298" height="400"></canvas>
<footer>
<button type="button" id="play" class="button">Play</button>
</footer>
@mdecourse
mdecourse / main.dart
Created September 4, 2019 01:06
Hello World Dart
/*
This line declares a function called main(). Functions are a
block of statements that the computer executes when the function is “called.” main() is always the entry point of a Dart program—the place where the
program begins execution. main() is automatically called (executed). The void indicates that the main() function will not return any value. The opening curly brace indicates where the function starts. The empty parentheses mean that this function takes no arguments.
The main() function has only one statement. This statement calls a function built into Dart named “print,” which will print out any line of text to the console. A piece of text is known as a string, and in its literal form is contained within quotes. So, this function, print(), takes one argument, a string literal, and prints it out to the console. The semicolon at the end of the line indicates where
the statement ends.
*/
void main() {
@mdecourse
mdecourse / index.html
Created September 4, 2019 06:55
To do list in dart
<div id="output">
<label for="todo">What do you want todo?</label>
<input type="text" id="todo" placeholder="Enter a Todo." />
<button id="clear">Clear All Todos</button>
<div id="todo-list">
</div>
</div>
@mdecourse
mdecourse / index.html
Last active September 4, 2019 08:56
Number Guessing in dartpad
猜一個 1 ~ 100 間的整數:<br />
<input type="text" id="input" />
<input type="submit" id="submit" value="猜數字"/>
<div id="output"></div>
@mdecourse
mdecourse / index.html
Last active September 4, 2019 13:24
Get mouse coordinate in Dartpad
<canvas id="canvas" width="300" height="300"></canvas>
<div id="output"></div>
@mdecourse
mdecourse / index.html
Created September 4, 2019 13:28
Free Draw in Dartpad
<div>
<canvas id="draw-surface" width="800px" height="600px">
</canvas>
</div>
<div id="colors">
<input id="white" type="button"></input>
<input id="red" type="button"></input>
<input id="black" type="button"></input>
<input id="blue" type="button"></input>
<input id="green" type="button"></input>
@mdecourse
mdecourse / fourbar.py
Last active September 5, 2019 02:10
平面機構模擬 Brython 參考程式
# http://mde.tw/2017springcd/blog/brython-2d-canvas-fourbar.html
# http://project.mde.tw/blog/pyslvs_triangle_expression.html
# http://lab.kmol.info/2017fall/blog/kmol-2017-fall-cadp-fourbar-three-position-synthesis.html
from browser import document
import math
import time
from browser import timer
class Coord(object):
def __init__(self,x,y):
@mdecourse
mdecourse / grouping.dart
Created September 6, 2019 07:50
Almost Equal Sizing Grouping
// 算出大略相等數目的分組數列
void main() {
// total student number
int total = 52;
// initial each group expect to be "eachGrp" number of people
int eachGrp = 10;
// may divide into "grpNum" number of group
int grpNum = total ~/ eachGrp;
// vacant list
var splits = [];
@mdecourse
mdecourse / 2019cp1a_grouping.dart
Last active September 19, 2019 00:38
2019cp 一甲亂數分組
import 'dart:html';
void main() {
// 每一組 10 人
int num = 10;
// 組序由 1 開始
int gth = 1;
// 迴圈序號變數
int i;
// 每組學員暫存數列
@mdecourse
mdecourse / 2019cp1b_grouping.dart
Last active September 19, 2019 07:46
2019cp 一乙亂數分組
import 'dart:html';
void main() {
// 每一組 10 人
int num = 10;
// 組序由 1 開始
int gth = 1;
// 迴圈序號變數
int i;
// 每組學員暫存數列