Skip to content

Instantly share code, notes, and snippets.

View openhubdev's full-sized avatar

sleepydev openhubdev

  • somewhere in the universe
View GitHub Profile
@openhubdev
openhubdev / git-add-stuff.md
Last active January 21, 2022 12:40
git add . vs git add -A vs git add -u

Summary:

git add -A stages all changes

git add . stages new files and modifications, without deletions (on the current directory and its subdirectories).

git add -u stages modifications and deletions, without new files

//next.config.js
module.exports = {
i18n: {
locales: ['en-US', 'fr', 'ko'], //list of languages
defaultLocale: 'en-US' //set the default language
}
}
//next.config.js
module.exports = {
i18n: {
locales: ['en-US', 'fr', 'ko'],
domains: [
{
domain: 'yourdomain.com',
defaultLocale: 'en-US'
},
{
@openhubdev
openhubdev / .block
Created March 26, 2021 16:56 — forked from d3indepth/.block
Tree layout (from introduction)
license: gpl-3.0
height: 1000
border: no
@openhubdev
openhubdev / .block
Last active March 26, 2021 16:55 — forked from d3indepth/.block
D3 line generator
license: gpl-3.0
height: 120
border: no

๐Ÿ ์žฅ๊ณ  (Django) 101

์šฐ์„  Python> = 3.3์ด ์„ค์น˜๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.

python -Vor python3 -V

0. ํ”„๋กœ์ ํŠธ ํด๋” ๋งŒ๋“ค๊ธฐ (=์ปจํ…Œ์ด๋„ˆ root)

1. ๊ฐ€์ƒ ํ™˜๊ฒฝ ๋งŒ๋“ค๊ธฐ

๊ทธ ํ”„๋กœ์ ํŠธ ํด๋” ์•ˆ์—์„œ ์ด ๋ช…๋ น์–ด ์น˜๊ธฐ:

Django More in-depth

Internationalization:

Once all strings are marked for translation, generate the message files:

Generate message files for a desired language

python manage.py makemessages -l kr

After adding translations to the .po files, compile the messages

๐Ÿฌ MySQL commands 101

First step

First where your mysql is

which mysql

To login (from unix shell) use -h only if needed.

EXPRESSJS 101

@app.js

Define the custom routes JS files

const indexRouter = require('./routes/index');
const usersRouter = require('./routes/users');
const canvasRouter = require('./routes/canvas');

๐Ÿ˜ Postgres 101

1. Connect to the PostgreSQL

psql postgres or psql postgres -U patrick (as the user "patrick")

2. Create a database

postgres=# CREATE DATABASE djangoblog;

3. Set the access permissions

postgres=> GRANT ALL PRIVILEGES ON DATABASE my_db TO patrick;