Skip to content

Instantly share code, notes, and snippets.

$ npm install -g browserify
$ npm install debowerify
@koheisg
koheisg / gist:0c0d15aa42730d54153b
Last active August 29, 2015 14:12
vimvim tabtab
"" for tab
" Anywhere SID.
function! s:SID_PREFIX()
return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID_PREFIX$')
endfunction
function! s:my_tabline()
let s = ''
for i in range(1, tabpagenr('$'))
let bufnrs = tabpagebuflist(i)
@koheisg
koheisg / exception.php
Created December 30, 2014 15:55
exceptionの使い方
<?php
class MyException extends LogicException
{
public function myFunction()
{
$this->log(new Mylogger());
}
private function log(MyLogger $logger)
@koheisg
koheisg / gist:0a688867ba668f31f8f5
Created December 25, 2014 17:41
validationの説明のためのコード
<?php
class CarBuildValidator
{
/** @var array */
private $message;
/**
* @return boolean
*/
$queryTable = $this->getConnection()->createQueryTable('TABLE', 'SELECT * FROM TABLE');
$queryTable->getTable('TABLE_NAME')->getValue(0,'id');
public function long_function()
{
$arg = 'hikisu';
$hoge = new otherClass($arg);
foreach ($hoge as $fuga) {
$piyo = $fuga->each();
foreach ($piyo as $do) {
$wantDo = $do->function;
if ($wantDo == 'error') {
$this->writeLog('strange error');
@koheisg
koheisg / file0.txt
Last active December 27, 2018 15:14
CakePHPを使ってみて、いろいろやったこと ref: https://qiita.com/koheiSG/items/71c9344cc812b9aa9508
<?php
class WidgetController extends AppController {
public $components = array('Security');
public function beforeFilter() {
if (isset($this->params['admin'])) {
$this->Security->blackHoleCallback = 'forceSSL';
$this->Security->requireSecure();
}
$ sudo du / |sort -n|tail
2383932 ./var/log
3206136 ./home/www/cms
3703848 ./var/lib/mysql/data
3924128 ./usr
4115076 ./home/www
8706056 ./var/lib/mysql
8760148 ./var/lib
9173396 ./home
11328132 ./var
$ echo `date '+%Y%m%d'`