Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

adonis simo simo97

🏠
Working from home
View GitHub Profile
View duplicate_table_with_trigger_on_update.sql
-- 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 Apr 24, 2020 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
View css-media-queries-cheat-sheet.css
/*------------------------------------------
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 Apr 17, 2020 — 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!
View ec2-host-from-tag-to-env-vars.sh
######
# 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 Feb 19, 2020
A small function to create a s3 bucket for static web hosting. It upload file to the S3 bucket after creation.
View create_web_s3_bucket.py
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 Dec 9, 2019 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
View vanilla-js-cheatsheet.md
@simo97
simo97 / vanilla-js-cheatsheet.md
Created Dec 9, 2019 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
View vanilla-js-cheatsheet.md
@simo97
simo97 / slugify.js
Created Oct 29, 2019 — forked from codeguy/slugify.js
Create slug from string in Javascript
View slugify.js
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 Sep 19, 2019 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
View UsefulDjangoMixins.py
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
View fast_dom_insert_remove_by_edNewgate.js
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){
You can’t perform that action at this time.