Skip to content

Instantly share code, notes, and snippets.

View ManotLuijiu's full-sized avatar
🏠
Working from home

Manot Luijiu ManotLuijiu

🏠
Working from home
View GitHub Profile
@ManotLuijiu
ManotLuijiu / toggle-show-hide-element.js
Last active February 23, 2021 07:33
How to hide element in JavaScript
document.onscroll = function() {
if (window.innerHeight + window.scrollY > document.body.clientHeight) {
document.getElementById('means__social__th').style.display='none';
}
if (document.getElementById('means__social__th') && \
window.innerHeight + window.scrollY < document.body.clientHeight) \
{
document.getElementById('means__social__th').style.display='block';
}
}
@ManotLuijiu
ManotLuijiu / Layout.js
Created January 31, 2021 12:27
In case, you need to hide some component in react.js or next.js
import React from 'react';
import { useRouter } from 'next/router';
import Nav from './Nav';
import Header from './Header';
import Footer from './Footer';
const Layout = ({ children }) => {
const router = useRouter();
@ManotLuijiu
ManotLuijiu / leads folder
Last active January 24, 2021 15:56
Django app leads folder
leads
.
β”œβ”€β”€ __pycache__
β”‚ β”œβ”€β”€ __init__.cpython-39.pyc
β”‚ β”œβ”€β”€ admin.cpython-39.pyc
β”‚ β”œβ”€β”€ forms.cpython-39.pyc
β”‚ β”œβ”€β”€ models.cpython-39.pyc
β”‚ β”œβ”€β”€ urls.cpython-39.pyc
β”‚ └── views.cpython-39.pyc
β”œβ”€β”€ migrations
@ManotLuijiu
ManotLuijiu / landing.html
Created January 23, 2021 16:50
Django templates/landing.html
{% extends "base.html" %} {% block content %}
<section class="text-gray-600 body-font">
<div
class="container mx-auto flex px-5 py-24 items-center justify-center flex-col"
>
<img
class="lg:w-2/6 md:w-3/6 w-5/6 mb-10 object-cover object-center rounded"
alt="hero"
src="https://dummyimage.com/720x600"
/>
@ManotLuijiu
ManotLuijiu / navbar.html
Created January 23, 2021 16:50
Django templates/navbar.html
<header class="text-gray-600 body-font">
<div class="container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center">
<a href="{% url 'landing_page' %}" class="flex title-font font-medium items-center text-gray-900 mb-4 md:mb-0">
{% load static %}
<img src="{% static 'images/means_logo.svg' %}" alt="means CRM logo" width="30px">
<span class="ml-3 text-xl">Means CRM</span>
</a>
<nav class="md:ml-auto flex flex-wrap items-center text-base justify-center">
@ManotLuijiu
ManotLuijiu / base.html
Created January 23, 2021 16:49
Django templates/base.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Means-CRM</title>
{% load static %}
<link rel="icon"href="{% static 'favicon.ico' %}">
<link
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
INSTALLED_APPS = [
'whitenoise.runserver_nostatic',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'leads'
]
@ManotLuijiu
ManotLuijiu / djcrm ascii tree
Created January 23, 2021 05:24
Ascii tree for CRM
.
β”œβ”€β”€ djcrm
β”‚ β”œβ”€β”€ __pycache__
β”‚ β”‚ β”œβ”€β”€ __init__.cpython-39.pyc
β”‚ β”‚ β”œβ”€β”€ settings.cpython-39.pyc
β”‚ β”‚ β”œβ”€β”€ urls.cpython-39.pyc
β”‚ β”‚ └── wsgi.cpython-39.pyc
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ asgi.py
β”‚ β”œβ”€β”€ settings.py
@ManotLuijiu
ManotLuijiu / urls.py
Created January 23, 2021 04:10
Django [project-name]/urls.py
from django.contrib.staticfiles.storage import staticfiles_storage
from django.views.generic.base import RedirectView
from django.contrib import admin
from django.urls import path, include
from leads.views import landing_page
def trigger_error(request):
division_by_zero = 1 / 0
@ManotLuijiu
ManotLuijiu / settings.py
Last active January 23, 2021 04:06
Django [project-name]/settings.py
"""
Django settings for djcrm project.
Generated by 'django-admin startproject' using Django 3.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/