Skip to content

Instantly share code, notes, and snippets.

@lucianoratamero
lucianoratamero / README.md
Last active December 20, 2022 13:21
How to iterate through string literals in TypeScript

How to iterate through string literals in TypeScript

// In edge cases, it would be useful to iterate through a string literal,
// so you can do something based on each value.

// Let's say you have a literal of UserRoles
@lucianoratamero
lucianoratamero / README.md
Last active April 29, 2024 07:08
Using Vite with Django, the simple way

Using Vite with Django, the simple way

Warning

I'm surely not maintaining this as well as I could. There are also other possible, better integrated solutions, like django-vite, so keep in mind this was supposed to be more of a note to myself than anything :]

This gist has most of the things I've used to develop the frontend using vite inside a monolithic django app.

Here's a boilerplate that uses this approach: https://github.com/labcodes/django-react-boilerplate

A couple of things to note:

@lucianoratamero
lucianoratamero / App.py
Last active September 18, 2023 21:04
breact: a naive implementation of a react-like component API in brython
from browser import html
from breact import render_to_DOM, Component
from Counter import Counter
class App(Component):
def render(self):
return html.DIV([
html.H1('Counter'),
Counter()()
@lucianoratamero
lucianoratamero / README.md
Last active May 5, 2023 06:48
Export Gnome settings and extensions python script

migrate_gnome_settings.py

This script makes it easier to copy Gnome settings and extensions from one pc to the other. It supports python>=3.5.

To use it, download it, then run python3 migrate_gnome_settings.py --export-settings to create a tar.gz file with all the settings.

Then, on your new system, copy the script and the gzip to your user's home directory and run python3 migrate_gnome_settings.py --import-settings.

For now, the script migrates:

@lucianoratamero
lucianoratamero / README.md
Last active April 2, 2023 15:37
neovim configs - put inside ~/.config/nvim/
@lucianoratamero
lucianoratamero / cloudSettings
Last active December 9, 2020 02:29
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-09T02:29:49.135Z","extensionVersion":"v3.4.3"}
@lucianoratamero
lucianoratamero / firefox-patched.desktop
Last active June 8, 2018 17:15
Fixes Firefox on Ubuntu 18.04 - Freezing when clicking in or out a form field (mostly password fields) - add it to `~/.local/share/applications/`
[Desktop Entry]
Version=1.0
Name=Patched - Firefox Web Browser
Name[ar]=Patched - متصفح الويب فَيَرفُكْس
Name[ast]=Patched - Restolador web Firefox
Name[bn]=Patched - ফায়ারফক্স ওয়েব ব্রাউজার
Name[ca]=Patched - Navegador web Firefox
Name[cs]=Patched - Firefox Webový prohlížeč
Name[da]=Patched - Firefox - internetbrowser
Name[el]=Patched - Περιηγητής Firefox
@lucianoratamero
lucianoratamero / config.cson
Last active May 10, 2018 14:38
atom config - imported via the 'Config import export plugin'
"*":
"autoclose-html":
legacyMode: true
"autoupdate-packages":
lastUpdateTimestamp: 1518799191736
"config-import-export":
defaultPath:
darwin: ""
freebsd: ""
linux: "~/AtomBackups"