Skip to content

Instantly share code, notes, and snippets.

@mgng
mgng / im_kayac.php
Last active October 23, 2015 04:18
im.kayac.com post test
<?php
// im.kayac.com 送信テスト
$api_url = "http://im.kayac.com/api/post/あなたのユーザ名";
$password = "設定したパスワード";
// $secret_key = "設定した秘密鍵";
$message = "日本語メッセージテスト!\n改行あるとどうなる?";
$content = http_build_query(array(
@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 / 隠されている.markdown
Last active April 9, 2019 04:20
隠されている
  • 麻婆豆腐には暴動が隠されている
  • 松田聖子には惰性が隠されている
  • キッコーマンにはコーマンが隠されている
  • サンフランシスコには腐乱死が隠されている
  • アリアナ・グランデには名倉が隠されている
  • 向井秀徳には異臭が隠されている
  • 宇都宮には鬱と飲み屋が隠されている
  • カフェラテにはフェラが隠されている
  • 浅井健一にはサイケと権威が隠されている
  • バイキングにはばい菌が隠されている
@mgng
mgng / gist:8017cf34157aa896eed8
Last active August 29, 2015 14:23
ファイル単位でのアクセス拒否
# test.php をアクセス拒否する場合
<Files "test.php">
Order allow,deny
Deny from all
</Files>
# 先頭が _ や . で始まるファイルをアクセス拒否する場合は「Files ~ "正規表現"」で記述
<Files ~ "^(_|\.)">
Order allow,deny
Deny from all
@mgng
mgng / cbjs.md
Last active July 5, 2016 07:54
FDPH

Compiled by John Sleep

title / artist / album

Wave

  1. I Like It / DeBarge
  2. Digital Love / Daft Punk
  3. A Night To Remenber / Shalamar
  4. Closer... / Slum Village
@mgng
mgng / twitter_user_id_2_screen_name.php
Created October 7, 2014 02:57
twitter user_id <=> screen_name convert
<?php
$user_id = "5168731";
$screen_name = "mugng";
var_dump(
u2s( "5168731" ), // string(5) "mugng"
s2u( "mugng" ) // string(7) "5168731"
);
@mgng
mgng / Photozou.php
Created September 12, 2014 08:10
フォト蔵 API 使って画像をアップロードするやつ
<?php
/**
フォト蔵 API 使って画像をアップロードするやつ
Usage:
$userid = "フォト蔵に登録したメールアドレス";
$password = "パスワード";
$Photozou = new \Photozou( $userid, $password );
// パラメータ詳細は http://photozou.jp/basic/api_method_photo_add を参照
@mgng
mgng / rss_demo.php
Created September 10, 2014 00:15
rss_demo.php
<?php
$rss = file_get_contents( "http://instagrss-mgng.rhcloud.com/parishilton" );
$xml = simplexml_load_string( $rss );
foreach( $xml->channel->item as $item ) {
print_r( array(
"title" => (string)$item->title,
"link" => (string)$item->link,
"description" => (string)$item->description,
"subject" => (string)$item->children("dc", true)->subject,
@mgng
mgng / twitpic_downloader.php
Last active August 29, 2015 14:06
twitpicからダウンロードするやつ
<?php
// twitpic ダウンロードするやつ
// 使い方は $screen_name を保存したいアカウント名に変更してコンソールから以下コマンド実行
// php twitpic_downloader.php
set_time_limit( 0 );
// 設定
$screen_name = "mugng"; // twitpicのアカウント名
@mgng
mgng / mongo_setoninsert.php
Last active August 29, 2015 14:05
MongoDB $setOnInsert
<?php
// 接続
$dns = "mongodb://localhost:27017";
$Mongo = new \MongoClient( "mongodb://localhost:27017" );
$table = $Mongo->selectCollection( "testdb", "table" );
// user_id = mgng のデータがあれば update, なければ insert ( upsert )
$where = [ 'user_id' => 'mgng' ];
$set = [
'$set' => [