This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operator import itemgetter | |
from typing import Any, Self | |
from textual._two_way_dict import TwoWayDict | |
from textual.app import App, ComposeResult | |
from textual.events import Click | |
from textual.widgets import DataTable | |
from textual.widgets.data_table import CellType, ColumnKey, RowKey | |
ROWS = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Clean-up junky files by reducing any group, compound path, and clipping mask contents to just paths. | |
* | |
* This works no matter how nested the container object are and works for better for weird | |
* edge cases than trying to remove each element from each container via the API. | |
*/ | |
var doc = app.activeDocument; // Get active document | |
var sel = doc.selection; // Get selected items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Please note this is a hacky example in response to a question | |
// on the Adobe forums at the link below. | |
// https://community.adobe.com/t5/illustrator-discussions/using-artboards-as-an-archive-that-is-searchable/td-p/13504883 | |
var aiVersion = parseFloat(app.version); | |
var locale = $.locale; | |
var os = $.os; | |
var sysOS = /mac/i.test(os) ? "mac" : "win"; | |
var windowsFlickerFix = sysOS === "win" && aiVersion < 26.4 ? true : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create inset rectangles and ellipses and place into compound path | |
var doc = app.activeDocument; | |
var al = doc.activeLayer; | |
// type of path | |
// var type = "rectangle" | |
var pathType = "ellipse"; | |
// amount of inset paths (max: 4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def score_round(elf_idx, me_idx): | |
if elf_idx == me_idx: # draw | |
return me_idx + 1 + 3 | |
elif me_idx % 3 != (elf_idx + 2) % 3: # win | |
return me_idx + 1 + 6 | |
else: | |
return me_idx + 1 # lose | |
data = open("day2.in").read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ai Command Palette | |
Copyright 2022 Josh Duncan | |
https://joshbduncan.com | |
This script is distributed under the MIT License. | |
See the LICENSE file for details. | |
*/ | |
// TODO: add the ability to edit custom commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
spinners = { | |
"angles": ["◢", "◣", "◤", "◥"], | |
"circle": ["◜", "◠", "◝", "◞", "◡", "◟"], | |
"dots": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"], | |
"ticks": ["-", "\\", "|", "/"], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
from contextlib import contextmanager | |
def spinner_indicator(msg): | |
ticks = ["-", "\\", "|", "/"] | |
i = 0 | |
while True: | |
tick = ticks[i % len(ticks)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
def spinner(msg="working..."): | |
i = 0 | |
ticks = ["-", "\\", "|", "/"] | |
try: | |
while True: | |
tick = ticks[i % len(ticks)] |
NewerOlder