Skip to content

Instantly share code, notes, and snippets.

@Rigel772
Rigel772 / style.css
Created June 4, 2020 18:01
[scroll snap horyzontal] #css
.parrent {
scroll-snap-type: x mandatory;
overflow-x: scroll;
display: grid;
grid-template-columns: repeat(3, 100%)
}
.child {
padding: 3em;
width: calc(100vw - 6em);
scroll-snap-align: start;
@Rigel772
Rigel772 / gist:9d605e5eb5fb8e62cbf4f40b4360464d
Created June 1, 2020 06:59 — forked from MerNat/gist:8ee69c5eeaa4ac909b0044f48e9569b0
Traefik docker compose yml for cluster or swarm configuration.
version: '3.4'
services:
consul-leader:
image: consul
command: agent -server -client=0.0.0.0 -bootstrap -ui
volumes:
- consul-data-leader:/consul/data
environment:
- CONSUL_BIND_INTERFACE=eth0
@Rigel772
Rigel772 / mega_menu.css
Created May 3, 2020 18:05
[bootstrap mega menu] #bootstrap #css
/*
*
* ==========================================
* CUSTOM UTIL CLASSES
* ==========================================
*
*/
.megamenu {
position: static;
@Rigel772
Rigel772 / App.js
Last active May 2, 2020 13:01
[reacr graphql strapi] #react #strapi
import React from "react";
import { useQuery, gql } from "@apollo/client";
const ALL_METALS = gql`
{
golds {
id
date
price
source
@Rigel772
Rigel772 / docker-compose.yml
Created April 29, 2020 08:22
[strapi docker postgresql] #strapi #docker
version: '3'
services:
strapi:
container_name: strapi
image: strapi/strapi
environment:
- DATABASE_CLIENT=postgres
- DATABASE_HOST=db
- DATABASE_PORT=5432
@Rigel772
Rigel772 / basics.py
Last active April 26, 2020 09:09
[SQLAlchemy] #python #sql
# from Youtube video: https://youtu.be/51RpDZKShiw
#connecting
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory: ')
#establishing a session - provides identity map: app objects - DB
from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=engine)
session = Session()
# MODEL BASE
@Rigel772
Rigel772 / docker commands.txt
Last active May 23, 2020 18:57
[nginx proxy docker containers] #nginx #docker
### RUN NGINX PROXY CONTAINER
docker run --detach --name nginx-proxy --publish 80:80 --publish 443:443 --volume /etc/nginx/certs --volume /etc/nginx/vhost.d --volume /usr/share/nginx/html --volume /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
docker run
--detach
--name nginx-proxy
--publish 80:80
--publish 443:443
--volume /etc/nginx/certs
--volume /etc/nginx/vhost.d
@Rigel772
Rigel772 / nginx-option.conf
Created April 22, 2020 08:49
[nginx config for multiple domains] #devops
#You could deploy Nginx in front of the CherryPy servers to act as a reverse proxy and direct traffic. Basically, you’d need to have the CherryPy servers listen on some random port on localhoast, then configure Nginx to pass requests to those ports based on domain names.
<pre>
upstream first_server {
server 127.0.0.1:3000;
}
upstream second_server {
server 127.0.0.1:4000;
}
@Rigel772
Rigel772 / crud.py
Created April 20, 2020 13:51
[Sample FastAPI] #fastapi
# Define the method for create new user and get user by username
from sqlalchemy.orm import Session
from . import models, schemas
def get_user_by_username(db: Session, username: str):
return db.query(models.UserInfo).filter(models.UserInfo.username == username).first()
@Rigel772
Rigel772 / Form.js
Last active April 18, 2020 10:05
[Text input React component] #react #bootstrap
import React from "react";
import TextInput from "./common/TextInput";
import PropTypes from "prop-types";
function Form(props) {
return (
<form onSubmit={props.onSubmit}>
<TextInput
id="title"
label="Title"