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
// 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 |
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
:: 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 |
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
<?xml version="1.0"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<title>Test replacing PHP.JS blocks</title> | |
<script type="text/javascript"> | |
<!--//--><![CDATA[//><!-- | |
// This solution had been posted to http://phpjs.org earlier, but not archived there or at archive.org; only found record at http://tubeurl.com/spider/phpjs.org |
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
<!-- | |
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 |
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
(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'); |
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
<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"><</h:a>   | |
<h:a href="javascript:void(0);" id="forward">></h:a>   | |
<h:input id="urlBar" type="text" size="30" /> | |
<h:input type="button" id="go" value="Go!" /> | |
</h:div> |
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
/*globals exports*/ | |
(function () { | |
// Todo: Note to self: Integrate research from JML | |
// Todo: Add tests | |
// Todo: Allow building of generic XML (pass configuration object) | |
/* | |
1) String element name (or array of 1-4) | |
2) Optional object with attributes | |
3) Optional array of text nodes and child elements |
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
// Get first canvas tag on page | |
var ctx = C2D2(); | |
// Wrap a specific canvas DOM element | |
var ctx = C2D2(myCanvas); | |
// Use existing canvas tag (by string ID) | |
var ctx = C2D2('cnv'); | |
// Single argument array; creating a new canvas and context and adding canvas to the body |
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
// Use property name as a function (but without arguments) to get the value | |
var strokeStyle = C2D2(c).strokeStyle("rgb(50,110,210)").strokeStyle(); |
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
// Chaining is usable for custom methods or direct canvas wrappers: | |
var ctx = C2D2([1000, 450]) | |
.$shadow({color:'green', blur:2, offset:[5, 10]}) | |
.$line({color:'red', width:5, xy:[[75, 50], [100,75], [100,25]]}) | |
.$fill({color:'blue', xy:[[175, 150], [200,175], [200,125]]}); |
OlderNewer