Inspired by Dan Wilson's post on CFEclipse snippets, I thought I'd post some as well. I have a lot of similar snippets to the ones Dan showed in his post, but I also have some shorter but equally useful snippets that I wanted to share. I hope folks find them useful, they sure eliminate a lot of typing for me!

Trigger Text: qloop

<cfloop query="$${queryName}">
</cfloop>
		

Trigger Text: aloop

<cfloop from="1" to="#ArrayLen($${arrayName})#" index="$${indexName}">
</cfloop>
		

Trigger Text: sloop

<cfloop collection="#$${structName}#" item="$${itemName}">
</cfloop>
		

Trigger Text: lloop

<cfloop list="#$${listName}#" index="$${indexName}" delimiters=",">
</cfloop>
		

Trigger Text: lset

<cfset local.$${varName} = $${varValue} />
		

Trigger Text: vi

variables.instance.$${varName}
		

Trigger Text: try

<cftry>

	<cfcatch type="any">
	
	</cfcatch>
</cftry>
		

Comments Comments (8) | del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 8166 Views

Comments

  • # Posted By Dan | 7/10/07 1:07 PM

    Very Nice Brian, I like the idea for the separate loops.. good job!

  • # Posted By erikv | 7/10/07 3:11 PM

    I like these:

    Trigger Text: commentStart
    <!---

    Trigger Text: commentStop
    --->

    Trigger Text: tableRowStart
    <tr>

    Trigger Text: tableRowEnd
    </tr>

  • # Posted By Brian | 7/10/07 3:13 PM

    Why on earth would you do that, Eric? The trigger text is more than the snippet content.

  • # Posted By erikv | 7/10/07 3:38 PM

    Just having some fun, adding a little flava.

    Don't forget case sensitive snippets:

    Trigger Text:
    tableColumnBeginAllCapitalLetters:
    <TD>

  • # Posted By Brian | 7/10/07 3:40 PM

    Oh I see, you were kidding! Yes, one doesn't want to go so far with the snippets that they are more work than just writing the code. But for really common things, or things that you can easily mistype, I think the snippets are great. I use the hell out of these things.

  • # Posted By charlie arehart | 7/10/07 5:45 PM

    Hey Brian, what timing. I notice this is the first blog entry you've labelled in a CFEclipse category, though you your site search shows 4 more.

    You may wonder how I noticed this. :-) Well, I just in the past few minutes posted a 2-part blog entry I'd done where I list over 70 bloggers who have CFE content, and I split it among those who did and those who did not have a CFE-specific category or tag to find their cfontent.

    http://carehart.org/blog/client/index.cfm/2007/7/1...

    http://carehart.org/blog/client/index.cfm/2007/7/1..._part2" target="_blank">http://carehart.org/blog/client/index.cfm/2007/7/1...

    The thing is, I had you listed in the 2nd part, though I pointed out the 4 CFEclipse entries I'd found using your site search (which I did for all the other bloggers I'd found with CFE content but no CFE category).

    Now, I'd want to move you to the list in part 1, but I'd like to rank you with 5 entries, not just the 1 now listed under your CFEclipse tag. (I won't be keeping the list that accurate from now on, but given the incredible coincidence of timing, I'm happy to do it for yours today.)

    If you can't be bothered to go back and tag the old entries with that CFEclipse tag, just let me know, and I'll still move you to the first list, with just the 1 entry for now.

    Hope you and other CFEclipse readers here find this useful. Feel free to spread the word if you think it is.

  • # Posted By charlie arehart | 7/10/07 5:48 PM

    That's curious. In my comment just then, the second entry URL I offered somehow was munged by BlogCFC. Let me try again:

    http://carehart.org/blog/client/index.cfm/2007/7/1...

    (that _part2 should appear at the end of the URL. In the previous comment, it showed up after it, not as a part of it.)

    Hope it works this time.

  • # Posted By Jamie Krug | 7/12/07 5:03 PM

    Thanks, Brian! I really like the separate loops idea. Here are some corresponding snippets for the cfscripting side of things...

    //trigger text: for
    for ($${initial-expression}; $${test-expression}; $${final-expression}) {
       
    }

    //trigger text: afor
    for ($${indexName}=1; i LTE arrayLen($${arrayName}); $${indexName}=$${indexName}+1) {
       
    }

    //trigger text: lfor
    for ($${indexName}=1; i LTE listLen($${listVar}, "$${delimiters:,}"); $${indexName}=$${indexName}+1) {
       
    }

    //trigger text: sfor
    for ($${keyName} IN $${structName}) {
       
    }