Skip to content

Instantly share code, notes, and snippets.

introduction

inspired by a friend’s fledgling language design and motivated by the JeanHeyd Meneide RustConf Fiasco™ and improving the story for compile-time introspection, i decided i needed a place to spew the last year’s musings on variadic generics in Rust in one mighty, less-than-understandable catharsis.

i think somewhere in here is a considered and reasonable design, so that’s neat!

perhaps i’ll make this an RFC one day. probably not. you have my express permission to do that yourself.

variadic generics?

this nugget of language jargon encapsulates the idea that we might want to bind to an arbitrarily large list of generic parameters, all at once. there are many reasons to want to do this:

@robdodson
robdodson / focus-visible-tabindex.md
Last active July 29, 2021 03:40
:focus-visible tabindex

One of the intentions of :focus-visible is to not match if someone mouse-clicks on a div (or other generic element) with a tabindex. The reason is because developers often build custom controls using generic elements and when they unexpectedly show a focus ring on mouse click these same developer reach for :focus { outline: none; } which we really want to discourage.

The spec attempts to explain that :focus-visible should not match when you mouse click an element with a tabindex, but does so in a way that maybe isn't explicit enough. Quoting from the spec:

If the element which supports keyboard input (such as an input element, or any other element that would triggers a virtual keyboard to be shown on focus if a physical keyboard were not present), indicate focus.

This attempts to highlight the concept of "supporting keyboard input". Noteably a div with a tabindex would not meet this criteria.

If the user interacts with the page via

About variadics in Rust

This is an analysis of how variadic generics could be added to Rust. It's not a proposal so much as a summary of existing work, and a toolbox for creating an eventual proposal.

Introduction

Variadic generics (aka variadic templates, or variadic tuples), are an often-requested feature that would enable traits, functions and data structures to be generic over a variable number of types.

To give a quick example, a Rust function with variadic generics might look like this:

@scottj
scottj / Server.py
Last active February 9, 2023 14:25 — forked from HaiyangXu/Server.py
A simple Python HTTP server that can handle mime types properly.
#!/usr/bin/env python3
import http.server
import socketserver
HOST = "localhost"
PORT = 8000
class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
@NotOfficer
NotOfficer / Valorant-UUIDs.json
Last active March 15, 2023 02:48
UUIDs of all Valorant objects (release-02.00)
{
"characters": {
"5f8d3a7f-467b-97f3-062c-13acf203c006": "Breach",
"f94c3b30-42be-e959-889c-5aa313dba261": "Raze",
"6f2a04ca-43e0-be17-7f36-b3908627744d": "Skye",
"117ed9e3-49f3-6512-3ccf-0cada7e3823b": "Cypher",
"320b2a48-4d9b-a075-30f1-1f93a9b638fa": "Sova",
"1e58de9c-4950-5125-93e9-a0aee9f98746": "Killjoy",
"707eab51-4836-f488-046a-cda6bf494859": "Viper",
"eb93336a-449b-9c1b-0a54-a891f7921d69": "Phoenix",
@ryderdamen
ryderdamen / gce-to-gcs-uploads.md
Created December 4, 2018 15:43
Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

I had a bit of trouble trying to configure permissions to upload files from my Google Compute Engine instance to my Google Cloud Storage bucket. The process isn't as intuitive as you think. There are a few permissions issues that need to be configured before this can happen. Here are the steps I took to get things working.

Let's say you want to upload yourfile.txt to a GCS bucket from your virtual machine. You can use the gsutil command line tool that comes installed on all GCE instances.

If you've never used the gcloud or gsutil command line tools on this machine before, you will need to initialize them with a service account.

@parmentf
parmentf / GitCommitEmoji.md
Last active May 9, 2024 03:31
Git Commit message Emoji
@brcooley
brcooley / api-lolesports-com_docs.md
Last active August 5, 2022 16:35
lolesports.com unofficial api docs

Unofficial documentation

This is an unofficial documentation for the internal lolesports.com api.

This documentation is uncomplete and currently only show all information I got so far. Please help me complete and correct this documentation.

Top level domain

The domain for the intern lolesports.com api is http://api.lolesports.com/api/.

@xamlmonkey
xamlmonkey / WebSocketWrapper.cs
Last active November 20, 2021 20:33
Wrapper for the .NET 4.5 ClientWebSocket
using System;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Coe.WebSocketWrapper
{
public class WebSocketWrapper
{
@rbialek
rbialek / config
Created June 7, 2011 13:32
ssh/.config
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /home/user/.ssh/id_rsa