Skip to content

Instantly share code, notes, and snippets.

View tienhieuD's full-sized avatar
🦶
hmmm

DUONG TIEN HIEU tienhieuD

🦶
hmmm
View GitHub Profile
@tienhieuD
tienhieuD / _app.js
Created July 12, 2023 10:05 — forked from claus/_app.js
Restore scroll position after navigating via browser back/forward buttons in Next.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
useScrollRestoration(router);
return <Component {...pageProps} />;
};
export default App;
@tienhieuD
tienhieuD / Delete_node_modules.js
Created May 12, 2023 06:55
Delete all node_modules of directory
const fs = require("fs");
const path = require("path");
const directory = "E:\\";
const maxDepth = 6;
const ignoreDir = [".git", ".pnpm", ".tool", "$RECYCLE.BIN", ".tmp"]
let total = 0;
const findDelNodeModules = (pathDir, depth = 0) => {
total++
const isDir = fs.statSync(pathDir).isDirectory();
@tienhieuD
tienhieuD / sample1.json
Created November 4, 2021 08:36
sample1.json
{
"data": {
"_id": "618386f2872a015b2cca5f5f",
"published_at": "2021-11-04T07:35:56.495Z",
"seo": {
"_id": "618386f2872a015b2cca5f60",
"structured_data": null,
"prevent_indexing": false,
"meta_description": "loạn chiến landingpage",
"meta_title": "Loạn chiến Mobile",
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
Running with gitlab-ci-multi-runner 1.9.5 (e8b9d54)
Using Shell executor...
Running on SCS...
Fetching changes...
Removing social_benefits/api/target/api.jar
Removing social_benefits/api/target/api.jar.original
Removing social_benefits/api/target/classes/log4j.properties
Removing social_benefits/api/target/classes/messages.properties
Removing social_benefits/api/target/classes/vn/
Removing social_benefits/api/target/generated-sources/
@tienhieuD
tienhieuD / cv.md
Last active November 19, 2021 02:37
2019-05-25 10:26:11,470 12784 ERROR urs2 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "C:\Code\odoo_v11\odoo\tools\safe_eval.py", line 350, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in <module>
File "c:\code\myaddon\urbancity\sapo_api\models\product_template.py", line 22, in getProduct
self.check_result_data(result)
File "c:\code\myaddon\urbancity\sapo_api\models\product_template.py", line 39, in check_result_data
self.sapo_check_create_product(product)
File "c:\code\myaddon\urbancity\sapo_api\models\product_template.py", line 93, in sapo_check_create_product
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import tools
from odoo import api, fields, models
class SaleReport(models.Model):
_name = "sale.report"
_description = "Sales Analysis Report"
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, tools, api
class ActivityReport(models.Model):
""" CRM Lead Analysis """
_name = "crm.activity.report"
"""Part of odoo. See LICENSE file for full copyright and licensing details."""
import simplejson as json
from simplejson.errors import JSONDecodeError
import werkzeug.wrappers
import functools
import logging
from odoo import http
from odoo.http import request
_logger = logging.getLogger(__name__)