<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 21:59:37 +0000</lastBuildDate>
    <item>
      <title>(ActionScript 3) "Mini Strategy" pattern using namespaces - drukepple</title>
      <link>https://snipplr.com/view/27439/mini-strategy-pattern-using-namespaces</link>
      <description>&lt;p&gt;I sometimes use namespaces to implements a sort of "mini strategy pattern."&#13;
&#13;
This starts to pay off when you have more than one method that needs to do different things depending on the "mode" (or strategy). You have your "which mode am I on?" logic in one place (`set mode`) and then each mode-dependent method simply utilizes the `currentMode::someMethod()` technique.&#13;
&#13;
Not as fancy, robust, or strict as a proper strategy pattern with interfaces and strategy objects, but if you want to keep things sort of self-contained, have a small amount of strategies to consider, or don't want the end user to have to worry about creating the strategy objects, then I've found this useful.&lt;/p&gt;</description>
      <pubDate>Sun, 31 Jan 2010 14:41:25 UTC</pubDate>
      <guid>https://snipplr.com/view/27439/mini-strategy-pattern-using-namespaces</guid>
    </item>
    <item>
      <title>(ActionScript) String Search and Replace - drukepple</title>
      <link>https://snipplr.com/view/217/string-search-and-replace</link>
      <description>&lt;p&gt;Provides a quick and simple "find this string pattern and replace it with this other string pattern" find and replace.  Not fancy enough for regular expressions, but untill AS3 is standard this works well for most search/replace needs.&#13;
&#13;
Can be very handy for processing incoming text, whether via user input or from a database or otherwise.  For instance, searching for "\r" and replacing with "\n" or "" to control how line breaks flow.&lt;/p&gt;</description>
      <pubDate>Tue, 04 Jul 2006 13:00:55 UTC</pubDate>
      <guid>https://snipplr.com/view/217/string-search-and-replace</guid>
    </item>
  </channel>
</rss>
