This file contains hidden or 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 pandas import DataFrame | |
import json, xmltodict | |
from tqdm import tqdm as progress | |
class Profile: | |
def __init__(self, raw:dict|None=None): | |
self.Q = raw if raw is not None else {} | |
self.Y = [] |
This file contains hidden or 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
/** @param {DragEvent} e */ | |
function grab(e, D=256) { | |
let n = /** @type {HTMLElement} */ (e.target) | |
if (!n.hasAttribute) return | |
if (!n.hasAttribute('draggable')) return | |
let M = { x: e.clientX, y: e.clientY } | |
let P = n.getBoundingClientRect() | |
let Tx = 0, Ty = 0 | |
let T = n.style.transform |
This file contains hidden or 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
async def parallel(data: list, callback:callable, delay=.1, timeout=10., limit=5, desc=''): | |
import aiohttp, asyncio | |
from tqdm.asyncio import tqdm | |
timeout = aiohttp.ClientTimeout(total=timeout) | |
limit = asyncio.Semaphore(limit) | |
async def task_wrapper(x): | |
async with limit: |
This file contains hidden or 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 { JSDOM } from 'jsdom' | |
function parseHTML(html: string) { | |
const browser = false | |
if (browser) { | |
const domParser = new DOMParser() | |
return domParser.parseFromString(html, "text/html") | |
} |
This file contains hidden or 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
/** | |
* Skrapuje strony z produktami w domenie mediaexpert.pl na ramkę danych: | |
* * nazwa (name) | |
* * cena (price) | |
* * kategoria (category) | |
* * ...atrybuty (tak jak zostały zapisane na stronie) | |
* | |
* Konsola: | |
* deno run mediaexpert2df.ts | |
* y ... y y y |
This file contains hidden or 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 { DOMParser, Element, Document } from "https://deno.land/x/deno_dom@v0.1.35-alpha/deno-dom-wasm.ts" | |
export default function html(strings: TemplateStringsArray, ...values: any[]) { | |
const html = String.raw({ raw: strings }, ...values) | |
const document = new DOMParser().parseFromString(html, "text/html") | |
if (!document) | |
return "" | |
applyInlineCSS(document) |
This file contains hidden or 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
// turns out I could just use | |
///// <ai>Generate an emoji for italian word <<Back>>, respond only with that emoji and insert it inside \{\{\}\}</ai> | |
// so the script for givent purpose is worthless | |
/** Script for using mochi.cards/api written for use in deno.js | |
* | |
* Motivation | |
* * I wanted to add emoji genereted by Chat GPT to each card | |
* | |
* and this is what it is doing |
This file contains hidden or 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 { Head } from "$fresh/runtime.ts" | |
import { options, VNode } from 'preact' | |
import inlineCSS from "../components/inline.tsx" | |
options.vnode = (vnode: VNode) => inlineCSS(vnode) | |
export default () => <> | |
<Head> | |
<title>Fresh App</title> |
This file contains hidden or 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
// klasy | |
#define 🗂️ class | |
#define 🔓 public | |
#define 🔐 protected | |
#define 🔒 private | |
#define 🚫 ~ | |
#define 💚 friend | |
#define 🏗️ new |
This file contains hidden or 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 * as esbuild from "https://deno.land/x/esbuild@v0.15.10/mod.js"; | |
const plugins = [{ | |
name: "remove-non-browser-imports", | |
setup(build) { build.onLoad({ filter: /\.ts$/ }, (args) => ({ | |
loader: "ts", | |
contents: Deno.readTextFileSync(args.path) | |
.replaceAll(/(import).*("https:\/\/).*(")/gm, "") | |
// remove all https:// imports, including async :(, may do BUGsss |
NewerOlder