Skip to content

Instantly share code, notes, and snippets.

@mly520
mly520 / gist:cd2ec9a19c603a3e35ea
Last active August 29, 2015 14:02
開発環境 vhost.conf
<VirtualHost *:80>
ServerAdmin ○○○○@○○○○.○○○
ServerName ○○○○.○○○
ServerAlias *.○○○○.○○○
VirtualDocumentRoot /home/webroot/%1/htdocs/
ErrorLog logs/○○○○.○○○-error_log
CustomLog logs/○○○○.○○○-access_log common
</VirtualHost>
@mly520
mly520 / gist:011d413fd8652a8b1785
Created September 10, 2014 08:26
sublime text update_check
You can add this entry in your /etc/hosts file:
127.0.0.1 www.sublimetext.com
<?php
function mb_wordwrap($string, $width=75, $break="\n", $cut = false) {
if (!$cut) {
$regexp = '#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$width.',}\b#U';
} else {
$regexp = '#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$width.'}#';
}
$string_length = mb_strlen($string,'UTF-8');
$cut_length = ceil($string_length / $width);
$i = 1;
@mly520
mly520 / SendAttachedMail
Created March 25, 2015 03:33
SendAttachedMail 日本語
?php
function SendAttachedMail( $from , $to , $subject , $body , &$file ){
mb_language( 'ja' );
@mly520
mly520 / ImageGd.php
Created June 26, 2013 11:15
CI gd libaray
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ImageGd
{
public function convert_en($im1)
{
$w = imagesx($im1);
$h = imagesy($im1);
@mly520
mly520 / calendar_lang.php
Created June 26, 2013 11:30
php ci language
<?php
$lang['cal_su'] = "日";
$lang['cal_mo'] = "月";
$lang['cal_tu'] = "火";
$lang['cal_we'] = "水";
$lang['cal_th'] = "木";
$lang['cal_fr'] = "金";
$lang['cal_sa'] = "土";
$lang['cal_sun'] = "日曜";
@mly520
mly520 / config.php
Created July 25, 2013 09:39
fuelphp 1.6 config.php 設定
<?php
/**
* Part of the Fuel framework.
*
* @package Fuel
* @version 1.7
* @author Fuel Development Team
* @license MIT License
* @copyright 2010 - 2013 Fuel Development Team
* @link http://fuelphp.com
@mly520
mly520 / gist:6304345
Created August 22, 2013 07:59
fuelphp aws-sdk install ※s3 サンプル
1:
composer.jsonファイルを編集
"require": {
"php": ">=5.3.3",
"monolog/monolog": "1.5.*",
"fuelphp/upload": "2.0",
"aws/aws-sdk-php": "2.2.*"
},
// 自動生成 sublime text を使うと便利
Generators resource users
username:string[50],email:string[100],password:string[100],active:tinyinteger:defalut(0),suspended:tinyinteger:defalut(0),level:integer:defalut(1),deleted_at:timestamp:nullable()
※model/User.php は予め用意されていますので、消されないように注意してください。
@mly520
mly520 / s3.php
Created August 22, 2013 14:07
fuelphp s3 sampple
use Aws\Common\Aws;
class Controller_S3 extends Controller
{
public function action_index()
{
// Config::load('aws', true);
$aws = Config::get('aws');
$s3 = Aws::factory( $aws['services']['default_settings']['params'] )->get('s3');