Skip to content

Instantly share code, notes, and snippets.

@zaemiel
zaemiel / gist:edfc6c176b2c9d210e3ebe02caa76834
Last active March 6, 2023 23:57
Gist to Django Vue.js deploy to remote server video
1. To get IP address:
ip addr
2. To connect via SSH:
ssh username@ip_addr
@zaemiel
zaemiel / vue.config.js
Created October 1, 2021 11:25
vue.config.js for integrating with Django
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/static/dist/' : 'http://localhost:8080',
outputDir: '../backend/static/dist',
indexPath: '../../templates/base-vue.html',
chainWebpack: config => {
config.devServer
.public('http://localhost:8080')

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@zaemiel
zaemiel / vue.config.js
Created November 20, 2020 14:47
The minimal vue.config.js for django-webpack-loader and webpack-bundle-tracker
const BundleTracker = require('webpack-bundle-tracker');
module.exports = {
publicPath: "http://0.0.0.0:8080",
outputDir: "./dist/",
chainWebpack: config => {
config.optimization.splitChunks(false)
config.plugin('BundleTracker').use(BundleTracker, [
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
@zaemiel
zaemiel / gist:0e7053ef5b135684be9a481b102ef390
Created July 20, 2018 15:39
Django pagination with bootstrap snippet
{% for n in posts.paginator.page_range %}
{% if posts.number == n %}
<li class="page-item active">
<span class="page-link">{{ n }}<span class="sr-only">(current)</span></span>
</li>
{% elif n > posts.number|add:'-2' and n < posts.number|add:'2' %}
<li class="page-item"><a class="page-link" href="?page={{ n }}">{{ n }}</a></li>
{% endif %}
@zaemiel
zaemiel / gist:411567c0a396e266ca4a412329f9f4ca
Created April 19, 2018 11:21
Nemo: How to open current folder in a terminal by a keyboard shortcut (Mint 18.x Cinnamon)
1. Firstly, i have to create a .gnome2/accels/nemo file
cd .gnome2 (a hidden folder. If there is no one - create it)
mkdir accels
touch accels\nemo
2. Reboot system.
After rebooting the .gnome2/accels/nemo file will be filled with an autogenerated info.
3. Ctrl + F
@zaemiel
zaemiel / CKEditor installation and integration with Active Admin
Last active July 14, 2023 14:39
CKEditor installation and integration with Active Admin
1. Gemfile
gem 'ckeditor', github: 'galetahub/ckeditor'
2. bundle install
3. app/assets/javascripts/application.js
//= require ckeditor/init
4. config/initializers/active_admin.rb
@zaemiel
zaemiel / CSS vertical align of text block within div
Last active August 29, 2015 14:24
CSS vertical align of text block within div
**A.) If you only have one line of text:**
HTML:
<div>vertically centered text</div>
CSS:
div
{