Skip to content

Instantly share code, notes, and snippets.

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

adonis simo simo97

🏠
Working from home
View GitHub Profile
-- creation de la table common_domain
CREATE TABLE public.common_domain
(
id SERIAL,
domain character varying(253) COLLATE pg_catalog."default" NOT NULL,
is_primary boolean NOT NULL,
tenant_id uuid NOT NULL,
CONSTRAINT common_domain_pkey PRIMARY KEY (id),
CONSTRAINT common_domain_domain_key UNIQUE (domain),
CONSTRAINT common_domain_tenant_id_1965101a_fk_common_company_id FOREIGN KEY (tenant_id)
@simo97
simo97 / css-media-queries-cheat-sheet.css
Created April 24, 2020 12:34 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@simo97
simo97 / ec2-host-from-tag-to-env-vars.sh
Created April 17, 2020 17:38 — forked from marcellodesales/ec2-host-from-tag-to-env-vars.sh
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User
@simo97
simo97 / create_web_s3_bucket.py
Last active February 19, 2020 12:23
A small function to create a s3 bucket for static web hosting. It upload file to the S3 bucket after creation.
import os
import json
import boto3
from django.conf import settings
def build_file_path(path, filename, static_root_folder):
NAME = static_root_folder + '/'
return path[path.find(NAME) + len(NAME):] + filename
@simo97
simo97 / vanilla-js-cheatsheet.md
Created December 9, 2019 11:30 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@simo97
simo97 / vanilla-js-cheatsheet.md
Created December 9, 2019 11:30 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@simo97
simo97 / slugify.js
Created October 29, 2019 21:31 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@simo97
simo97 / media-query.css
Created September 19, 2019 08:19 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
from django.db.models import Q
from django.contrib import messages
class SearchViewMixin:
"""
this mixins allow a class based view to handle dynamically and automatically
a search. It add a GET param name as 's' which hold the searched term, and use
lookup_fields = [] to perform search
function addDomNodes(nodeToAdd, nodeParentWhereNodeIsAdded, typeOfInsertion = "innerHtml"){
return new Promise((resolve) => {
requestAnimationFrame(() => {
typeOfInsertion === "innerHtml" ? nodeParentWhereNodeIsAdded.innerHTML = nodeToAdd : nodeParentWhereNodeIsAdded.insertAdjacentHTML('beforeend', nodeToAdd);
resolve(nodeParentWhereNodeIsAdded);
}, nodeParentWhereNodeIsAdded);
});
}
function removeDomNodes(domChildToRemove, domParent){