Skip to content

Instantly share code, notes, and snippets.

View quachngocxuan's full-sized avatar

Xuan Ngoc Quach quachngocxuan

View GitHub Profile
@quachngocxuan
quachngocxuan / learnenough-statistics.md
Last active January 2, 2018 16:39
Learn enough to be dangerous - Statistics
@quachngocxuan
quachngocxuan / learnenough-sql.md
Last active December 18, 2017 02:19
Learn enough to be dangerous - SQL

Learn enough to be dangerous - SQL

This SQL here is for MySQL.

Use regular expression in query

Query the list of CITY names from the table STATION(id, city, longitude, latitude) which have vowels as both their first and last characters. The result cannot contain duplicates. Ref: stackoverflow Ref: Hackerrank

SELECT DISTINCT city
@quachngocxuan
quachngocxuan / learnenough-bash.md
Created December 16, 2017 17:07
Learn enough to be dangerous - Bash

Learn enough to be dangerous - Bash

echo

echo "HELLO"

input

read name
@quachngocxuan
quachngocxuan / learnenough-python.md
Last active August 4, 2019 14:41
Learn enough to be dangerous - Python

Learn enough to be dangerous - Python

Input

s = input()
n = int(input())
integer_list = map(int, input().split())
n = int(raw_input())
integer_list = map(int, raw_input().split())
@quachngocxuan
quachngocxuan / learnenough-dynamicprogramming.md
Created December 14, 2017 07:48
Learn enough to be dangerous - Dynamic Programming
@quachngocxuan
quachngocxuan / learnenough-rails.md
Last active February 7, 2018 08:59
Learn enough to be dangerous - Rails

Learn enough to be dangerous - Rails

INTRODUCTION

The Rails philosophy includes two major guiding principles:

  • Don't Repeat Yourself: DRY
  • Convention Over Configuration

Rails is packed with features that make you more productive, with many of the following features building on one other.

  • Metaprogramming
@quachngocxuan
quachngocxuan / learnenough-ruby.md
Last active January 29, 2018 20:27
Learn enough to be dangerous - Ruby

Learn enough to be dangerous - Ruby

Symbol

Ruby has a data type not often seen in other programming languages, and that’s the symbol. Symbols are similar to strings in that they are made of characters, but instead of being surrounded by quotes, symbols are prefixed with a colon

:name

Symbols are typically used as identifiers.

Comparison method

@quachngocxuan
quachngocxuan / learnenough-sqlalchemy.md
Created December 1, 2017 04:00
Learn enough to be dangerous - SQLAlchemy

Learn enough to be dangerous - SQLAlchemy

CORE CONCEPTS

Session

  • One of the core concepts in SQLAlchemy is the Session.
  • A Session establishes and maintains all conversations between your program and the databases.
  • It represents an intermediary zone for all the Python model objects you have loaded in it.
  • It is one of the entry points to initiate a query against the database, whose results are populated and mapped into unique objects within the Session.
  • A unique object is the only object in the Session with a particular primary key.
@quachngocxuan
quachngocxuan / learnenough-flask.md
Last active January 8, 2018 06:57
Learn enough to be dangerous - Flask

Learn enough to be dangerous - Flask

Based on Tutorialspoint - Flask.

CORE CONCEPTS

Intro

  • Flask is a web application framework written in Python.
  • Flask is based on Werkzeug WSGI toolkit and Jinja2 template engine.
  • Flask is often referred to as a micro framework. It aims to keep the core of an application simple yet extensible. Flask does not have built-in abstraction layer for database handling, nor does it have form a validation support. Instead, Flask supports the extensions to add such functionality to the application. Some of the popular Flask extensions are discussed later in the tutorial.
@quachngocxuan
quachngocxuan / learnenough-git.md
Last active July 22, 2023 17:38
Learn enough to be dangerous - Git

Learn enough to be dangerous - Git

This is based primarily on this guide.

CORE CONCEPTS

Git status sequence

The status of the file has been promoted from untracked to staged, which means the file is ready to be added to the repository. Untracked/unstaged and staged are two of the four states commonly used by Git. Technically, untracked and unstaged are different states, but the distinction is rarely important because git add tracks and stages files at the same time.