Skip to content

Instantly share code, notes, and snippets.

View linhmtran168's full-sized avatar
🦖

Linh M. Tran linhmtran168

🦖
View GitHub Profile
@linhmtran168
linhmtran168 / parser.awk
Created February 19, 2016 03:00
Awk to parse mecab result
BEGIN {
first_line=1;
idx=1;
max_words=100;
}
{
if (index($4,"名詞") == 1)
if (first_line == 1) {
printf "%s", toupper($1);
@linhmtran168
linhmtran168 / FizzBuzz.scala
Created January 22, 2016 20:35
FizzBuzz Scala
import java.io.IOException
import java.nio.file.{FileAlreadyExistsException, Files, Paths}
import scala.math.BigInt
/**
* Created by linhmtran on 1/23/16.
*/
object FizzBuzz extends App {
try {
@linhmtran168
linhmtran168 / jargon.md
Last active August 29, 2015 14:27 — forked from cb372/jargon.md
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

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

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

対象者

@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;
@linhmtran168
linhmtran168 / pre-commit-eslint
Last active July 6, 2025 08:17
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 / 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 / vietnamese.rules
Created March 23, 2015 15:41
Vietnamese unaccent rules
À A
Á A
Ả A
Ạ A
 A
Ấ A
Ầ A
Ẩ A
Ậ A
Ẫ A
# 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
class User extends Eloquent implements UserInterface, RemindableInterface {
// ...
public function scopesAuthorizedByClientId($clientId)
{
$scopesAuthorized = array();
$session = DB::table('oauth_sessions')
->where('client_id', $clientId)