Skip to content

Instantly share code, notes, and snippets.

View thaiall's full-sized avatar

burin rujjanapan thaiall

View GitHub Profile
@thaiall
thaiall / for_for_in_java.java
Last active October 2, 2016 13:26
โปรแกรมทำงานซ้ำซ้อนกัน แล้วหาจำนวนรอบที่เกิดขึ้นทั้งหมด
class Demo
{
public static void main (String[] args)
{
int i,j;
int sum = 0;
for(i=1;i<5;i++)
for(j=1;j<i;j++) sum++;
System.out.println(sum);
}
@thaiall
thaiall / for_for_count_round.html
Created October 1, 2016 08:19
โปรแกรมทำงานซ้อนกัน แล้วหาจำนวนรอบที่เกิดขึ้นทั้งหมด ด้วย javascript
<script>
var cnt = 0;
for(var i = 1; i <= 3; i++)
for(var j = 1; j <= i; j++) {
cnt=cnt + 1;
document.write(j + "<br>");
}
document.write("output="+cnt);
</script>
@thaiall
thaiall / for_for_count_round.c
Created October 1, 2016 08:22
โปรแกรมทำงานซ้อนกัน แล้วหาจำนวนรอบที่เกิดขึ้นทั้งหมด ด้วย ภาษา C
#include <stdio.h>
int main() {
int sum = 0;
for(int i=1;i<5;i++)
for(int j=1;j<i;j++) sum++;
printf("count= %d",sum);
return 0;
}
@thaiall
thaiall / factorial_by_javascript.htm
Created October 2, 2016 04:23
Factorial คือ การกระทำกับค่าเลขจำนวนเต็มบวก ที่จะนำมาคูณกันตั้งแต่ 1 ถึง ค่าจำนวนเต็มนั้นๆ
<script>
var myv = fac(5);
document.write(myv);
function fac(v) {
if(v == 0)
return 1;
else
return(v * fac(v - 1));
}
@thaiall
thaiall / plus_number_in_javascript.htm
Created October 3, 2016 09:58
put 2 number in window prompt and use plus operator with number converting by parseInt function
<script>
var x = window.prompt("put a number")
var y = window.prompt("put another number")
var z = parseInt(x) + parseInt(y);
window.alert(z);
</script>
@thaiall
thaiall / choose_even_in_array.htm
Created October 12, 2016 01:48
get number value to store in array and do loop to process and choose from array.
<script>
var ar = new Array();
ar[0] = window.prompt("put a number"); // 3
ar[1] = window.prompt("put a number"); // 4
ar[2] = window.prompt("put a number"); // 5
ar[3] = window.prompt("put a number"); // 6
ar[4] = window.prompt("put a number"); // 7
window.alert(ar.length); // 5
var keep = "";
for (idx in ar) { keep += ar[idx]; }
@thaiall
thaiall / blackandwhitecss_html
Last active October 14, 2016 08:28
พบการแชร์ CSS code สำหรับเปลี่ยน webpage เพื่อไว้ทุกข์ ดังนั้นหากท่านใด ต้องการใส่ตัวกรองให้กับ webpage ให้เป็นสีขาวดำ (if you want to use filter to change webpage for grayscale mode) ทำได้โดยเพิ่ม code ของ CSS (Cascading Style Sheets) เข้าไปใน webpage ซึ่งแต่ละ browser อาจยอมรับคำสั่งแตกต่างกันไป ซึ่งคำสั่งสำคัญ คือ filter
<style type="text/css">
* {
-moz-filter:grayscale(100%); /* firefox */
-webkit-filter:grayscale(100%); /* safari, chrome */
filter:gray; /* IE6-9 */
filter:grayscale(100%);
}
</style>
@thaiall
thaiall / Test20Bold_webpagefiltered2010
Created November 19, 2016 00:29
เว็บเพจที่สร้างด้วย ms word 2010 แสดงคำว่าทดสอบ และเป็นตัวหนา แล้วบันทึกเป็น webpage
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-874">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 14">
@thaiall
thaiall / life_program
Created November 29, 2016 06:09
ชีวิตของมนุษย์มีทางเลือกมากมาย สามารถโปรแกรมได้แตกต่างกันหลายแบบ นี่คือโปรแกรมรุ่นแรก รักใครก็ต้องดูแลคนนั้น นำเสนอผ่าน pseudocode
if (รักลูก = true) { do(ดูแลลูก) }
if (รักแฟน = true) { do(ดูแลแฟน) }
if (พ่อแม่รักเรา = true) { do(พ่อแม่ดูแลเรา) }
if (รักพ่อแม่ = true) { do(ดูแลพ่อแม่) }
if (รัก x = true) { do(ดูแล x ) }
@thaiall
thaiall / rsp61s.css
Created December 4, 2016 06:14
ตัวอย่างแฟ้ม css ที่ใช้สำหรับ thaiall.com/webmaster/responsive ทั้ง 3 แฟ้ม ประกอบการอบรม ความรู้เบื้องต้นสำหรับเว็บมาสเตอร์
/* ปรับปรุง : 2559-12-04 */
#main{background-color:#000099;font-family:microsoft sans serif;font-size:12px;margin:0px 0px 0px 0px}
fieldset{margin:10px 0px 0px 0px;padding:0px}
legend{background-color:#444444;color:#ffffdd;font-size:14px;display:block;padding-left:5px;padding-right:10px;border:2px solid #f9f9f9}
.topbar{width:100%;font-size:20px;background-color:black;color:white;text-align:center;height:90px;padding:0px;border-spacing:0px;border-style:none}
.topbar a:link, .topbar a:visited{color:#aaffaa;text-decoration:none}
.topbar td {text-align:center}
.foot_text{color:yellow;text-decoration:none}
.m_still{width:728px;background-color:white;margin-left:auto;margin-right:auto;padding:0px;border-spacing:0px}
.m_hidden{width:728px;vertical-align:top;margin:0px 0px 0px 0px;margin-left:auto;margin-right:auto;padding:0px;border-spacing:0px}