Skip to content

Instantly share code, notes, and snippets.

View karnzx's full-sized avatar
😆
HI ~

Piravit Chenpittaya karnzx

😆
HI ~
View GitHub Profile
@karnzx
karnzx / app.py
Last active March 26, 2020 13:19
Medium Brython -app.py
from flask import Flask, render_template
import folium
app = Flask(__name__)
@app.route('/')
def home():
return '<h1><a href="/map">Map</a></h1>'
@app.route('/map')
def map():
@karnzx
karnzx / map.html
Last active March 26, 2020 14:36
Medium Brython -map.html
{% extends '/base-map.html' %}
{% block body %}
<div>
<p id="coords"></p>
<div id="mapid" style="margin: 1em;"></div>
</div>
<script type="text/python">
from browser import alert, document, window, html
@karnzx
karnzx / base-map.html
Last active March 26, 2020 13:36
Medium Brython -base-map.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
#mapid {
height: 60rem;
background-color:white;
}
@karnzx
karnzx / map.html
Created March 26, 2020 16:11
Medium Brython map add OpenStreetTileLayer
{% extends '/base-map.html' %}
{% block body %}
<div>
<p id="coords"></p>
<div id="mapid" style="margin: 1em;"></div>
</div>
<script type="text/python">
from browser import alert, document, window, html
@karnzx
karnzx / map.html
Created March 26, 2020 16:23
Medium Brython user location mark was added
{% extends '/base-map.html' %}
{% block body %}
<div>
<p id="coords"></p>
<div id="mapid" style="margin: 1em;"></div>
</div>
<script type="text/python">
from browser import alert, document, window, html
@karnzx
karnzx / map.html
Created March 26, 2020 16:45
Medium brython change center to thailand, edit zoom, add bankok and chiang mai marks
{% extends '/base-map.html' %}
{% block body %}
<div>
<p id="coords"></p>
<div id="mapid" style="margin: 1em;"></div>
</div>
<script type="text/python">
from browser import alert, document, window, html
@karnzx
karnzx / map.html
Created March 26, 2020 16:53
Medium Brython add flyto function, click event
{% extends '/base-map.html' %}
{% block body %}
<div>
<p id="coords"></p>
<div>
<button id="chiangmai">ไปเชียงใหม่</button>
<button id="hatyai">ไปหาดใหญ่</button>
<button id="bankkok">ไปกรุงเทพ</button>
</div>
<div id="mapid" style="margin: 1em;"></div>
class A {
private int x;
public A(int x) {
this.x = x;
System.out.println("A");
}
public void foo() {
System.out.println(x);
@karnzx
karnzx / Main.java
Last active February 13, 2021 07:43
import java.util.*;
class Shape {
private String name;
public Shape(String name) {
this.name = name;
}
public String getName() {
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello world!"
if __name__ == '__main__':
app.debug = True