This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#!coding: utf-8 | |
import sys, os, re, shutil | |
from optparse import OptionParser | |
parser = OptionParser(usage= | |
'''%prog [options] <target-dir> | |
Example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo "$0 <git-commit>" 1>&2 | |
exit 1 | |
fi | |
git diff --name-status $1 | |
read -p "Press any key to execute..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* コードによるクリップボードイベントの生成はブラウザ実装によってまったく違う。 | |
* | |
* Gekko 系 (Firefox) はコンストラクタの clipboardData 初期値を無視するが、 | |
* 生成されたイベントオブジェクトの clipboardData には空の DataTransfer が | |
* 入っている。データ入りの DataTransfer を事前準備できない。 | |
* | |
* WebKit 系 (Chrome, Safari, Edge) は、clipboardData の初期値をコンストラクタに | |
* 与えないと clipboardData = null になっている異常なオブジェクトを作ってしまう。 | |
* こちらはデータ入りの DataTransfer を最初から与えても OK。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @method assertEquals(mixed $expected, mixed $actual, string $message) | |
*/ | |
trait AssetHtmlTrait | |
{ | |
public function assertHtmlStringEqualsHtmlString(string $expectedHtml, string $actualHtml, string $message = ''): void | |
{ | |
$expected = (new \PHPUnit\Util\Xml\Loader)->load( | |
$this->cleanHtml($expectedHtml), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Charset | |
$domesticCharset = 'iso-2022-jp'; | |
$universalCharset = 'utf-8'; | |
// Encoders | |
$headerEncoderBase64 = new \Swift_Mime_HeaderEncoder_Base64HeaderEncoder(); | |
$contentEncoder7bit = new \Swift_Mime_ContentEncoder_PlainContentEncoder('7bit'); | |
$contentEncoderBase64 = new \Swift_Mime_ContentEncoder_Base64ContentEncoder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Symfony\Bundle\MakerBundle\Doctrine; | |
final class DoctrineHelper | |
{ | |
/** | |
* @return MappingDriver|LegacyMappingDriver|null | |
* | |
* @throws \Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Pythonは手続きだと逆にこういうダサさがあるのよね | |
def _tmp(e): | |
if e % 15 == 0: return "fizzbuzz" | |
elif e % 3 == 0: return "fizz" | |
elif e % 5 == 0: return "buzz" | |
else: return e | |
print map(_tmp, range(1, 100+1)) | |
#分解 | |
def fizzbuzz(n): "fizzbuzz" if isinstance(n, int) and n % 15 == 0 else n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/** | |
* Try: bin/genuuid4.php 65536 | sort | uniq -d | |
*/ | |
class UuidV4 | |
{ | |
const VERSION = 4; | |
const VARIANT = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($cells $ $cell) { | |
// | |
switch ($tdcnt++ % 3) { | |
case 0: | |
$cls = 'c_td1'; | |
break; | |
case 1: | |
$cls = 'c_td2'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shop import Item, Shop | |
shop = Shop('イオン ドームシティ店') | |
cart = shop.cart() | |
cart.add(Item.MILK) | |
# TODO implement more | |
receipt = shop.paycheck(cart) |
NewerOlder