Skip to content

Instantly share code, notes, and snippets.

@bzz0217
bzz0217 / get_csv.php
Last active May 3, 2016 13:44
CSVを取得し配列に変換
<?php
class get_csv{
public $file;
public $from_encoding;
/*
* @param string filepath ファイルパス
* @param string from_encoding CSVファイルの文字コード
*/
public function __construct($filepath, $from_encoding = "SJIS"){

スライドショーがwebで簡単に作れるサービスの紹介


#スライドショー作るときの不満


  • スライドショー作成といったらパワーポイント
  • ちょっとした発表を、パワーポイントで作るのが大変
@bzz0217
bzz0217 / cache.php
Last active December 26, 2019 01:31
簡易キャッシュ
<?php
class cache{
public static $config = [
'filepath' => '.cache',
'expire_min' => '60'
];
private $modified_datetime;
private $expiration_time_flg;
@bzz0217
bzz0217 / get_githubapi_auth.php
Last active January 3, 2016 09:43
github api oauth認証してデータを取得する
<?php
$options = array(
'http'=>array(
'method' => 'GET',
'header' => array(
'Authorization: token [API_TOKEN]',
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36',
)
)
);
<?php
//Template Methodパターン
abstract class test {
//継承先で必ず実装が必要なメソッド
abstract function main();
private $num = 0;
protected function plus($a, $b){
return $this->num = $a + $b;
@bzz0217
bzz0217 / qiita_items_dbregister.php
Last active December 12, 2015 19:17
QiitaAPIで取得した記事情報・ユーザ情報をDB登録
<?php
ini_set("display_errors", 1);
error_reporting(-1);
ini_set("max_execution_time", 0);
require 'vendor/autoload.php';
$app = new \Slim\Slim(array(
'debug' => true
));
@bzz0217
bzz0217 / view.php
Created November 9, 2015 15:59
画像一覧
<?php
function imglist($path){
$img = array();
$imglist = array();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("{\d+_.*?\.jpg}", $file)){
$imglist[] = $file;
}
@bzz0217
bzz0217 / crawler.sh
Created November 9, 2015 15:58
画像スクレイピング
#!/bin/bash
output_path="/var/www/html/m/"
nsurl="http://purl.org/rss/1.0/modules/content/"
rssurl="http://minkch.com/feed"
# 昨日 (UNIXTIME)
yesterday=`date -d '1 days ago' +'%s'`