Skip to content

Instantly share code, notes, and snippets.

View mchayapol's full-sized avatar

Chayapol Moemeng mchayapol

View GitHub Profile
@mchayapol
mchayapol / cashreg.html
Created September 22, 2015 02:48
Cash Register Skeleton Code
<!DOCTYPE html>
<html>
<head>
<title>Cash Register</title>
<script>
</script>
</head>
<body>
<table>
@mchayapol
mchayapol / gist:529b8835518ddb1e0486
Created September 16, 2015 04:20
Linked List Skeleton 02
package edu.au.scitech.sc2101;
public class IntegerLinkedList {
Node head;
public class Node {
int value;
Node next;
// Constructor for this node
@mchayapol
mchayapol / gist:a11a5fcb2e7973249bd6
Created September 16, 2015 03:09
Linked List Skeleton 01
package edu.au.scitech.sc2101;
public class IntegerLinkedList {
Node head;
public class Node {
int value;
Node next;
// Constructor for this node
@mchayapol
mchayapol / gist:6c1d99697d9e60ae6324
Created September 15, 2015 03:16
CashRegister example with docket
function calculateChange() {
var purchase = document.getElementById('purchase');
var cash = document.getElementById('cash');
var change = document.getElementById('change');
var result = Number(cash.value) - Number(purchase.value);
console.log(result);
change.value = result;
@mchayapol
mchayapol / gist:1ea16904ea4a2d276292
Created September 15, 2015 02:37
CSS for Cash Register exercise
<style>
#divCashReg {
float: left;
width: 300px;
}
#divDocket {
border: 1px dashed black;
width: 200px;
min-height: 200px;
margin-left: 300px;
@mchayapol
mchayapol / test.html
Created September 14, 2015 04:20
JSON Example 03 (Add contact complete)
<!DCOTYPE html>
<head>
<title>Test</title>
<script src="js/jquery-1.11.3.min.js"></script>
<script>
function reloadContact() {
// Load all contacts into div2
console.log(localStorage.contactList);
// It could happen that localStorage.contactList has never been defined.
@mchayapol
mchayapol / test.html
Created September 14, 2015 03:29
JSON Example 02 (Add Contact)
<!DCOTYPE html>
<head>
<title>Test</title>
<script src="js/jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function () {
/*
// dynamic-length record, delimiter
@mchayapol
mchayapol / testJSON.html
Last active September 14, 2015 03:08
JSON Example 01
<!DCOTYPE html>
<head>
<title>Test</title>
<script src="js/jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function () {
/*
// dynamic-length record, delimiter
@mchayapol
mchayapol / SortingUtility.java
Created September 10, 2015 04:12
Quick Sort
package edu.au.scitech.sc2101;
import java.util.Arrays;
public class SortingUtility {
public static void quickSort(int[] arr, int startIndex, int endIndex) {
System.out.println( Arrays.toString( arr ) );
int pivotIndex = (startIndex + endIndex) / 2;
@mchayapol
mchayapol / index.html
Last active September 8, 2015 04:06
Cash Register Skeleton
<!DOCTYPE html>
<html>
<head>
<title>Cash Register</title>
<script>
function calculateChange() {
var purchase = document.getElementById('purchase');
var cash = document.getElementById('cash');
var change = document.getElementById('change');