Skip to content

Instantly share code, notes, and snippets.

@brettz9
brettz9 / gist:a3a7755c3056c16165be
Last active August 29, 2015 14:14
Very simple but time-saving page for doing quick text operations in JavaScript without need for XHR set-up to grab a data file. Defines `$doc` as the input document string and `set()` can be supplied one argument to change the result textarea. `$result` is also defined as the value of any prior conversion result.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Replacer</title>
<style>section {float:left; width:50%;} textarea {width:95%; height: 250px;}</style>
</head>
<body>
<section>
@brettz9
brettz9 / gist:65ec7af727cb16d0d622
Created February 4, 2015 19:34
Some really rough notes on making a text (and possibly wysiwyg) editor with a site-neutral plug-in system
navigator.registerProtocolHandler('web+texteditorplugin', window.location.href.replace(/\?.*$/, '') + '?pluginInfo=%s', 'Text editor plugin');
// http://127.0.0.1/TextMunger2/index.html?pluginInfo=web%2Btexteditorplugin%3Aurl%3Dhttp%3A%2F%2Fbrett-zamir.me%2Ftests2
// Todo: use back-up for clicks on protocol handler
@brettz9
brettz9 / bulk-download-helper.html
Last active August 29, 2015 14:18
Tool for building numerically sequenced links that can be bulk-downloaded. Requires Flash-Got or equivalent browser add-on for non-same-domain links.
<!DOCTYPE html>
<html><head>
<meta charset="utf-8" />
<title>Bulk Download Helper</title>
</head>
<body>
<b>Steps</b>
<ol>
<li>If you are downloading something from a separate domain from this server, you must install <a href="https://addons.mozilla.org/en-Us/firefox/addon/flashgot/">Flashgot</a> in Firefox (or an equivalent add-on for other browsers).</li>
@brettz9
brettz9 / npp_task_list.cfg
Created July 9, 2015 21:06
Config file for Notepad++ Task List (which I may abandon if it keeps crashing as often as it seems to do, despite the great potential usefuleness of it) to allow my own "todo" annotations to show up (currently needed to be placed at C:\Program Files (x86)\Notepad++\plugins\Config\npp_task_list.cfg ; needs admin privs, so, to copy the task list c…
version=
1
keywords=
TODO:
$TODO:
// Todo:
@brettz9
brettz9 / jamilih-lite-string.js
Last active August 29, 2015 14:25
Serializes a subset of the [Jamilih](https://github.com/brettz9/jamilih) format to a string. For the DOM-creation equivalent, see https://gist.github.com/brettz9/ac4c18f51c0af8003a41/
/*jslint vars:true*/
/*
// Example
jmlString('div', {'class': 'attVal1', title: 'att<&>Val2'}, [
'a<&b>c',
['input', {type: 'text'}],
['span', {
$on: {click: function (e) {alert(e.target);}},
dataset: {abc: '5', camelCase: '7'},
style: {cssFloat: 'right', marginTop: '17px'}
:: Don't hold me accountable if this is not safe! This is my first batch
:: file beyond just opening programs...
:: When used in conjunction with http://gist.github.com/221159 , Firefox
:: can call this file with the first argument being a file to which to log
:: output (error or otherwise), thus enabling applications like command-line
:: emulators in Firefox
:@echo off
:: First argument is the output file, the second argument is the command (e.g., "svn"), and the other arguments up to the last are arguments to be passed after the command, and the last argument is the argument count and is ignored
// As a function or class, the following can be used to execute
// command-line programs from Firefox. When used with executing
// a batch file with arguments as at
// http://gist.github.com/221161/ , Firefox can be made to pipe
// success or error output to a file and then retrieve the file
// (e.g., to make a FF extension which works as a command-line,
// allowing copy-and-paste, logging, etc.)
/**
* Execute a file on the command line with the given arguments
<!--
How about a templating system which looked like this?
Inspired by http://code.google.com/p/mjst/ and my earlier
http://gist.github.com/250870
Could use PHPTAL-style attributes as well, but the use of "j"
attributes is for simple, not-so-ugly use and addresses the problem
that processing instructions cannot occur within tags/attributes
This solution does not necessitate any string or regular expression
processing whatsoever; all can be handled by the DOM
A pity there are no namespaces with processing instructions (and a pity
(function () {
function _addClick(browser, textboxID) {
return function (e) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
function loaded () {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var urlbarURL = browser.getUserData('urlbarURL');
<xbl xmlns="http://www.w3.org/ns/xbl" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ib="http://brett-zamir.me/ns/ibrowser">
<binding element="ib|browser" id="browser">
<template allow-selectors-through="true" apply-author-sheets="true">
<div id="wrapper">
<h:div>
<h:a href="javascript:void(0);" id="back">&lt;</h:a> &#160;
<h:a href="javascript:void(0);" id="forward">&gt;</h:a> &#160;
<h:input id="urlBar" type="text" size="30" />
<h:input type="button" id="go" value="Go!" />
</h:div>