Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

quyencv quyen91

🌴
On vacation
View GitHub Profile
@quyen91
quyen91 / last_day_of_month.go
Created Mar 12, 2020 — forked from hosszukalman/last_day_of_month.go
Get the last day of the actual month in Golang
View last_day_of_month.go
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
@quyen91
quyen91 / slug.ruby
Last active Aug 17, 2019
Remove vietnamese accent ruby
View slug.ruby
from = "àáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịýỷỳỹỵäëïîöüûñç·/_,:;"
to = "aaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiyyyyyaeiiouunc------"
str = "DEMO STRING"
hash = {}
for i in 0..from.length - 1
hash[from[i]] = to[i]
end
@quyen91
quyen91 / slug.js
Created Aug 16, 2019 — forked from bluzky/slug.js
Remove vietnamese accent javascript / Bỏ dấu tiếng Việt
View slug.js
function stringToSlug(str) {
// remove accents
var from = "àáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîöüûñç",
to = "aaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiouunc";
for (var i=0, l=from.length ; i < l ; i++) {
str = str.replace(RegExp(from[i], "gi"), to[i]);
}
str = str.toLowerCase()
.trim()
@quyen91
quyen91 / gist:43b08724284063c90dc1e54fbbc37d50
Created Apr 21, 2019 — forked from jendiamond/gist:6128723
Creating your own Gem & Command Line Interface Using Bundler
View gist:43b08724284063c90dc1e54fbbc37d50

Presentation slides

Create a Gem - Make it a CLI - Add Rspec Tests

Create a Gem - Make it a Command Line Interface - Add Rspec Tests Using Bundler & Thor

#Creating your own Gem

  1. Run this command in your Terminal. This creates and names all the files you need for your gem. We are going to create a Lorem Ipsum Generator; you can call it whatever you want but seeing as we are creating a Lorem Ipsum generator we'll call it lorem. Read about gem naming conventions.
@quyen91
quyen91 / deploy.yml
Created Apr 1, 2019 — forked from caalberts/deploy.yml
Ansible Playbook to Deploy Rails to AWS
View deploy.yml
---
# Deploy rails app from localhost to remote servers
- name: Set up AWS infrastructure
hosts: localhost
connection: local
roles:
- setup_aws
- name: Package app
@quyen91
quyen91 / .gitignore
Created Sep 30, 2018 — forked from billywatson/.gitignore
Generate Static HTML Website Using Ruby on Rails
View .gitignore
# Ignore static version of the site (used to upload error pages to S3 for Heroku errors)
/out
@quyen91
quyen91 / create_files.rb
Created Sep 30, 2018 — forked from mindreframer/create_files.rb
Benchmark Static Site Generators
View create_files.rb
#!/usr/bin/env ruby -wKU
require 'yaml'
class Generator
def run
300.times do |i|
File.open(name(i), 'w') do |f|
f.puts Article.new.content
end
end
@quyen91
quyen91 / Mutltiple_SSH.md
Created Sep 29, 2018 — forked from hkasera/Mutltiple_SSH.md
How to use multiple github accounts?
View Mutltiple_SSH.md

I have two accounts on github, one is personal account and other is office account. I typically face this problem to manage pushing to different repos using these different accounts.

I found a great way of doing it without any hassle.

Step 1 : Generate different ssh keys for both the accounts

Suppose my personal id is jane@gmail.com and office account is jane@doe.com

Follow the steps mentioned here to generate ssh keys : https://help.github.com/articles/generating-ssh-keys/

@quyen91
quyen91 / main.go
Created Jul 15, 2018
GO Demo - GitGo CLI
View main.go
// "Package main" is the namespace declaration
// "main" is a keyword that tells GO that this project is intended to run as a binary/executable (as opposed to a Library)
package main
// importing standard libraries & third party library
import (
"fmt"
"os"
"strings"
You can’t perform that action at this time.