Skip to content

Instantly share code, notes, and snippets.

View jethrolarson's full-sized avatar
:shipit:

Jethro Larson jethrolarson

:shipit:
  • Tableau
  • Seattle
View GitHub Profile
@jethrolarson
jethrolarson / Switched to new API
Created November 3, 2008 20:37
Ubiquity command for Firefox. Converts Selected markdown text to HTML with preview.
CmdUtils.CreateCommand({
names: ["convert"],
description: "Converts markdown text to html.",
help: "Select markdown text, hit enter to replace with converted html.",
author: {name: "Jethro Larson", email: "jethrolarson@gmail.com"},
license: "BSD",
homepage: "http://gist.github.com/21974",
arguments: [
{role: 'object', nountype: noun_arb_text,label:"markdown"},
{role:'goal',nountype:noun_arb_text, label:"html"}
CmdUtils.CreateCommand({
name: "hex-to-decimal",
icon: "",
homepage: "http://gist.github.com/gists/50159",
author: { name: "Jethro Larson", email: "jethrolarson@gmail.com"},
license: "GPL",
description: "Convert Hexidecimal Integer to Decimal",
help: "Enter a Hexidecimal number",
takes: {"Hex": noun_arb_text},
_toDec: function(Hex){
CmdUtils.CreateCommand({
name: "decimal-to-hex",
icon: "",
homepage: "http://jethro-larson.appspot.com",
author: { name: "Jethro Larson", email: "jethrolarson@gmail.com"},
license: "GPL",
description: "Convert Decimal Integer to Hex",
help: "Enter a Decimal number",
takes: {"Decimal": noun_arb_text},
_toDec: function(Decimal){
/*This is just a port of Arc90's Readibility bookmarklet
Props goes to them.
- Jethro Larson
*/
jetpack.statusBar.append({
html: <>
<div id="read">Readibility</div>
</>,
width: 70,
onReady: function(widget){
//: Turn any function into a jQuery method
$.plug = function(name,func){
$[name]=func;
};
//: Turn any function into a jQuery plugin
$.fnPlug = function(name,func){
$.fn[name] = function(){
var args = arguments;
return self.each(function(){
$.fn.pollute = function (pollution) {
pollutants = {
air:"SMOAK",
water:"OIL",
noise:"BLAH"
}
window.emit = function(type) {
var i = Math.round(Math.random()*1000);
//Write a function that walks the entire dom of a page
//given huge array of strings return array containing the duplicates
jQuery.fn.balls = function(){
return this.each(function(){
var $this = $(this),
w = $this.width(),
h = $this.height(),
max = w > h ? w : h,
rad = Math.floor(max/2) + "px";
$this.css({
"width": max,
"height": max,
$.c = function(className){
return typeof document.getElementsByClassName === "function"
? $(document.getElementsByClassName(className)) : $('.'+className);
};
//In some brief tests I saw greater than 50% increase in speed for classNames.
$.q = function(sel){
return typeof document.querySelectorAll === "function"
? $(document.querySelectorAll(sel)) : $(sel);