Skip to content

Instantly share code, notes, and snippets.

View mchayapol's full-sized avatar

Chayapol Moemeng mchayapol

View GitHub Profile
@mchayapol
mchayapol / table-layout.html
Created August 25, 2015 03:23
Sample HTML Table layout
<!DOCTYPE html>
<html>
<head>
<style>
td {
//border: 1px solid black;
}
body {
font-family: arial;
@mchayapol
mchayapol / test.html
Created September 7, 2015 02:46
Test JQuery
<!DCOTYPE html>
<head>
<title>Test</title>
<script src="js/jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function () {
document.getElementById('div1').innerHTML = "Hello";
$('#div2').html("Hello");
@mchayapol
mchayapol / index.html
Last active September 7, 2015 03:52
WIP Contact App with JQuery
<!DCOTYPE html>
<head>
<title>Contacts</title>
<script src="js/contact.js"></script>
<script src="js/jquery-1.11.3.min.js"></script>
<script>
function restoreUI() {
var divList = document.getElementById('divList');
@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');
@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 / 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 / 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 / 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 / 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 / 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;