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;
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
@tienhieuD
tienhieuD / bootstrap-masonry-plugin.js
Created September 29, 2018 04:37 — forked from alessandroraffa/bootstrap-masonry-plugin.js
Responsive Bootstrap 3 Masonry
$(document).ready(function () {
var masonryOptions = {
columnWidth: '.masonry-sizer',
itemSelector: '.masonry-item',
percentPosition: true
};
var $masonryContainer = $('.masonry-container');
var masonryBreakpoint = 767; // change this as you wish
var masonryActive = false;
var activateMasonry = function () {
@tienhieuD
tienhieuD / SchemaSpy-HOWTO.md
Created August 26, 2018 15:42 — forked from dpapathanasiou/SchemaSpy-HOWTO.md
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is schemaSpy_5.0.0.jar)

  2. Get the PostgreSQL JDBC driver (either the JDBC3 or JDBC4 jar file is fine)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@tienhieuD
tienhieuD / SchemaSpy-HOWTO.md
Created August 26, 2018 15:42 — forked from dpapathanasiou/SchemaSpy-HOWTO.md
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is schemaSpy_5.0.0.jar)

  2. Get the PostgreSQL JDBC driver (either the JDBC3 or JDBC4 jar file is fine)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one: