Browse files

moar aswomez!

  • Loading branch information...
1 parent 6c47e98 commit 9353c91d4703d88d75827103616c7f1766e256c7 @subtleGradient committed Jan 22, 2009
View
36 Commands/Reformat HTML Selection : Line Compressed.tmCommand
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env ruby
+html = STDIN.read
+leading = html.scan(/\A^\s+/).first
+leading ||= ''
+
+html.gsub!(/\A^\s+&lt;/,'&lt;')
+
+html.gsub!(/&gt;\s+&lt;/m,'&gt;&lt;')
+html.gsub!(/\s+&lt;/m,' &lt;')
+html.gsub!(/^ &lt;/,'&lt;')
+html.gsub!(/&gt;\s+(?=\S)/m,'&gt; ')
+
+print leading, html</string>
+ <key>fallbackInput</key>
+ <string>line</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>keyEquivalent</key>
+ <string>^~q</string>
+ <key>name</key>
+ <string>Reformat HTML Selection / Line</string>
+ <key>output</key>
+ <string>replaceSelectedText</string>
+ <key>scope</key>
+ <string>text.html</string>
+ <key>uuid</key>
+ <string>741EAEB8-F871-425D-91F9-A4B087FEDFFB</string>
+</dict>
+</plist>
View
4 Commands/Refresh Safari CSS.tmCommand
@@ -11,9 +11,9 @@
### Converted to Applescript by Thomas Aylott - http://subtleGradient.com
###
-osascript -e 'tell the application "Safari" to do JavaScript "document.location=\"javascript:void(function(){var%20i,a,s;a=document.getElementsByTagName('\''link'\'');for(i=0;i%3Ca.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('\''stylesheet'\'')%3E=0&amp;&amp;s.href)%20{var%20h=s.href.replace(/(&amp;|%5C?)forceReload=\\d+/,'\'''\'');s.href=h+(h.indexOf('\''?'\'')%3E=0?'\''&amp;'\'':'\''?'\'')+'\''forceReload='\''+(new%20Date().valueOf())}}})();\";" in document 1' &amp;&gt;/dev/null &amp;
+ps -xc|grep -sq Safari &amp;&amp; osascript -e 'tell app "Safari" to do JavaScript "document.location=\"javascript:void(function(){var%20i,a,s;a=document.getElementsByTagName('\''link'\'');for(i=0;i%3Ca.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('\''stylesheet'\'')%3E=0&amp;&amp;s.href)%20{var%20h=s.href.replace(/(&amp;|%5C?)forceReload=\\d+/,'\'''\'');s.href=h+(h.indexOf('\''?'\'')%3E=0?'\''&amp;'\'':'\''?'\'')+'\''forceReload='\''+(new%20Date().valueOf())}}})();\";" in document 1' &amp;&gt;/dev/null &amp;
-echo "Safari CSS Refreshing…"
+echo "Refreshing Safari CSS…"
</string>
<key>input</key>
<string>none</string>
View
9 Commands/Refresh Safari.tmCommand
@@ -5,13 +5,8 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>### Refresh All Active Browsers - OmniWeb, Safari, Firefox &amp; IE
-### v1.01. 2005-03-29
-### Modified by Thomas Aylott - http://subtleGradient.com
-###
-
-# Check if Safari is running, if so refresh
-osascript -e 'tell app "Safari" to do JavaScript "window.location.reload();" in first document'
+ <string># Check if WebKit is running, if so refresh
+ps -xc|grep -sq Safari &amp;&amp; osascript -e 'tell app "WebKit"' -e 'activate' -e 'do JavaScript "window.location.reload();" in first document' -e 'end tell'
</string>
<key>input</key>
<string>none</string>
View
4 Macros/Smart Indent.tmMacro
@@ -62,11 +62,9 @@
</dict>
</array>
<key>keyEquivalent</key>
- <string>~@[</string>
+ <string>~@{</string>
<key>name</key>
<string>Smart Indent</string>
- <key>scope</key>
- <string>disabled</string>
<key>uuid</key>
<string>3F45B2D4-FC42-4282-8FD5-8A74223AFCBC</string>
</dict>
View
98 Support/bin/42_TextMate_live_preview.rb
@@ -535,6 +535,12 @@ def svn?(path)
File.exists?(File.dirname(path) + '/.svn')
end
+def show_json
+ $CONTENTS.gsub!(/(?=['\\\n])/,'\\').gsub!(/</,'&lt;')
+ $CONTENTS = "document.write(pp(eval('(#$CONTENTS)')));"
+ run_javascript
+end
+
def run_javascript
# puts %{<script src="#{ENV['TM_SUPPORT_PATH']}/script/prototype.js" type="text/javascript"></script>} if ENV['TM_SCOPE'] =~ /prototype/
puts <<-HTML
@@ -544,6 +550,23 @@ def run_javascript
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Testing MooTools Code</title>
+ <style type="text/css" media="screen">
+ #debug{
+ font-size:10px;
+ line-height:13px;
+ font-size:10px;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;
+ }
+
+ #debug .string {background:#ffe;outline:1px solid #cc9;color:#663; *border:1px solid #cc9;color:#663; display: inline-block; padding: 0.25em 0.5em 0.25em 1.5em; margin-bottom:1px; text-indent:-1em;}
+ #debug .number {background:#fef;outline:1px solid #c9c;color:#636; *border:1px solid #c9c;color:#636; display: inline-block; padding: 0.25em 0.5em 0.25em 1.5em; margin-bottom:1px; text-indent:-1em;}
+ #debug .boolean{background:#eff;outline:1px solid #9cc;color:#366; *border:1px solid #9cc;color:#366; display: inline-block; padding: 0.25em 0.5em 0.25em 1.5em; margin-bottom:1px; text-indent:-1em;}
+ #debug .date {background:#ffe;outline:1px solid #cc9;color:#663; *border:1px solid #cc9;color:#663; display: inline-block; padding: 0.25em 0.5em 0.25em 1.5em; margin-bottom:1px; text-indent:-1em;}
+
+ #debug .object {background:#efe; border:1px solid #9c9;color:#363; display: inline-block; padding: 0.25em 0.5em; border-collapse:collapse;}
+ #debug .array {background:#fee; border:1px solid #c99;color:#633; display: inline-block; padding: 0.25em 0.5em; margin-left:1em;}
+ #debug .object th{text-align:right; padding-right:0.5em; vertical-align: top;}
+ #debug .object th+th{text-align:left;}
+ </style>
</head>
<body>
HTML
@@ -552,20 +575,73 @@ def run_javascript
#{File.read(File.dirname(__FILE__)+"/../js/mootools.js")}
</script>
HTML
+=begin
+curl -s http://mootools.net/download/get/mootools-core-edge.js > "$TM_DIRECTORY/../js/mootools.js"
+=end
puts <<-HTML
-<pre>
+<pre id="debug">
<script type="text/javascript" charset="utf-8">
+ Object.type = function(obj){
+ if (obj == undefined) return false;
+ if (Object.prototype.toString.call(obj) === '[object Array]') return 'array';
+ if (obj.nodeName){
+ switch (obj.nodeType){
+ case 1: return 'element';
+ case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
+ }
+ } else if (typeof obj.length == 'number'){
+ if (obj.callee) return 'arguments';
+ else if (obj.item) return 'collection';
+ }
+ return typeof obj;
+ };
+ function pp(object){
+ switch (Object.type(object)){
+ case 'object':
+ var h = '<table class="object"><tr><th>KEY</th><th>VALUE</th></tr>';
+ for (var key in object) {
+ var value = object[key];
+ h += '<tr><th> '+key+' </th><td> '+pp(value)+' </td></tr>'
+ }
+ h += '</table>'
+ return h
+
+ break;
+ case 'array':
+ var h = '<ol class="array" start="0">';
+ for (var key in object) {
+ var value = object[key];
+ h += '<li>'+pp(value)+'</li>'
+ }
+ h += '</ol>';
+ return h
+
+ break;
+ case false: return 'false'; break;
+ case 'string':
+ return '<span class="string">'+object.toString().replace(/^(http.*)$/,'<a href="$1">$1</a>')+'</span>';
+ break;
+ case 'number': return '<span class="number">'+object.toString()+'</span>'; break;
+ case 'boolean': return '<span class="boolean">'+object.toString()+'</span>'; break;
+ case 'date': return '<span class="date">'+object.toString()+'</span>'; break;
+ default: return '<span>'+object.toString()+'</span>';
+ }
+ };
+
+</script>
+<script>
+try{throw {}}catch(e){ window.__line=(e.line||0) + 3 };
try{
-//YOUR STUFF//
-//YOUR STUFF//
-//YOUR STUFF//
-
+/*---- YOUR CODE ----*/
#{$CONTENTS}
-
-//YOUR STUFF//
-//YOUR STUFF//
-//YOUR STUFF//
-}catch(e){ document.write(e) };
+/*---- /YOUR CODE ----*/
+}catch(e){
+ console.log(e);
+ var __line_offset = #{ENV['TM_INPUT_START_LINE'] || -1};
+ document.body.appendChild(
+ document.createTextNode("#{ENV['TM_FILEPATH']}:" + ((e.line||1) - __line + __line_offset) +"\\n"+ e.message||'')
+ );
+};
</script>
</pre>
HTML
@@ -675,6 +751,8 @@ def init
css_preview
when /^\s*text\.html/i
set_base
+ when /^\s*(source\.json)/i
+ show_json
when /^\s*(source\.js)/i
run_javascript
when /source\.ruby/
View
5,005 Support/js/mootools.js
2,554 additions, 2,451 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
3,161 Syntaxes/Python Indenty.tmLanguage
3,161 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
12 Syntaxes/Ruby Experimental.tmLanguage
@@ -83,7 +83,7 @@
</dict>
</dict>
<key>end</key>
- <string>(?&lt;=\))</string>
+ <string>(?&lt;=[a-zA-Z0-9_!?])(?=\()</string>
<key>name</key>
<string>meta.function-call.method.with-arguments.ruby</string>
<key>patterns</key>
@@ -102,17 +102,13 @@
<key>name</key>
<string>entity.name.function.ruby</string>
</dict>
- <dict>
- <key>include</key>
- <string>$self</string>
- </dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?=[a-zA-Z][a-zA-Z0-9_!?]*\()</string>
<key>end</key>
- <string>(?&lt;=\))</string>
+ <string>(?&lt;=[a-zA-Z0-9_!?])(?=\()</string>
<key>name</key>
<string>meta.function-call.ruby</string>
<key>patterns</key>
@@ -131,10 +127,6 @@
<key>name</key>
<string>entity.name.function.ruby</string>
</dict>
- <dict>
- <key>include</key>
- <string>$self</string>
- </dict>
</array>
</dict>
<dict>
View
2 info.plist
@@ -342,6 +342,7 @@
<string> subtleGradient</string>
<key>ordering</key>
<array>
+ <string>F374D795-04B1-46D6-AE45-8C329396FEAB</string>
<string>93C57002-422B-4693-BE73-79C5C2016E7A</string>
<string>BFA10BBE-6043-41CE-9629-B3A3B59C3A2C</string>
<string>1FF09E1A-CE96-4B55-9D02-6B3EA750C903</string>
@@ -465,6 +466,7 @@
<string>E69093C6-B78F-41A1-A304-7D1C0C614045</string>
<string>168AC018-81E3-4E53-AF5E-F819723B21DA</string>
<string>94053FBE-FA26-470C-A91D-A19BE266545D</string>
+ <string>741EAEB8-F871-425D-91F9-A4B087FEDFFB</string>
</array>
<key>uuid</key>
<string>3752EFF8-5401-46A5-AF20-07087E3933B2</string>

0 comments on commit 9353c91

Please sign in to comment.