Skip to content

Instantly share code, notes, and snippets.

View omas's full-sized avatar

Omas Naohiko omas

  • Private
  • Okinawa, Japan
View GitHub Profile
<!DOCTYPE html>
<!--
1.コマンドラインに入力を待ち受けるための「>」を表示する。
2.標準入力された値があればそのまま表示、値がなければ「未入力です」と表示して、再び入力待ち受け状態にする。
3.「EXIT」が入力された時点でプログラムを終了する。
-->
<script>
(function(){
while(true){
@omas
omas / odd.html
Last active August 29, 2015 14:03
ネタ系です,良い子は真似してはいけません!
<!DOCTYPE html>
<script>
(function main(){
var input = Math.abs(Number(prompt("数字をいれてね")));
if (isOdd(input)) {
output(input + " is odd");
} else {
output(input + " is even");
@omas
omas / chap03.js
Last active August 29, 2015 14:03
function HowOldAreYou(){
var messages = [
"あなたの名前を入力してください。"
,"あなたの年齢を入力してください。"
];
var name = prompt(messages[0]);
output(name + "さんこんにちは。");
var age = Number(prompt(messages[1]));
output("いま " + age + " 歳とすると、10年後は " + (age + 10) + " 歳ですね。");
function Calc1(){
output(add(3,2));
output(sub(5,8));
output(mul(3,4));
output(div(7,3));
}
function add(num1,num2){
return [
"加算の結果は"
function Aisatsu(){
var messages =[
"おはよう"
,"こんにちは"
,"こんばんは"
];
for (var index in messages) {
output(messages[index]);
}
ul>li {
list-style-type: none;
}
ul>li:nth-child(3n):after {
content: "Fizz";
}
ul>li:nth-child(5n):after {
content: "Buzz";
}
/*
<program>
<summary>ケンシロウバージョン</summary>
<version>1.0</version>
<date>2014/06/19</date>
<author>omas</author>
<file>fizzbuzz.js</file>
<usage>jeek用</usage>
</program>
*/
@omas
omas / strip.sh
Last active August 29, 2015 14:02
html の タグを除去
#!/bin/bash
cat $1 \
| sed -e "s/\r//g" \
| tr "\n" "@" \
| sed -e "s/<script>[^<]*<\/script>//g" \
| sed -e "s/<style>[^<]*<\/style>//g" \
| sed -e "s/<!--[^<]*-->//g" \
| sed -e "s/&nbsp;//g" \
| sed -e "s/&gt;/>/g" \
a {
color: #017acd;
}
/* コンテナ */
div#container {
width: 760px;
margin-left: auto;
margin-right: auto;
}
// 宿題 06/16:0900