Skip to content

Instantly share code, notes, and snippets.

View ifukazoo's full-sized avatar

ifukazoo ifukazoo

View GitHub Profile
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>JavaScript</title>
<style type="text/css" media="all">
h1,h2 {
color: blue;
font-style: italic;
}
#!/usr/bin/env node
'use strict';
var http = require('http');
var url = require('url');
var fs = require('fs');
var mime = require('mime');
var exec = require('child_process').exec;
var port = 20080;
(function() {
window.onload = function() {
/* 15.9 HTMLフォーム */
(function() {
document.forms['submitForm'].onsubmit = function() {
var text = document.forms['textForm']['mytext'].value;
if (text.match(/^\d+$/)) {
alert('送信しました');
return true;
}
#! /usr/bin/ruby -w
# encoding: utf-8
#
def get_info(path)
Info.new(path)
end
class Info
def initialize(path)
@path = path
String.prototype.splitN = function (n) {
var a = [];
var begin = 0;
var i = 0;
for (; i < this.length; i++) {
if (i !== 0 && i % n == 0) {
a.push(this.substring(begin, i));
begin = i;
}
#! /usr/bin/env node
var http = require('http');
var querystring = require('querystring');
function queryAnswer(str) {
var options = {
host: 'spacetalky.textfile.org',
method: 'GET'};
@ifukazoo
ifukazoo / spacetalky.js
Created April 29, 2014 08:02
spacetalky問題回答
#! /usr/bin/env node
var fs = require('fs');
var readline = require('readline');
if (process.argv.length !== 3) {
console.log("usage:command <file path>");
process.exit(1);
}
@ifukazoo
ifukazoo / spacetalky.hs
Created April 29, 2014 08:03
spacetalky問題回答
import System.Environment
import System.Exit
import Control.Monad
import Data.Char
import qualified Data.List as List
main = do
argv <- getArgs
when (length argv /= 1) $ do
putStrLn "usage:command filename"
@ifukazoo
ifukazoo / answer_check.js
Created April 29, 2014 08:10
spacetalky問題回答 チェック
#! /usr/bin/env node
var http = require('http');
var fs = require('fs');
var querystring = require('querystring');
function queryAnswer(str, expect) {
var options = {
host: 'spacetalky.textfile.org',
method: 'GET'};
@ifukazoo
ifukazoo / static_server.js
Last active August 29, 2015 14:00
静的webサーバ
#! /usr/bin/env node
var filePath = process.argv[2];
var connect = require('connect'),
http = require('http'),
child_process = require('child_process'),
port = '',
directory = '.';
if (process.argv.length !== 3) {