Skip to content

Instantly share code, notes, and snippets.

View dthtien's full-sized avatar
🎯
Focusing

The Tiến dthtien

🎯
Focusing
View GitHub Profile
@dthtien
dthtien / gist:48a2b980cf59d2718f7fdea7e59c14cc
Created June 5, 2019 16:34 — forked from fongfan999/gist:b146632acbd71ac797deed61803c66eb
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@dthtien
dthtien / rails_webpacker_bootstrap_expose_jquery.md
Created January 14, 2019 03:10 — forked from andyyou/rails_webpacker_bootstrap_expose_jquery.md
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collect all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@dthtien
dthtien / git-deployment.md
Created January 12, 2019 16:21 — forked from fongfan999/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

@dthtien
dthtien / app.DockerFile
Created August 26, 2018 15:14 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
# config valid for current version and patch releases of Capistrano
lock "~> 3.11.0"
set :message, "Deploy voucher trader api app"
set :application, "voucher_trader_api"
set :repo_url, "[email protected]:dthtien/voucher_trader_api.git "
set :deploy_user, 'deploy'
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
@dthtien
dthtien / ubuntu_agnoster_install.md
Created June 8, 2017 13:57 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 14.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@dthtien
dthtien / rails-postgres-backbone-bootstrap-bootswatch
Created May 26, 2017 17:20 — forked from sionc/rails-postgres-backbone-bootstrap-bootswatch
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
- Check rails version
$ rails -v
- To update rails
$ gem update rails
- Creating a new rails app using postgresql
$ mkdir rails_projects
$ cd rails_projects
$ rails new myapp --database=postgresql
## 1) What is SQL Injection
QL Injection is a security vulnerability where an attacker can run arbitrary SQL code on your machine because we are not using safe Active Record practices.
## 2) Which of these are safe from SQL Injection attacks?
A) safe
User.where(:name => params[:name])
## 1) Instance or class method?
A) User.where(:name => 'rich')
- class method
## Week 5 Quiz
## 0) Name 3 types of variables in Ruby? Put them in order from least scope to greatest.
1. Local variable(new = "foo")
2. Instan variable(@new="foo")
3.Constant(NEW="foo")
## 1) Where do SQL queries belong, the view or controller?