Skip to content

Instantly share code, notes, and snippets.

View HyodaKazuaki's full-sized avatar

Hyoda Kazuaki HyodaKazuaki

View GitHub Profile
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?/$1 [QSA,L]
</IfModule>
@HyodaKazuaki
HyodaKazuaki / URL
Created September 19, 2016 04:37
GETとPATHINFO
# GETの場合
http://example.jp/example.php?query=data
# PATHINFOの場合
http://example.jp/example.php/data
@HyodaKazuaki
HyodaKazuaki / PATHINFO_URL
Created September 19, 2016 04:38
やりたいこと
# やりたいこと
http://example.jp/data
@HyodaKazuaki
HyodaKazuaki / PATHINFO_EXAMPLE2
Created September 19, 2016 04:41
PATHINFO成功と失敗
http://example.jp/index.php/hoge # 成功
http://example.jp/hoge # 失敗
@HyodaKazuaki
HyodaKazuaki / PATHINFO_EXAMPLE
Last active September 19, 2016 04:41
PATHINFOの例
# 例
http://example.jp/hoge/fuga.php # この場合は、hogeディレクトリ下のfuga.phpが呼び出される
http://example.jp/hoge.php/fuga # こうなると、hoge.phpディレクトリ下のfugaが存在しない場合、hoge.phpが呼び出され、/fugaはPATHINFOになる
@HyodaKazuaki
HyodaKazuaki / PATHINFO_EXAMPLE3
Created September 19, 2016 04:42
PATHINFOの注意
http://example.jp/hoge # これを以下のように変換している
http://example.jp/index.php?hoge # 説明したPATHINFOの形と違う
@HyodaKazuaki
HyodaKazuaki / index.html
Created November 22, 2016 13:17
JavaScriptでイベントの伝播を止めつつonclickの内容を書き換える
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
</head>
<body onclick="console.log('0');">
<div onclick="console.log('1');">
<p onclick="console.log('2');">test</p>
</div>
<script src="./main.js"></script>
@HyodaKazuaki
HyodaKazuaki / PrimeNumber.cs
Last active January 12, 2017 09:22
逐次実行の素数計算
Console.Write("求めたい値を入力 >");
string target_str = Console.ReadLine();
long target = long.Parse(target_str);
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
bool flg = false;
sw.Start();
long i = 2;
for (i = 2; i < target / i; i++)
{
@HyodaKazuaki
HyodaKazuaki / ParallelPrimeNumber.cs
Created January 12, 2017 09:37
並列化した素数計算プログラム
Console.Write("求めたい値を入力 >");
string target_str = Console.ReadLine();
long target = long.Parse(target_str);
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
bool flg = false;
sw.Start();
Parallel.For(2, 8202464, (i, loopstate) => {
if(target % i == 0)
{
@HyodaKazuaki
HyodaKazuaki / hello.cpp
Last active July 13, 2017 15:39
C++でのCGIプログラム
#include <stdio.h>
#include <stdarg.h>
template <typename ... Args>
void cprintf(const char *format, Args const & ... args);
int main(void)
{
cprintf("Content-type: text/html");
cprintf("");