Skip to content

Instantly share code, notes, and snippets.

@jimratliff
jimratliff / thought_bubble.svg
Last active July 16, 2022 16:45
thought_bubble.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jimratliff
jimratliff / Package_terminology_in_Python.md
Last active October 8, 2022 16:24
Discussion of conflicting uses of “package” when discussing Python and distribution of Python software.

Unpacking “package” terminology in Python

Introduction

“Package” is an overloaded term in the context of Python projects

In the context of Python projects, “package” is often used, confusingly, to refer to at least three non-equivalent entities:

  • A structure that organizes modules for importation or execution, often a directory containing a __init__.py file, that contains one or more Python modules.
  • The Python project itself
  • A file (such as a wheel (.whl) or a source archive) associated with a particular release and even a particular platform of a particular Python project. This file can be downloaded and installed to make the project’s code available to the user.

Leading Python organizations provide definitions that could and should prevent confusion, but even those organizations continue to use “package” in confusing ways

@jimratliff
jimratliff / dabblet.css
Last active July 2, 2019 17:23
WebKit bug? `background-clip:var(--a)` invalidates `-webkit-background-clip:text` for Safari/Chrome
/*
* WebKit bug? `background-clip:var(--a)` invalidates `-webkit-background-clip:text` for Safari/Chrome
* Works in Firefox
*/
p {
background: linear-gradient(to right, red, blue);
color: rgba(0,0,0,0.3);
font: bold 400% sans-serif;
padding: .5em;
<!DOCTYPE html>
<html lang="en">
<!--See Elijah Manor, "CSS Animated Hamburger Icon," March 4, 2014.
https://elijahmanor.com/css-animated-hamburger-icon/ -->
<!--See also my equivalent CodePen: https://codepen.io/jimratliff/pen/agdxwX -->
<!--
We start with a "hamburger" icon (three vertically stacked horizontal bars), created
purely by CSS (i.e., no image file and no icon font), which is commonly understood
to signal that a click on the hamburger will trigger a menu to reveal itself.
<?php
/*
Based on AJ Clarke, "How to Create a Simple WordPress Theme Options Page," WPExplorer,
November 21, 2016, https://www.wpexplorer.com/wordpress-theme-options/
I started with AJ's code. Like many other examples of creating a theme-options page,
AJ sometimes used the same string for more than one distinct purpose, creating some
ambiguity about what role each occurrence of a string plays in its context.
To address this, I've modified the code to use a unique string for each distinct role.
@jimratliff
jimratliff / Define_a_jdrsgame_game
Last active August 12, 2018 23:35
Template of arrays and values for defining a jdrsgame strategic-form game #latex #jdrsgame
\definejdrsgame{3}{4}
% Define the players' names
\renewcommand{\Rplayernm}{Ms.\ Row}
\renewcommand{\Cplayernm}{Mr.\ Column}
% Define Column's strategies
\readarray{ColumnStrategies}{A&B&C&D&E&F&G&H&I&J}
%\ColumnStrategies(1)={A}
%\ColumnStrategies(2)={B}
%\ColumnStrategies(3)={C}
@jimratliff
jimratliff / LaTeX_snippet:_Insert_6-column_table_(centered_columns).txt
Created May 19, 2018 20:44
Insert 6-column table with centered columns. #latex #snippet
\begin{table} [!htb] % p option positions table on its own page.
\centering
\caption{Generic 6-column table with centered columns}
%\label{table:NAME}
% Uncomment the below \rowcolors line to produce alternating shading of rows
%\rowcolors{2}{tableShade}{white} % start alternating shades from 2nd row (not counting header)
% K is my custom-specified column type, which is assumed to have been defined in the preamble as:
% \newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}
@jimratliff
jimratliff / LaTeX_snippet:_Insert_5-column_table_(centered_columns).txt
Created May 19, 2018 20:43
Insert 5-column table with centered columns. #latex #snippet
\begin{table} [!htb] % p option positions table on its own page.
\centering
\caption{Generic 5-column table with centered columns}
%\label{table:NAME}
% Uncomment the below \rowcolors line to produce alternating shading of rows
%\rowcolors{2}{tableShade}{white} % start alternating shades from 2nd row (not counting header)
% K is my custom-specified column type, which is assumed to have been defined in the preamble as:
% \newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}
@jimratliff
jimratliff / LaTeX_snippet:_Insert_4-column_table_(centered_columns).txt
Created May 19, 2018 20:40
Insert 4-column table with centered columns. #latex #snippet
\begin{table} [!htb] % p option positions table on its own page.
\centering
\caption{Generic 4-column table with centered columns}
%\label{table:NAME}
% Uncomment the below \rowcolors line to produce alternating shading of rows
%\rowcolors{2}{tableShade}{white} % start alternating shades from 2nd row (not counting header)
% K is my custom-specified column type, which is assumed to have been defined in the preamble as:
% \newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}
@jimratliff
jimratliff / LaTeX_snippet:_Insert_3-column_table_(centered_columns).txt
Created May 19, 2018 20:38
Insert 3-column table with centered columns. #latex #snippet
\begin{table} [!htb] % p option positions table on its own page.
\centering
\caption{Generic 3-column table with centered columns}
%\label{table:NAME}
% Uncomment the below \rowcolors line to produce alternating shading of rows
%\rowcolors{2}{tableShade}{white} % start alternating shades from 2nd row (not counting header)
% K is my custom-specified column type, which is assumed to have been defined in the preamble as:
% \newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}