about summary refs log tree commit diff stats
path: root/config.arg.h
Commit message (Collapse)AuthorAgeFilesLines
* slight change to config.arg.h (I use ff floating)arg@mmvi2006-09-221-1/+1
|
* implemented the maximization as I described on the mailinglist, this feels ↵arg@mmvi2006-09-221-1/+0
| | | | better to me.
* fixed executing of dmenu output to handle args correctlyAnselm R. Garbe2006-09-121-1/+1
|
* ach ich will auch Alt-sAnselm R. Garbe2006-09-051-0/+1
|
* renamed resizetile into resizecolAnselm R. Garbe2006-09-051-1/+1
|
* s/growcol/resizetile/gAnselm R. Garbe2006-09-051-1/+1
|
* I really need column growing, now pushing upstreamAnselm R. Garbe2006-09-051-0/+1
|
* changed shortcut into Mod1-0Anselm R. Garbe2006-08-311-1/+1
|
* added viewall to mainstream (only Ross Mohns version, not the toggle)Anselm R. Garbe2006-08-311-0/+1
|
* small fix in config.arg.hAnselm R. Garbe2006-08-301-3/+3
|
* now using Salmi's menu commandAnselm R. Garbe2006-08-301-2/+3
|
* removed crappy variablesAnselm R. Garbe2006-08-281-0/+4
|
* changed config.arg.h - I really need the 4th tagAnselm R. Garbe2006-08-281-1/+1
|
* oh frking dear big font...Anselm R. Garbe2006-08-251-1/+1
|
* term enlightenedAnselm R. Garbe2006-08-251-1/+1
|
* switching to darker colorscheme with larger fontAnselm R. Garbe2006-08-251-7/+7
|
* patched arg.hAnselm R. Garbe2006-08-251-1/+1
|
* new stuffAnselm R. Garbe2006-08-251-1/+1
|
* switching to dark colors againAnselm R. Garbe2006-08-251-6/+6
|
* changed order of optionsAnselm R. Garbe2006-08-251-2/+2
|
* trying a different configurationAnselm R. Garbe2006-08-251-2/+2
|
* s/TILED/TILE/gAnselm R. Garbe2006-08-251-1/+1
|
* removed a bunch of lines, made mode symbols configurableAnselm R. Garbe2006-08-251-0/+2
|
* restored config.arg.hAnselm R. Garbe2006-08-251-16/+12
|
* new color stuff/new rendering stuffAnselm R. Garbe2006-08-251-15/+24
|
* back to 3 colorsAnselm R. Garbe2006-08-251-4/+3
|
* 3->4 colorsAnselm R. Garbe2006-08-241-3/+4
|
* black on light is really better, I notice this after allAnselm R. Garbe2006-08-231-3/+3
|
* updated man pageAnselm R. Garbe2006-08-231-3/+2
|
* implemented class:inst:title matchingAnselm R. Garbe2006-08-231-1/+1
|
* removed DEFTAGAnselm R. Garbe2006-08-221-1/+0
|
* rxvt is quite slow under OpenBSDAnselm R. Garbe2006-08-221-1/+1
|
* font fixAnselm R. Garbe2006-08-221-2/+3
|
* slight change of my config.hAnselm R. Garbe2006-08-221-4/+4
|
* fixedAnselm R. Garbe2006-08-221-3/+3
|
* windows which have set transient_for hint inherit the transient_for window ↵arg@localhost.10kloc.org2006-08-211-1/+1
| | | | tags now
* after switching to OpenBSD again, I switched back to a saner color schemearg@localhost.10kloc.org2006-08-211-3/+3
|
* simplified sort | uniq into sort -u (on my boxes all sort support -u)Anselm R.Garbe2006-08-161-1/+1
|
* extended cleanupAnselm R.Garbe2006-08-151-2/+5
|
* applied Sanders changes to config.arg.hAnselm R.Garbe2006-08-151-18/+14
|
* removed NUMLOCKMASK, added dynamically calculated numlockmask insteadAnselm R.Garbe2006-08-141-1/+0
|
* changed replacetag into toggletagAnselm R.Garbe2006-08-141-6/+6
|
* removed viewnext/viewprevAnselm R.Garbe2006-08-141-2/+0
|
* made shortcuts like proposed by Sander, renamed viewextend to toggleview ↵Anselm R.Garbe2006-08-131-6/+6
| | | | (more clear)
* implemented viewextend and added M-S-C-n shortcuts for extending the current ↵Anselm R.Garbe2006-08-111-21/+24
| | | | view... updated man page (works great!) nice feature
* after some days of experimenting with grey background, I finally give up and ↵Anselm R.Garbe2006-08-111-4/+4
| | | | switch to white on black ;)
* readded border color, this sucks leastAnselm R.Garbe2006-08-101-0/+1
|
* removed unnecessary border colorAnselm R.Garbe2006-08-101-1/+0
|
* swapping my default colors (bg with fg)Anselm R.Garbe2006-08-101-2/+2
|
* made terminals darker, that is better indeedAnselm R.Garbe2006-08-101-1/+1
|
an>#0fc; font-family: monospace; font-size: 1rem; overflow-y: auto; padding: 10px; box-sizing: border-box; white-space: pre-wrap; } .button-container { width: 100%; display: flex; justify-content: flex-end; margin-bottom: 10px; } button { padding: 10px 20px; font-size: 1rem; margin-left: 10px; cursor: pointer; border: none; transition: background-color 0.3s ease; } button:hover, button:focus { outline: none; } button.run { background-color: teal; color: #FFFFFF; } </style> </head> <body> <div class="playground" id="playground"> <div class="seesaw" id="seesaw"></div> <div class="slide" id="slide"></div> </div> <div class="button-container"> <button onclick="clearEverything()">Clear</button> <button onclick="downloadCodeAndEditor()">Download</button> <button onclick="shareCode()">Share</button> <button onclick="evaluateCode()" class="run">Run Code</button> </div> <textarea id="codeInput">const tokenize = (pattern) => { const tokens = []; let i = 0; while (i < pattern.length) { const char = pattern[i]; if (char === '.' || char === '*' || char === '(' || char === ')' || char === '|') { tokens.push({ type: char, value: char }); } else if (char === '\\') { // Handle escaped characters i++; tokens.push({ type: 'literal', value: pattern[i] }); } else if (char === '[') { // Handle character classes let charClass = ''; i++; while (pattern[i] !== ']' && i < pattern.length) { charClass += pattern[i]; i++; } tokens.push({ type: 'charClass', value: charClass }); } else { tokens.push({ type: 'literal', value: char }); } i++; } return tokens; }; const parse = (tokens) => { let i = 0; const parseSequenceExpression = () => { const node = { type: 'sequence', elements: [] }; while (i < tokens.length) { const token = tokens[i]; if (token.type === 'literal') { node.elements.push({ type: 'literal', value: token.value }); } else if (token.type === '*') { const lastElement = node.elements.pop(); node.elements.push({ type: 'star', element: lastElement }); } else if (token.type === '.') { node.elements.push({ type: 'dot' }); } else if (token.type === 'charClass') { node.elements.push({ type: 'charClass', value: token.value }); } else if (token.type === '|') { i++; const right = parseSequenceExpression(); return { type: 'alternation', left: node, right }; } else if (token.type === '(') { i++; node.elements.push(parseSequenceExpression()); } else if (token.type === ')') { break; // End of a grouping } i++; } return node; }; return parseSequenceExpression(); }; const evaluateMatch = (node) => (input) => { if (node.type === 'literal') { return input[0] === node.value ? input.slice(1) : null; } if (node.type === 'dot') { return input.length > 0 ? input.slice(1) : null; } if (node.type === 'star') { let remainder = input; while (remainder !== null) { const next = evaluateMatch(node.element)(remainder); if (next === null) { break; } remainder = next; } return remainder; } if (node.type === 'charClass') { return node.value.includes(input[0]) ? input.slice(1) : null; } if (node.type === 'alternation') { const remainderLeft = evaluateMatch(node.left)(input); const remainderRight = evaluateMatch(node.right)(input); return remainderLeft !== null ? remainderLeft : remainderRight; } if (node.type === 'sequence') { let remainder = input; for (const element of node.elements) { remainder = evaluateMatch(element)(remainder); if (remainder === null) { return null; } } return remainder; } }; const assertEqual = (expected, actual, message) => { if (expected !== actual) { console.error(`FAIL: ${message}`); } else { console.log(`PASS: ${message}`); } }; const runTests = () => { const tests = [{ pattern: "a.b*c", input: "abbbc", expected: true }, { pattern: "a.b*c", input: "abc", expected: true }, { pattern: "a.b*c", input: "ac", expected: true }, { pattern: "a.b*c", input: "abbc", expected: true }, { pattern: "a.b*c", input: "axbc", expected: false }, // Character class tests { pattern: "[abc]x", input: "bx", expected: true }, { pattern: "[abc]x", input: "dx", expected: false }, // Grouping and alternation tests { pattern: "(a|b)c", input: "ac", expected: true }, { pattern: "(a|b)c", input: "bc", expected: true }, { pattern: "(a|b)c", input: "cc", expected: false }, // Escaped characters tests { pattern: "a\\.b", input: "a.b", expected: true }, { pattern: "a\\.b", input: "a-b", expected: false }, { pattern: "a\\*b", input: "a*b", expected: true } ]; tests.forEach(({ pattern, input, expected }, index) => { const tokens = tokenize(pattern); const ast = parse(tokens); const result = evaluateMatch(ast)(input) !== null; assertEqual(expected, result, `Test ${index + 1}`); }); }; runTests();</textarea> <div id="console"><div>PASS: Test 1</div><div>PASS: Test 2</div><div>PASS: Test 4</div><div>PASS: Test 6</div><div>PASS: Test 7</div><div>PASS: Test 8</div><div>PASS: Test 9</div><div>PASS: Test 10</div><div>PASS: Test 11</div><div>PASS: Test 12</div><div>PASS: Test 13</div></div> <script> function evaluateCode() { const code = document.getElementById('codeInput').value; const consoleDiv = document.getElementById('console'); consoleDiv.innerHTML = ''; // Custom console.log function to output to the console div const originalConsoleLog = console.log; console.log = function(...args) { args.forEach(arg => { const output = document.createElement('div'); output.textContent = typeof arg === 'object' ? JSON.stringify(arg, null, 2) : arg; consoleDiv.appendChild(output); }); originalConsoleLog.apply(console, args); }; try { eval(code); } catch (error) { const errorOutput = document.createElement('div'); errorOutput.textContent = error; errorOutput.style.color = 'red'; consoleDiv.appendChild(errorOutput); } // Restore browser's console.log console.log = originalConsoleLog; } function downloadCodeAndEditor() { const codeInput = document.getElementById('codeInput').value; const htmlContent = document.documentElement.outerHTML.replace( /<textarea id="codeInput"[^>]*>.*<\/textarea>/, `<textarea id="codeInput">${codeInput}</textarea>` ); const blob = new Blob([htmlContent], { type: 'text/html' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'code_editor.html'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } function shareCode() { const code = document.getElementById('codeInput').value; const encodedCode = btoa(encodeURIComponent(code)); window.location.hash = encodedCode; window.prompt("Copy the URL to share.\nBe warned! Very long URLs don't share wicked well, sometimes.", window.location.href); } function clearEverything() { if (!confirm('Are you sure you want to reset the playground?')) { return; } else { window.location.hash = ''; window.location.reload(); } } function loadCodeFromHash() { const hash = window.location.hash.substring(1); if (hash) { try { const decodedCode = decodeURIComponent(atob(hash)); document.getElementById('codeInput').value = decodedCode; } catch (error) { console.error('Failed to decode the URL hash:', error); } } } function help() { const helpText = ` Welcome to the JavaScript Playground! Here are some tips to get you started: 1. Enter your JavaScript code in the textarea. 2. Click the "Run Code" button to execute your code. 3. The console output will be displayed below the textarea. 4. Click the "Clear" button to reset the playground. 5. Click the "Download" button to save your code and editor as an HTML file. 6. Click the "Share" button to generate a URL to share your code with others. 7. You can also press "Cmd + Enter" to run your code. 8. There's an empty div above the buttons with the id "playground" 9. You can mount stuff to it using the "mount" function, for more info run "mountHelp()" 10. You can use the "clear()" function to clear the content's of the console. Go nuts! Share scrappy fiddles! `; console.log(helpText); } function clear() { document.getElementById('console').innerHTML = ''; } function mountHelp() { console.log(` The mount function is used to mount stuff to the playground div. It takes a function as an argument, which in turn receives the playground div as an argument. Before mounting, it clears the playground div. Here's an example of how to use the mount function: mount(playground => { const h1 = document.createElement('h1'); h1.textContent = 'Hell is empty and all the devils are here.'; playground.appendChild(h1); }); This will add an h1 element to the playground div. `); } function mount(mountFunction) { const playground = document.getElementById('playground'); if (!playground) { console.error("Couldn't find a div with the id 'playground'! You may need to reload the page."); return; } if (playground.innerHTML.trim() !== "") { playground.innerHTML = ""; } mountFunction(playground); } document.getElementById('codeInput').addEventListener('keydown', function(event) { if (event.metaKey && event.key === 'Enter') { event.preventDefault(); evaluateCode(); } }); window.onload = loadCodeFromHash; </script> </body></html>