Skip to content

Instantly share code, notes, and snippets.

View mdecourse's full-sized avatar

KMOLab mdecourse

  • KMOL
  • Taiwan
View GitHub Profile
@mdecourse
mdecourse / random_grouping.dart
Last active October 17, 2019 02:45
random grouping from reading URL student number data
import 'dart:html';
void main() {
// 每一組 10 人
int num = 10;
// 組序由 1 開始
int gth = 1;
// 迴圈序號變數
int i;
// 每組學員暫存數列
@mdecourse
mdecourse / sort_string_element.dart
Last active September 9, 2019 11:58
Sort list with string elements
void main() {
var prices = ['99', '27', '10000', '20000000'];
prices.sort((String a, String b)=>int.parse(a).compareTo(int.parse(b)));
print('Lowest price is ${prices[0]}!');
}
/*
Dart2 strong sound typing example
void main() {
List<int> prices = ['99', '27', '10000', '20000000'];
@mdecourse
mdecourse / get_gist_file.py
Last active August 29, 2019 13:20
brython example1
import json
def get_gist(gisturl, filename):
url = 'https://api.github.com/gists/' + gisturl
# info is string
info = open(url).read()
gist = json.loads(info)
return gist["files"][filename]["content"]
print(get_gist("d9d4fe5b22d0af855603a683c153236e", "get_gist_file.py"))
@mdecourse
mdecourse / index.html
Last active September 2, 2019 07:05
ROC Flag in HTML Canvas
<!--
其他應用, 可以直接在網際繪製來自平面機構分析 (Solvespace) 所得到的座標點位置, 例如:
http://cpgx.kmol.info/2016fallcadp_ag100/blog/git-submodule-zai-dian-nao-fu-zhu-she-ji-shang-de-ying-yong.html
也可直接在網際解出 Geometric Constrain Solver, 直接根據使用者輸入, 進行平面機構的模擬分析, 例如:
http://cpgx.kmol.info/2016fallcadp_ag100/blog/2016fall-ping-mian-ji-gou-mo-ni.html
其他參考資料: https://github.com/google/cassowary.dart
https://github.com/google/codemirror.dart
https://github.com/google/charted
https://github.com/google/vector_math.dart
https://github.com/google/dart-gif-encoder
@mdecourse
mdecourse / index.html
Created August 31, 2019 23:51
Snake Game in Dartpad
<div id="wrapper">
<canvas id="canvas" width="450" height="450"></canvas>
</div>
@mdecourse
mdecourse / index.html
Created September 1, 2019 02:37
Dartpad and Html
<p id="text1">
origin text
</p>
@mdecourse
mdecourse / main.dart
Created September 1, 2019 04:23
Graph in Dart
//https://github.com/SamuelAG/Graph-Dart
class Graph {
Node root;
int vertex;
Graph() {
this.vertex = 0;
this.root = null;
}
@mdecourse
mdecourse / index.html
Created September 1, 2019 04:28
Solar system in Dartpad
<!-- Copyright 2011 the Dart project authors. All rights reserved.
Use of this source code is governed by a BSD-style license
that can be found in the LICENSE file. -->
<!doctype html>
<html lang="en" data-framework="dart">
<head>
<meta charset="utf-8">
<title>The Solar sample from DartPad</title>
<link rel="stylesheet" href="styles.css">
</head>
@mdecourse
mdecourse / index.html
Last active September 1, 2019 09:00
Say Hello in Dart
<h1>Hello, <span id="name"></span></h1>
<input type="text" id="name_box">
<input type="submit" value="Say Hello" id="button">
@mdecourse
mdecourse / index.html
Last active September 2, 2019 04:02
From main to rabbit number calculation
After <input type="number" id="years" value="5" min="1" max="30"> Years
<input type="button" id="submit" value="Calculate"/>
<br/>Number of rabbits: <label id="output"></label>