Skip to content

Instantly share code, notes, and snippets.

View gyuri-lajos's full-sized avatar

Gyuri Lajos gyuri-lajos

View GitHub Profile
@ajitid
ajitid / App.js
Last active March 2, 2024 10:20
Okay-ish way get title and favicon on the browser
import { useState } from "react";
import ky from "ky";
import cheerio from "cheerio";
function App() {
const [url, setUrl] = useState("");
const [title, setTitle] = useState("");
const [faviconUrl, setFaviconUrl] = useState("");
const handleSubmit = async () => {
Copy this to roam/js page, including the "{{[[roam/js]]}}" node:
- {{[[roam/js]]}}
- ```javascript
/*
* Roam template PoC by @ViktorTabori
* 0.1alpha
*
* How to install it:
* - go to `roam/js` page`
@garak
garak / rte.html
Created July 7, 2020 16:21
Pure JS rich text editor
<!doctype html>
<html>
<head>
<title>Rich Text Editor</title>
<script type="text/javascript">
var oDoc, sDefTxt;
function initDoc() {
oDoc = document.getElementById("textBox");
sDefTxt = oDoc.innerHTML;

Always Already Programming

Everyone who interacts with computers has in important ways always already been programming them.

Every time you make a folder or rename a file on your computer, the actions you take through moving your mouse and clicking on buttons, translate into text-based commands or scripts which eventually translate into binary.

Why are the common conceptions of programmer and user so divorced from each other? The distinction between programmer and user is reinforced and maintained by a tech industry that benefits from a population rendered computationally passive. If we accept and adopt the role of less agency, we then make it harder for ourselves to come into more agency.

We've unpacked the "user" a little, now let's look at the "programmer." When a programmer is writing javascript, they are using prewritten, packaged functions and variables in order to carry out the actions they want their code to do. In this way, the programmer is also the user. Why is using pre-made scripts seen

@neodigm
neodigm / snackbar_toast.js
Last active January 17, 2024 06:20
DataVis 👁️ UX 🍭 PWA 👁️ ThreeJS ✨ Vue 🚀 Svelte
// 🌑🌒🌓🌔🌕🌖🌗🌘🌑 Infographics UX PWA Typescript Svelte ThreeJS Vue ✨
let neodigmToast = (function(_d, eID, _q) {
let _nTimeout = 5800, _aQ = [], _eSb, _eSbText, _sTheme
let bIsInit = bIsPause = false
let _fOpen = function() {
_eSbText.innerHTML = _aQ[0].sMsg.replace("|", "<br>").replace("##", "")
_eSb.style.left = ((_d.body.clientWidth / 2) - (_eSb.clientWidth / 2)) + "px"
if( _aQ[0].sTheme ) _eSb.dataset.n55Theme = _aQ[0].sTheme
if( _sTheme ) {
_eSb.dataset.n55Theme = _sTheme
@maaku
maaku / .gitignore
Last active November 17, 2020 21:53
BIP specifying fast merkle trees, as used in the Merkle branch verification opcodes
*~
@seanh
seanh / README.markdown
Last active April 23, 2023 11:13
Embedding Hypothesis in a Single Page App

This is a very rough demonstration of how to embed Hypothesis in a single page app.

When you click on the "Go to page two" button it loads the second "page" of the app. This page is just loaded by JavaScript, without having the browser load a new page as it would normally do when following a link. Importantly the JavaScript code does change URL in the browser's location bar though, using history.pushState(). Before changing the URL it unloads Hypothesis from the page, and after changing the URL it reloads Hypothesis into the page. This is to work around a limitation with Hypothesis - it doesn't detect URL changes done by pushState() and reload the annotations.