Skip to content

Instantly share code, notes, and snippets.

View omoon's full-sized avatar

Sotaro OMURA omoon

View GitHub Profile
@omoon
omoon / mysql_pdo.md
Last active February 12, 2017 04:45

PHP 7.0.15 / MySQL 5.6.35

When you fetch 16777212 byte data from MySQL database via pdo, a null byte character seems to be added to the end of the data.

database

CREATE TABLE `test` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `data` longtext,
@omoon
omoon / file0.txt
Last active August 29, 2015 14:19
RubyMotion CMTimeMake 64bit でこける ref: http://qiita.com/omoon/items/9452bc36f1dd5876831c
$ motion --version
3.8
@omoon
omoon / file0.php
Created September 25, 2014 07:42
Laravel で Model オブジェクトを新規データとしてコピーする ref: http://qiita.com/omoon/items/f548453efcabec68f101
$user = User::find(1)
$new_user = $user->replicate();
$new_user->name = 'new name';
$new_user->save();
@omoon
omoon / file0.txt
Created February 28, 2014 14:40
【RubyMotion】UITableView セルをスワイプしたら消したりするののオンオフ ref: http://qiita.com/omoon/items/44917481cfce66d85d94
def tableView(tableView, canEditRowAtIndexPath:indexPath)
if (hoge == true)
return true
else
return false
end
end
@omoon
omoon / file0.txt
Created February 28, 2014 11:39
【RubyMotion】iOS で Simulator かどうかを判定する方法 ref: http://qiita.com/omoon/items/1279e7e530bf17050e50
def isSimulator
UIDevice.currentDevice.model.hasSuffix "Simulator"
end
@omoon
omoon / Gmail CSS
Last active December 26, 2015 22:49
* {
font-family:"ヒラギノ丸ゴ Pro W4","Hiragino Maru Gothic Pro";
}
.aim {
font-size:13px;
}
.aeF, .gt, table.F td {
font-size:14px;
}
.Al, textarea.Ak {
<?php
$value_1 = rand(1, 10);
$value_2 = rand(1, 10);
if($_SERVER["REQUEST_METHOD"] == "POST"){
if ($_POST['value_1'] + $_POST['value_2'] == $_POST['answer']) {
$kekka = 'ピンポーン!天才!';
} else {
$kekka = 'ブブー!アホりー!';
}
} else {
@omoon
omoon / gist:4231682
Created December 7, 2012 08:08
source.html
<form action="http://localhost:8080/post_url" method="post" id="form_sample" accept-charset="utf-8">
<input name="fuel_csrf_token" value="c9313a400c254e58c0d23f7fd599c297" type="hidden" id="form_fuel_csrf_token" />
<h2>何歳やねん?</h2>
<table class="table table-bordered">
<tr>
<th class="span2">年齢</th>
<td><input type="text" class="input-medium" style="ime-mode:disabled" id="form_age" name="age" /> 歳</td>
</tr>
</table>
@omoon
omoon / sample.php
Created December 7, 2012 03:43
sample view
<?php echo $form['open']; ?>
<h2>何歳やねん?</h2>
<table class="table table-bordered">
<tr>
<th class="span2"><?php echo $form['age']['label'];?></th>
<td><?php echo $form['age']['html'];?> 歳</td>
</tr>
</table>
@omoon
omoon / gist:4230585
Created December 7, 2012 03:42
sample.php
class Controller_Welcome extends Controller
{
public function action_index()
{
$fieldset = Myfieldset::forge('sample');
$fieldset->addTextForNumeric('age', '年齢');
$fieldset->addRadioWithBr('gender', '性別', array(1 => '男', 2 => '女'));
$fieldset->addRadioInline('season', '一番好きな季節', array(1 => '春', 2 => '夏', 3 => '秋', 4 => '冬'));
$view = View::forge('welcome/index');
$view->set_safe(array('form' => $fieldset->getFormElements('post_url')));