Skip to content

Instantly share code, notes, and snippets.

@haruta
haruta / video_controls_layout_ng.html
Last active August 29, 2015 14:14
なんか、Android の標準ブラウザ(私が確認したのは ARROWS A 202F と Xperia A SO-04E) でなぜか video タグの controls が input タグに対する CSS の width と height の設定が効いちゃうんだけど、そういうもんなの。。。
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<style>
input {
/* なぜか この CSS が当たってるっぽく、レイアウトが崩れる */
height: 40px;
width: 100%;
}
@haruta
haruta / gist:7557db295adede302a5d
Last active August 29, 2015 14:06
youtube で loop 再生させる
document.getElementsByTagName('video')[0].addEventListener('ended', function(e){ e.target.play(); });
@haruta
haruta / gist:5411458
Created April 18, 2013 09:33
add_hidden.php
<html>
<head>
<script language="javascript" type="text/javascript">
window.onload = function() {
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) {
var new_hidden = document.createElement('input');
new_hidden.type= 'hidden';
new_hidden.name = "input_key";
new_hidden.value = document.getElementById('input_key_source').value;
mysql> desc (SELECT * FROM users WHERE email_pc='[email protected]' AND deleted=0) UNION (SELECT * FROM users WHERE email_mobile='[email protected]' AND deleted=0) \G
*************************** 1. row ***************************
id: 1
select_type: PRIMARY
table: users
type: const
possible_keys: email_pc
key: email_pc
key_len: 264
ref: const,const
<?php
class YmLinerTest
{
public function test(array $array)
{
sort($array);//一応ソート
$date = new DateTime($array[0].'01');
foreach ($array as $ym) {
if ($date->format('Ym') != $ym) return false;
@haruta
haruta / maxlength.html
Created January 31, 2013 07:51
galaxy nexus で maxlenght値=value値の長さ のフォームの場合フォームに対して一切入力できなくなるっぽい。
<html>
<body>
<form action="" method="post">
exists maxlength: <input type="text" name="age" value="99" maxlength="2" /><br />
textarea: <textarea name="test"></textarea><br />
not exists maxlength: <input type="text" name="zip" value="" /><br />
</form>
</body>
</html>
@haruta
haruta / gist:4248291
Created December 10, 2012 03:50
storeEval で保存したデータをassertで使う
<tr>
<td>storeEval</td>
<td>this.page().getDocument().forms[0]['enc'].value</td>
<td>enc</td>
</tr>
<tr>
<td>assertValue</td>
<td>name=enc</td>
<td>${enc}</td>
</tr>
@haruta
haruta / chatwork-to-all-helper.user.js
Created November 30, 2012 05:50
チャットワークで "@@" "@@" をチャンネル全員のTOに置き換えるchromeのユーザースクリプト
// ==UserScript==
// @name chatwork to all helper
// @match https://www.chatwork.com/*
// @version 1.1
// ==/UserScript==
(function(){
document.getElementById('cw_chattext').addEventListener('blur', function(e){
if (/[@@]{2}/.test(e.target.value)) {
var to_list = [];
var imgs = document.getElementById('cw_mention_gallery').getElementsByTagName('img');
@haruta
haruta / gist:3871202
Created October 11, 2012 09:18
git-current
#!/bin/sh
# usage:
# git current で現在のブランチ名を表示する
git branch | grep '*' | sed 's/* //'
@haruta
haruta / gist:3630938
Created September 5, 2012 05:16
assert input field and value by symfony2 unit test
protected function assertInuptValue($crawler, $key, $val)
{
$input = $crawler->filter('input[name="'.$key.'"]');
$this->assertEquals(
$val, $input->attr('value'), $key.' failed'
);
}
protected function assertSelectValue($crawler, $key, $val)
{