Skip to content

Instantly share code, notes, and snippets.

View hungtrinh's full-sized avatar

Hưng Trịnh hungtrinh

  • Ha Noi, Viet Nam
View GitHub Profile
@hungtrinh
hungtrinh / setup.sh
Last active August 29, 2015 14:12 — forked from boo1ean/setup.sh
#!/usr/bin/env bash
# Install dependencies
yum update -y
yum install -y gcc apr-devel apr-util-devel openssl-devel pcre-devel libxml2-devel libcurl-devel
mkdir setup && cd setup
wget http://mirrors.besplatnyeprogrammy.ru/apache//httpd/httpd-2.4.4.tar.gz
tar -xvf httpd-2.4.4.tar.gz

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@hungtrinh
hungtrinh / Foo.php
Last active September 18, 2015 11:06 — forked from grizzm0/Foo.php
Best practice form/input-filter setup for ZF2
<?php
namespace Application\Entity;
/**
* Class Foo
*
* @package Application\Entity
*/
class Foo
{
@hungtrinh
hungtrinh / php-zf2-resources.md
Last active September 18, 2015 12:21 — forked from AV4TAr/php-zf2-resources.md
A bunch of resources for PHP and Zend Framework 2
@hungtrinh
hungtrinh / poedit_install.sh
Last active November 9, 2015 06:26 — forked from bancek/poedit_install.sh
Install Poedit 1.8.6 from source on Ubuntu 15.04
wget https://github.com/vslavik/poedit/releases/download/v1.8.6-oss/poedit-1.8.6.tar.gz
tar xf poedit-1.8.6.tar.gz
cd poedit-1.8.6
apt-get install -y build-essential libwxgtk3.0-dev libicu-dev libgtkspell-dev libdb++-dev liblucene++-dev libboost-dev libboost-regex-dev libboost-system-dev libwxgtk3.0-dev
sed -i 's/Version: 3.0.3.4/Version: 3.0.5/' /usr/lib/x86_64-linux-gnu/pkgconfig/liblucene++.pc
./configure
make
make install
@hungtrinh
hungtrinh / shiftjis-csv.rb
Created November 18, 2015 07:03 — forked from gotwalt/shiftjis-csv.rb
Convert a CSV file to Shift-JIS for use in Japanese versions of Microsoft Excel in ruby-1.8.7
require "iconv"
encoding = "SHIFT-JIS"
# Open a file for writing in the Shift-JIS format
File.open("output.csv", "w:#{encoding}") do |io|
# Read the CSV file, and convert CRs to CRLFs.
csv = File.open("input.csv").read.gsub("\r", "\r\n")
# Convert the CSV to the correct encoding
io.write Iconv.iconv(encoding, "UTF-8", csv).join
end
@hungtrinh
hungtrinh / bobp-python.md
Created December 2, 2015 02:41 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@hungtrinh
hungtrinh / git commands.txt
Created June 30, 2016 04:00 — forked from kmorcinek/git commands.txt
Git Commands. My common scenarios for using git.
# good git book
http://git-scm.com/book
# Discard uncommitted changes in a specific file
git checkout file_name
# Clear everything not in repo
git checkout -- .
# A way to quickly move to the previous commit in a git branch. This also way for "deleting" last commit.
@hungtrinh
hungtrinh / regex-japanese.txt
Created January 17, 2017 03:29 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@hungtrinh
hungtrinh / Vagrantfile
Created March 1, 2017 13:21
Vagrant configuration file with OS detection - on windows we mount shared folders without NFS - on all other OS we use NFS for speeding up the project inside the virtual machine
# -*- mode: ruby -*-
# vi: set ft=ruby :
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil