Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript" src="chimpo.js"></script>
<button onclick="chimpo()">「ちんぽ」表示</button>
@mgng
mgng / recentshow.mp3.markdown
Last active February 26, 2022 12:20
convex level recentshow.mp3 set list
rem --------------------------------------------------------
rem Echofon for Firefox の sqlite をお掃除するバッチ
rem --------------------------------------------------------
@echo off
echo *** 実行するよー
pause
setlocal
@mgng
mgng / resize_exif_delete.php
Created August 17, 2015 05:54
画像リサイズおよびexifの削除処理
<?php
$blob = getResizedImageBlob("./sample.png", 100, 200);
file_put_contents("sample_100x200.png", $blob);
/**
* @param string $img_path 画像ファイルパス
* @param string int $w_re リサイズ後の幅
* @param string int $h_re リサイズ後の高さ
* @return string
@mgng
mgng / check.php
Created March 19, 2012 02:03
PHPで機種依存文字をチェック
<?php
function check($s){
return strlen($s) !== strlen(mb_convert_encoding(mb_convert_encoding($s,'SJIS','UTF-8'),'UTF-8','SJIS'));
}
@mgng
mgng / fetchUrl_gzip.php
Last active February 8, 2021 14:09
file_get_contents で Accept-Encoding:gzip 指定
<?php
function fetchUrl( $url, $gzip = false ) {
$raw = file_get_contents( $url, false, $context = stream_context_create( array(
'http' => array(
'method' => 'GET',
'header' => 'Accept-Encoding:' . ( $gzip ? 'gzip,deflate' : 'identity' ) . "\r\n",
)
) ) );
if ( $raw === false ) {
@mgng
mgng / 1.php
Created December 21, 2012 14:42
Redis で prefix つけると、キー一覧引っ張ってきてループ処理するときに面倒
<?php
$prefix = 'TEST:';
$redis = new Redis();
$redis->connect( '127.0.0.1', 6379 );
$redis->setOption( Redis::OPT_PREFIX, $prefix );
// set
$redis->set( 'key1', 'val1' );
$redis->set( 'key2', 'val2' );
$redis->set( 'key3', 'val3' );
@mgng
mgng / parse_csv.php
Last active October 4, 2020 04:18
csv file parser for windows/unix
<?php
/**
* @param string $file Shift_JIS の csv ファイルパス
* @return array
*/
function parseCsv($file)
{
$str = file_get_contents($file);
$is_win = strpos(PHP_OS, "WIN") === 0;
@mgng
mgng / imagewave.php
Last active July 8, 2019 05:33
how to create a wave image by PHP(GD)
<?php
/**
* @param resource $img
* @param int $width
* @param int $height
* @param int $period
* @param int $amplitude
* @return resource
*/
function imageWave($img, $width, $height, $period = 10, $amplitude = 5) {
@mgng
mgng / 隠されている.markdown
Last active April 9, 2019 04:20
隠されている
  • 麻婆豆腐には暴動が隠されている
  • 松田聖子には惰性が隠されている
  • キッコーマンにはコーマンが隠されている
  • サンフランシスコには腐乱死が隠されている
  • アリアナ・グランデには名倉が隠されている
  • 向井秀徳には異臭が隠されている
  • 宇都宮には鬱と飲み屋が隠されている
  • カフェラテにはフェラが隠されている
  • 浅井健一にはサイケと権威が隠されている
  • バイキングにはばい菌が隠されている