Skip to content

Instantly share code, notes, and snippets.

View linhmtran168's full-sized avatar
🦖

Linh M. Tran linhmtran168

🦖
View GitHub Profile
@linhmtran168
linhmtran168 / Subdirectory Nginx
Created December 15, 2014 06:47
Config Subdirectory for nginx
erver {
listen 80;
server_name oya.dev;
root /home/vagrant/sites/oya/public_html;
index index.html index.htm index.php;
charset utf-8;
location /oya {
@linhmtran168
linhmtran168 / after.sh
Last active March 23, 2016 14:36
Laravel Homestead setup script
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
# Uupdate
sudo apt-get update
# Install some base packages
@linhmtran168
linhmtran168 / LoggerServiceProvider.php
Created January 30, 2015 10:06
Laravel log sql query
if (Config::get('database.log', false))
{
Event::listen('illuminate.query', function($query, $bindings, $time, $name)
{
$data = compact('bindings', 'time', 'name');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding)
{
if ($binding instanceof \DateTime)
class User extends Eloquent implements UserInterface, RemindableInterface {
// ...
public function scopesAuthorizedByClientId($clientId)
{
$scopesAuthorized = array();
$session = DB::table('oauth_sessions')
->where('client_id', $clientId)
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
@linhmtran168
linhmtran168 / vietnamese.rules
Created March 23, 2015 15:41
Vietnamese unaccent rules
À A
Á A
Ả A
Ạ A
 A
Ấ A
Ầ A
Ẩ A
Ậ A
Ẫ A
@linhmtran168
linhmtran168 / pre-commit-php
Last active August 29, 2015 14:19
Pre-commit hook to check error and code style for php (using php lint and php code sniffer)
#!/bin/sh
STAGED_FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# check for php
which php &> /dev/null
if [[ "$?" == 1 ]]; then
echo "\t\033[41mPlease install PHP.\033[0m"
exit 1
fi
@linhmtran168
linhmtran168 / pre-commit-eslint
Last active February 6, 2024 12:28
Pre-commit hook to check for Javascript using ESLint
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@linhmtran168
linhmtran168 / subfolder
Created June 3, 2015 03:35
Nginx subfolder laravel
...
location /tms/server {
try_files $uri $uri/ /tms/server/public/index.php?$args;
index index.html index.htm index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
set $laravel_uri $request_uri;

リーダブルコード読書会及び要約共有会の目的

  • 今後コードレビュー時に「これってリーダブルコードの◯◯だよね?、こう直したほうがいいよね」と引用できレビューの時間の短縮化が実現できる。
  • リーダブルコードに登場する特殊ワードをチームのコーディングの共通語とする。デザインパターンのカタログ的な考え。
  • リーダブルコードを読んでない人も内容を短時間で把握できる。
  • チーム全体のコードを読みやすくメンテナンスしやすくし品質をあげる。
  • リーダブルコード教になりチーム以外にも広める。コードの品質が悪い人にはリーダブルコードの読書を進めてみる。ひどいコードのままコーディングしてもらうよりその時間を読書の時間に割り当てることも考える(結果的に時間が還元できるなら)。
  • リーダブルコードに書いてあることが全てのプロジェクトに適用てきるわけではないけれでもコーディングルールを考える際の指針にすることはできる。

対象者