Skip to content

Instantly share code, notes, and snippets.

View tuki0918's full-sized avatar
🏠
Working from home

Y.Yamamoto tuki0918

🏠
Working from home
View GitHub Profile
.room {
width: 200px;
float: left;
margin-right: 145px;
}
.room-msg {
top: -20px;
left: 190px;
height: 100% !important;
@tuki0918
tuki0918 / 01.json
Created May 4, 2015 13:57
composer
{
"require-dev": {
"phpunit/phpunit": "4.6.*"
},
"autoload": {
"psr-4": {
"Namespace\\": ""
}
}
}
@tuki0918
tuki0918 / crontab.md
Last active August 29, 2015 14:20
cron
$ crontab -l > crontab.back$(date '+%y%m%d_%H%M%S')
$ crontab .crontab.back
@tuki0918
tuki0918 / associate.php
Last active August 29, 2015 14:18
laravel snippets
<?php
// app/routes.php
Route::get('/', function()
{
$artist = new Artist;
$artist->name = 'Eve 6';
$artist->save();
@tuki0918
tuki0918 / csv.php
Created February 3, 2015 13:17
fputcsv double quote
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
function fputcsv2($fp, $fields, $delimiter = ',', $enclosure = '"', $mysql_null = false) {
$delimiter_esc = preg_quote($delimiter, '/');
$enclosure_esc = preg_quote($enclosure, '/');
$output = array();
@tuki0918
tuki0918 / paste.js
Created January 2, 2015 14:01
Dev Tools: console include jQuery
var jq = document.createElement('script');
jq.src = 'https://code.jquery.com/jquery-2.1.3.min.js';
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict(); // Option
@tuki0918
tuki0918 / td-agent.conf
Created November 24, 2014 14:36
Fluentd: apache.log | fluent-plugin-geoip
<source>
type tail
format apache
path /var/log/httpd/access_log
pos_file /var/log/td-agent/access_log.pos
tag geo.apache.log
</source>
<match geo.apache.log>
type geoip
@tuki0918
tuki0918 / td-agent.conf
Created November 24, 2014 13:59
Fluentd: php_errors_log
<source>
type tail
format /^\[(?<time>[^\]]*)\] (?<message>.*)$/
path /var/log/php_errors.log
pos_file /var/log/td-agent/php_errors_log.pos
tag php.errors_log
</source>
<match php.errors_log>
type elasticsearch
@tuki0918
tuki0918 / td-agent.conf
Created November 24, 2014 13:58
Fluentd: apache.log
<source>
type tail
format apache
path /var/log/httpd/access_log
pos_file /var/log/td-agent/access_log.pos
tag apache.log
</source>
<match apache.log>
type elasticsearch
@tuki0918
tuki0918 / get_user_id.php
Last active August 29, 2015 14:10
search for twitter user_id | reference: http://stabucky.com/wp/archives/2188
<?php
$a = array(0,1,2,3,4,5,6,7,8,9);
$b = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$c = array('_');
$x = array_merge($a,$b,$c);
function userId($arr, $length = 4){
$max = count($arr);
if ($max < $length) {