Skip to content

Instantly share code, notes, and snippets.

View nitely's full-sized avatar
🖖
live long and prosper

Esteban C Borsani nitely

🖖
live long and prosper
View GitHub Profile
@WebReflection
WebReflection / custom-elements-pattern.md
Last active May 17, 2024 23:30
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.

@nitely
nitely / unicodenames.md
Last active September 16, 2017 06:23
How Python's unicodedata (unicodenames) works

Fredrik Lundh's unicodenames

From: "Fredrik Lundh" effbot@telia.com Date: Sun, 16 Jul 2000 20:40:46 +0200

The unicodenames database consists of two parts: a name database which maps character codes to names, and a code database, mapping names to codes.

  • The Name Database (getname)
@nitely
nitely / scanner.py
Created March 30, 2017 05:39
Python re.Scanner (almost) without using internals
import sre_compile
import re
class Scanner:
def __init__(self, rules, flags=0):
self.scanner = sre_compile.compile(
'(%s)' % '|'.join('(%s)' % pattern for pattern in rules),
flags)
@zacharycarter
zacharycarter / wclwn.md
Last active July 6, 2024 06:26
Binding to C Libraries with Nim
@humitos
humitos / spotify-noads.py
Last active February 21, 2021 03:12
Remove Ads from Spotify Linux client by mutting the audio system
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@gaearon
gaearon / connect.js
Last active June 24, 2024 09:43
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@estesp
estesp / user-ns.md
Last active April 2, 2020 17:10
User namespace proposed docs

Experimental user namespace support

Linux kernel user namespace support provides additional security by enabling a process--and therefore a container--to have a unique range of user and group IDs which are outside the traditional user and group range utilized by the host system. Potentially the most important security improvement is that, by default, container processes running as the root user will have expected administrative privilege (with some restrictions) inside the container but will effectively be mapped to an unprivileged uid on the host.

@juancarlospaco
juancarlospaco / qpdf.py
Last active April 6, 2018 19:35
PDF Conversor powered by Qt5, does NOT show up any GUI, just needs an URL string, then it Prints PDF, and returns file path string, uses UUID if no output filename is passed, optional Landscape orientation if supported, CSS3 Just Works!.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""PDF Conversor powered by Qt5."""
from uuid import uuid4
from PyQt5.QtCore import QUrl
@samwgoldman
samwgoldman / example.js
Last active April 3, 2021 22:20
Pure, stateless, type-checked React components with Immutable.js and Flow
/* @flow */
var React = require("react")
var Immutable = require("immutable")
// In order to use any type as props, including Immutable objects, we
// wrap our prop type as the sole "data" key passed as props.
type Component<P> = ReactClass<{},{ data: P },{}>
type Element = ReactElement<any, any, any>
@rauchg
rauchg / effective-es6.md
Last active July 11, 2023 09:38
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on: