Skip to content

Instantly share code, notes, and snippets.

View jun-ya's full-sized avatar

JuNya KOBORI jun-ya

View GitHub Profile
@jun-ya
jun-ya / file0.erb
Last active August 29, 2015 14:14
GitLab CE OmnibusバンドルのnginxにIPアクセス制限機能を付ける ref: http://qiita.com/jun_ya/items/e748ae4d376956aa9dbd
location / {
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri $uri/index.html $uri.html @gitlab;
}
@jun-ya
jun-ya / array_define.php
Created September 25, 2013 16:36
php5.4から連想配列表現が簡単になったので、array()だらけの配列定義がちょっとだけ見やすくなった。
<?
/**
* 古い連想配列表現方法を使った多重配列定義例
*
*/
$array_old = array(
array('index' => 1,
array('hoge' => 'hohoho', 'fuga' => 'fufufu'),
array('updated_at' => time()),
@jun-ya
jun-ya / fuel_app_classes_controller_top.php
Created September 25, 2013 16:21
FuelPHPでMongoDB使ってるときに調子付いてメソッドチェーンなんかつかってしまうと無駄に横長になってしまう(こんな書き方するなよって話だけど)。けど、php5.4から連想配列が ['foo'=>'bar'] でイケるようになったのでちょっとだけ短く表現できるよ。"array"、"("、")" をタイプするの面倒だもんね(笑)。
<?php
class Controller_Top extends Controller
{
/**
* 連想配列を array('foo' => 'bar') で表現したときのダメなメソッドチェーン例。
*/
public function action_mongotest()
{
$db = \Mongo_Db::instance();