Skip to content

Instantly share code, notes, and snippets.

@JosephPecoraro
JosephPecoraro / Filter Through Command.rb
Last active December 14, 2015 05:19
Basic "Filter Through Command" TM2 command.
#!/usr/bin/env ruby -wKU
require "tempfile"
require "#{ENV['TM_SUPPORT_PATH']}/lib/textmate"
require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb"
command = TextMate::UI.request_string(:title => 'Filter Through Command', :prompt => 'Command:', :button1 => 'Execute', :button2 => 'Cancel').to_s
tempfile = Tempfile.new("tm-filter-command")
tempfile.write(STDIN.read)
function buildCSSProperties() {
var used = {}; // hash table lookup instead of scanning the list
var properties = []; // build the properties ourselves
var style = document.documentElement.style; // cache the style, prevent numerous property lookups
var list = document.defaultView.getComputedStyle(document.documentElement, "");
var length = list.length;
for (var i = 0; i < length; ++i) // fill the hash table early with known values
used[properties[i] = list[i]] = true; // combine statements (1) mark as used (2) add to list
for (var i = 0, end = length; i < length; ++i) { // keep end pointer to prevent push() calls
Array.convert = function convert(list) {
return Array.prototype.slice.call(list);
}
function buildCSSProperties() {
var properties = Array.convert(document.defaultView.getComputedStyle(document.documentElement, ""));
var length = properties.length;
for (var i = 0; i < length; ++i) {
var propertyWords = properties[i].split("-");
var j = propertyWords.length;
// So this will run in a browser as well as a shell.
if (this.window) window.print = function(s) { console.log(s); }
var TOTAL = 1e6;
var str = "color: red";
// Test with regex
(function() {
var start = Date.now();
for (var i=0; i<TOTAL; ++i) {
// So this will run in a browser as well as a shell.
if (this.window) {
window.print = function(s) { console.log(s); }
}
var TOTAL = 1e5;
var row = 0;
var data = {
rows: [{ a: "hi", b: 1, c: true, d: "wah!" }]
};
From f1c3f11113d3e4f75b6addb56e67b3b7ec8076f3 Mon Sep 17 00:00:00 2001
From: Joseph Pecoraro <[email protected]>
Date: Tue, 23 Feb 2010 00:41:00 -0800
Subject: [PATCH] Added fs.glob and fs.globSync.
---
doc/api.txt | 10 ++++++
src/node.js | 61 +++++++++++++++++++++++++++++++++-----
test/mjsunit/test-fs-glob.js | 46 ++++++++++++++++++++++++++++
test/mjsunit/test-readdir.js | 1 +
From 867965c77c0cb5ece7f953f1ff9d906f234eeabb Mon Sep 17 00:00:00 2001
From: Joseph Pecoraro <[email protected]>
Date: Mon, 18 Jan 2010 12:04:49 -0500
Subject: [PATCH] Fixed typo in comments.
---
src/node.js | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node.js b/src/node.js
// ==UserScript==
// @name Diff for gist.github
// @description adds a diff function to http://gist.github.com/
// @namespace http://userscripts.org/users/40991
// @include http://gist.github.com/*
// @include https://gist.github.com/*
// ==/UserScript==
// Working for Safari/Webkit with GreaseKit
// A few minor tweaks. I also inlined the requires,
From 20e7d8628c14c10d079ac0299453635079c13545 Mon Sep 17 00:00:00 2001
From: Joseph Pecoraro <[email protected]>
Date: Sat, 16 Jan 2010 20:10:46 -0500
Subject: [PATCH] Updated out of date LICENSE file.
---
LICENSE | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/LICENSE b/LICENSE
diff --git a/bin/pomo b/bin/pomo
index 193b7f4..84eb20a 100755
--- a/bin/pomo
+++ b/bin/pomo
@@ -228,7 +228,7 @@ command :list do |c|
list.tasks.each_with_index do |task, i|
next if options.complete && !task.complete?
next if options.incomplete && task.complete?
- say ' %s %2d. %-45s : %d minutes' % [task.complete? ? '√' : ' ', i, task.to_s, task.length]
+ say ' %s %2d. %-45s : %d minutes' % [task.complete? ? '✓' : ' ', i, task.to_s, task.length]