Skip to content

Instantly share code, notes, and snippets.

View redlotus's full-sized avatar
💭
YOLO!!! 🚀

redlotus redlotus

💭
YOLO!!! 🚀
View GitHub Profile
@redlotus
redlotus / postgres-cheatsheet.md
Created March 2, 2016 14:44 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Public Holidays 2016
X-WR-TIMEZONE:Asia/Singapore
X-WR-CALDESC:
BEGIN:VEVENT
DTSTART;VALUE=DATE:20161226
@redlotus
redlotus / demo.html
Created July 11, 2016 08:31
html file to test with wkhtmltopdf
<html>
<head>
<style>
tr {
page-break-inside: auto !important;
}
</style>
</head>
" enable plugins
filetype on
syntax enable
" basic settings
set laststatus=2 " Always show the statusline
"set term=$TERM
set encoding=utf-8 " Necessary to show unicode glyphs
" if $TERM!="linux" " if we are not in tty
" set t_Co=256 " Tell that terminal supports 256 colors
@redlotus
redlotus / download-file.ts
Created December 16, 2016 08:44
downloadFileUsingFileTransfer.ts
downloadFile(id: string, name: string) {
this.platform.ready().then(() => {
const fileTransfer = new Transfer();
let url = constants.API_ENDPOINT + '/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id=' + id;
console.log(url);
// let downloadBrowser = new InAppBrowser(url, '_system');
fileTransfer.download(url, cordova.file.externaldataDirectory + name, true)
.then((entry) => {
console.log('download complete: ' + entry.toURL());
}, (error) => {
@redlotus
redlotus / git_workflow.md
Last active October 16, 2017 03:47
git workflow

Code Versioning

Tính năng mới

  1. Tạo nhánh mới từ branch development. Eg: git branch todo_task
  2. Commit và push trên branch của mình
  3. Sau khi đã test xong trên nhánh tính năng, checkout qua branch development, merge code, fix conflict nếu có và push code để test trên server. Eg: git merge todo_task
  4. [IMPORTANT] Code được approved thì người có trách nhiệm merge code từ nhánh tính năng vào nhánh release để chạy trên production. Eg: git merge todo_task
  5. [IMPORTANT] Code được approved thì người có trách nhiệm merge code từ nhánh tính năng vào nhánh master (code master là code ổn định nhất). Eg: git merge todo_task
  6. [IMPORTANT] Những version ổn định nhất thì đặt tag cho nó để có thể rollback dễ hơn khi cần (branch release và master). Eg: git tag -a rel-v20170727-001 -m 'msg here'

[NOTE] Luôn luôn pull code trước khi làm việc gì khác với git để tránh confict.

@redlotus
redlotus / API.md
Created August 2, 2017 08:24 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@redlotus
redlotus / docstrings.py
Created October 2, 2017 04:34
Google Style Python Docstrings
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
@redlotus
redlotus / odoo.dev.conf
Created October 3, 2017 09:22
odoo.dev.conf
[options]
addons_path = /home/whodoo/GHN-WFS/odoo/odoo/addons,/home/whodoo/GHN-WFS/ghn_addons
admin_passwd = admin
auto_reload = False
csv_internal_sep = ,
data_dir = /home/whodoo/.local/share/Odoo
db_host = 127.0.0.1
db_maxconn = 64
db_name = demo
db_password = False
@redlotus
redlotus / docker-compose-daemon.sh
Created October 13, 2017 05:26 — forked from domachine/docker-compose-daemon.sh
run docker-compose in daemon mode and attach to web container
docker-compose up -d
docker attach myapp_web_1