Skip to content

Instantly share code, notes, and snippets.

@joshheartsy
Forked from hmcfletch/gist:1018085
Created July 1, 2011 21:43

Revisions

  1. joshheartsy revised this gist Jul 1, 2011. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -6,13 +6,12 @@

    // works for <% content_for :inline_js do -%>
    // can prefix :inline_js like :fb_inline_js
    // the end tag must be followed by an HTML comment: <!-- end :inline_js-->
    // <!-- end :fb_inline_js--> works as well
    // The end tag should contain <% end #end :inline_js %>

    {
    name = 'inline_js.rails.embedded.html';
    begin = '<%\s*(content_for)\s+(:.*inline_js)\s+(do)\s*-?%>';
    end = '<%\s*(end)\s*-?%>\s*(<!--\s*(end|END) :.*inline_js\s*-->)';
    end = '<%\s*(end)\s*(\#(end|END) :.*inline_js\s*-?%>\s*)';
    beginCaptures = {
    1 = { name = 'support.function.viewhelpers.rails'; };
    2 = { name = 'constant.other.symbol.double-quoted.ruby'; };
  2. joshheartsy revised this gist Jul 1, 2011. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -25,4 +25,17 @@
    patterns = (
    { include = 'source.js'; }
    );
    }
    }

    // Snippet to make this easier (ijs + tab key)
    // To create in textmate:
    // Bundles -> Bundle Editor
    // Add Snippet
    // Activation -> choose "Tab Trigger"
    // Choose a trigger, I used "ijs"
    <% content_for :inline_js do %>
    ${1:\$(document).ready(function(){
    ${0:$TM_SELECTED_TEXT}
    \});}
    <% end #end :inline_js %>

  3. @hmcfletch hmcfletch revised this gist Jun 11, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@

    // works for <% content_for :inline_js do -%>
    // can prefix :inline_js like :fb_inline_js
    // the end tag must have a comment like <% end # inline_js -%>
    // <% end # fb_inline_js %> works as well
    // the end tag must be followed by an HTML comment: <!-- end :inline_js-->
    // <!-- end :fb_inline_js--> works as well

    {
    name = 'inline_js.rails.embedded.html';
  4. @hmcfletch hmcfletch revised this gist Jun 11, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@
    {
    name = 'inline_js.rails.embedded.html';
    begin = '<%\s*(content_for)\s+(:.*inline_js)\s+(do)\s*-?%>';
    end = '<%\s*(end)\s*(#\s*.*inline_js)\s*-?%>';
    end = '<%\s*(end)\s*-?%>\s*(<!--\s*(end|END) :.*inline_js\s*-->)';
    beginCaptures = {
    1 = { name = 'support.function.viewhelpers.rails'; };
    2 = { name = 'constant.other.symbol.double-quoted.ruby'; };
  5. @hmcfletch hmcfletch revised this gist Jun 11, 2011. 1 changed file with 10 additions and 4 deletions.
    14 changes: 10 additions & 4 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -4,18 +4,24 @@
    // Edit HTML (Rails)
    // add to the patterns

    // Note: breaks if you embed a <% end %> within the js block
    // works for <% content_for :inline_js do -%>
    // can prefix :inline_js like :fb_inline_js
    // the end tag must have a comment like <% end # inline_js -%>
    // <% end # fb_inline_js %> works as well

    {
    name = 'inline_js.rails.embedded.html';
    begin = '<%\s+(content_for)\s+(:inline_js)\s+(do)\s+-?%>';
    end = '<%\s+(end)\s+-?%>';
    begin = '<%\s*(content_for)\s+(:.*inline_js)\s+(do)\s*-?%>';
    end = '<%\s*(end)\s*(#\s*.*inline_js)\s*-?%>';
    beginCaptures = {
    1 = { name = 'support.function.viewhelpers.rails'; };
    2 = { name = 'constant.other.symbol.double-quoted.ruby'; };
    3 = { name = 'keyword.control.def.ruby'; };
    };
    endCaptures = { 1 = { name = 'keyword.control.def.ruby'; }; };
    endCaptures = {
    1 = { name = 'keyword.control.def.ruby'; };
    2 = { name = 'comment.block.erb'; };
    };
    patterns = (
    { include = 'source.js'; }
    );
  6. @hmcfletch hmcfletch revised this gist Jun 11, 2011. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@
    // Edit HTML (Rails)
    // add to the patterns

    // Note: breaks if you embed a <% end %> within the js block

    {
    name = 'inline_js.rails.embedded.html';
    begin = '<%\s+(content_for)\s+(:inline_js)\s+(do)\s+-?%>';
  7. @hmcfletch hmcfletch revised this gist Jun 10, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    2 = { name = 'constant.other.symbol.double-quoted.ruby'; };
    3 = { name = 'keyword.control.def.ruby'; };
    };
    endCaptures = { 1 = { name = 'keyword.control.def.ruby'; }; }; // make it blue
    endCaptures = { 1 = { name = 'keyword.control.def.ruby'; }; };
    patterns = (
    { include = 'source.js'; }
    );
  8. @hmcfletch hmcfletch created this gist Jun 10, 2011.
    20 changes: 20 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // To edit:
    // Bundles -> Bundle Editor -> Edit Languages
    // Open Ruby on Rails
    // Edit HTML (Rails)
    // add to the patterns

    {
    name = 'inline_js.rails.embedded.html';
    begin = '<%\s+(content_for)\s+(:inline_js)\s+(do)\s+-?%>';
    end = '<%\s+(end)\s+-?%>';
    beginCaptures = {
    1 = { name = 'support.function.viewhelpers.rails'; };
    2 = { name = 'constant.other.symbol.double-quoted.ruby'; };
    3 = { name = 'keyword.control.def.ruby'; };
    };
    endCaptures = { 1 = { name = 'keyword.control.def.ruby'; }; }; // make it blue
    patterns = (
    { include = 'source.js'; }
    );
    }