Skip to content

Instantly share code, notes, and snippets.

View lac617a's full-sized avatar
✔️
Si el tiempo no se detiene, no lo hagas vos.

Dominyel Rvr #Yoydev lac617a

✔️
Si el tiempo no se detiene, no lo hagas vos.
View GitHub Profile
import string
from django.utils.text import slugify
def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def unique_slug_generator(instance, new_slug=None):
@AndreaMinato
AndreaMinato / auth.ts
Last active June 20, 2023 00:55
Typescript Vuex Module
import axios, { AxiosRequestConfig } from "axios";
import router from "@/router"; //shortcut to src
import { Module } from "vuex";
const authModule: Module<any, any> = {
state: {
loggedIn: false,
loginError: null,
username: null
@tterb
tterb / README-badges.md
Last active February 23, 2026 23:46
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@anubhavshrimal
anubhavshrimal / CountryCodes.json
Last active March 2, 2026 10:27 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@marteinn
marteinn / info.md
Last active January 21, 2024 06:57
Using the Fetch Api with Django Rest Framework

Using the Fetch Api with Django Rest Framework

Server

First, make sure you use the SessionAuthentication in Django. Put this in your settings.py

# Django rest framework
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
 'rest_framework.authentication.SessionAuthentication'
@rxaviers
rxaviers / gist:7360908
Last active March 16, 2026 19:56
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@rafaelcanovas
rafaelcanovas / bitly.py
Created October 17, 2013 17:32
bit.ly templatetag for Django
# coding: utf-8
import bitly_api
from django import template
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
register = template.Library()
try:
@codeguy
codeguy / slugify.js
Created September 24, 2013 13:19
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));
}
@rafaelcanovas
rafaelcanovas / forms.py
Last active March 2, 2021 17:04
Monkey-patching HTML5 required attribute for Django forms.
from django import forms
class HTML5Form(forms.Form):
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
for _, field in self.fields.items():
if field.widget.is_required:
field.widget.attrs['required'] = 'required'
@jonlabelle
jonlabelle / string-utils.js
Last active August 13, 2025 12:17
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();