Skip to content

Instantly share code, notes, and snippets.

View nhatkha1407's full-sized avatar
🚀

Whoosh nhatkha1407

🚀
View GitHub Profile
@nhatkha1407
nhatkha1407 / vietnamese-slug.js
Created December 9, 2020 17:21 — forked from laocoi/vietnamese-slug.js
Create Vietnamese slug from string - Javascript
function slugify(string){
const a = 'àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;'
const b = 'aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/á|à|ả|ạ|ã|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ/gi, 'a')
.replace(/é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ/gi, 'e')
.replace(/i|í|ì|ỉ|ĩ|ị/gi, 'i')
.replace(/ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ/gi, 'o')
.replace(/ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự/gi, 'u')
@nhatkha1407
nhatkha1407 / gmailToSlack.js
Created July 14, 2020 06:05 — forked from rushimusmaximus/gmailToSlack.js
Google Apps Script to post filtered Gmail messages to Slack
/*
The intent of this script is for posting filtered Gmail messages to Slack.
This script could be used on its own with manually-marked messages, but it
is most useful it when combined with a Gmail filter. The script assumes that
target messages have had a specific label set on them and have been starred.
The Apps Script can then be set to run periodically.
2015/02 cmyers, rush
@nhatkha1407
nhatkha1407 / HashidsRoutable.php
Created September 15, 2019 16:13 — forked from TheNodi/HashidsRoutable.php
Laravel Model Bindings with Hashids
<?php
namespace App;
use Vinkla\Hashids\HashidsManager;
/**
* Bind a model to a route based on the hash of
* its id (or other specified key).
*
@nhatkha1407
nhatkha1407 / install.md
Last active April 19, 2020 20:26 — forked from bill-mfv/install.md
Install RoR env

HomeBrew is a package manager for OSX. Brew install missing stuff so easy…

  • Install Homebrew:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

RVM: is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

  • Install GPG keys:
    brew install gnupg
    gpg --keyserver hkp://51.38.91.189 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
  • Install RVM:
    \curl -sSL https://get.rvm.io | bash -s stable
@nhatkha1407
nhatkha1407 / deploy.sh
Created March 15, 2019 06:29 — forked from BenSampo/deploy.sh
Laravel deploy script
# Change to the project directory
cd /home/forge/domain.com
# Turn on maintenance mode
php artisan down
# Pull the latest changes from the git repository
git pull origin master
# Install/update composer dependecies