This file contains hidden or 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 | |
| /** | |
| * @param array $a | |
| * @return string | |
| */ | |
| function array_to_base64_encode( array $a ) { | |
| $table = preg_split('//', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', -1, PREG_SPLIT_NO_EMPTY); | |
| $l = count($a); | |
| $m = $l % 3; |
This file contains hidden or 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 | |
| /** | |
| * @param string $str | |
| * @return array | |
| */ | |
| function array_from_base64_decode( $str ) { | |
| $table = preg_split('//', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', -1, PREG_SPLIT_NO_EMPTY); | |
| $data = array(); | |
| for( $i=0, $l=count($table); $i<$l; $i++) { | |
| $data[$table[$i]] = $i; |
This file contains hidden or 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 | |
| $img = new \Imagick(); | |
| $img->readImageBlob( file_get_contents( "./test.jpg" ) ); | |
| $img->setFormat( "ico" ); | |
| // ↑ Fatal error: Uncaught exception 'ImagickException' with message 'no decode delegate for this image format ... |
This file contains hidden or 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 | |
| $user_id = "parishilton"; | |
| $json = json_decode( file_get_contents( "http://instagram.com/{$user_id}/media" ) ); | |
| $results = array(); | |
| foreach( $json->items as $item ) { | |
| $results[] = array( | |
| "link" => $item->link, | |
| "created_time" => $item->created_time, | |
| "thumbnail_url" => $item->images->thumbnail->url, |
This file contains hidden or 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
| $.ajax({ | |
| url : "http://rekognition.com/func/api/", | |
| data : { | |
| api_key : "YOUR API KEY", | |
| api_secret : "YOUR API SECRET", | |
| jobs : "face_aggressive_gender_emotion_age_race", | |
| urls : "http://livedoor.blogimg.jp/onsokuch/imgs/a/5/a561eb29.jpg" | |
| }, | |
| type : 'POST', | |
| dataType: "json" |
This file contains hidden or 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
| Version: ImageMagick 6.8.1-0 2012-12-17 Q16 http://www.imagemagick.org | |
| Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC | |
| Features: OpenMP | |
| #1 : 1.4550831317902 | |
| #2 : 0.72604203224182 | |
| #3 : 0.45802593231201 |
This file contains hidden or 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
| // 先頭セミコロンは直前のプログラムを明示的に終わらせるためのおまじないみたいなもんだから別にかかなくてもいい | |
| ;$(function(){ | |
| // 当然 use strict | |
| 'use strict'; | |
| // jQuery オブジェクトは $ を付けて他の変数と区別 | |
| var $name = $("#id_name"); | |
| var name = $name.val(); |
This file contains hidden or 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
| <p><button id="id_100x100_download">100x100でダウンロード</button></p> | |
| <p><img id="id_original_image" src="/img/sample.jpg" alt="" /></p> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
| <script> | |
| ;$(function(){ | |
| 'use strict'; | |
| $("#id_100x100_download").on("click.download", function(){ |
This file contains hidden or 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 | |
| // 接続 | |
| $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' => [ |
This file contains hidden or 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 | |
| // twitpic ダウンロードするやつ | |
| // 使い方は $screen_name を保存したいアカウント名に変更してコンソールから以下コマンド実行 | |
| // php twitpic_downloader.php | |
| set_time_limit( 0 ); | |
| // 設定 | |
| $screen_name = "mugng"; // twitpicのアカウント名 |
OlderNewer