<?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>Wed, 10 Jun 2026 17:28:49 +0000</lastBuildDate>
    <item>
      <title>(JavaScript) Javascript encapsualtion via the module pattern - housecor</title>
      <link>https://snipplr.com/view/52014/javascript-encapsualtion-via-the-module-pattern</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 13 Apr 2011 12:55:23 UTC</pubDate>
      <guid>https://snipplr.com/view/52014/javascript-encapsualtion-via-the-module-pattern</guid>
    </item>
    <item>
      <title>(JavaScript) Access server side C# variabes in javascript - housecor</title>
      <link>https://snipplr.com/view/51738/access-server-side-c-variabes-in-javascript</link>
      <description>&lt;p&gt;Options:&#13;
1. Write the desired values into a hidden field that contains json. Reference the hidden field by ID and parse the json to get the desired vars. &#13;
2. Call a webmethod that returns the values in json format&#13;
3. Write js via the code-behind that writes the variables to the page in a separate script tag. The js is placed inline in the page. Call: 			Page.ClientScript.RegisterClientScriptBlock. See example below.&#13;
&#13;
&#13;
So why is putting the entire javasscript in a string within the code-behind a lousy idea?&#13;
1. No code coloring&#13;
2. No syntax checking&#13;
3. Have to escape quotes which makes it hard to read and adds work&#13;
4. JS isn't cached since it's a string sitting within the html, unlike an attached .js file.&#13;
5. No separation of concerns. Client script should ideally be in a .js file to keep server side business logic from being intermingled with other concerns.&#13;
6. Inability to reuse. A useful .js file can be called from multiple pages. js stored in a string of a code-behind is page specific.&#13;
7. No IDE assistance for formatting or intellisense support&lt;/p&gt;</description>
      <pubDate>Fri, 08 Apr 2011 01:51:18 UTC</pubDate>
      <guid>https://snipplr.com/view/51738/access-server-side-c-variabes-in-javascript</guid>
    </item>
    <item>
      <title>(JavaScript) Show preloader message when page is unloading - housecor</title>
      <link>https://snipplr.com/view/46891/show-preloader-message-when-page-is-unloading</link>
      <description>&lt;p&gt;This works cross browser. Merely using onclick on a submit button to show a preloader/ please wait dialog doesn't work in IE since it doesn't show images once the page is being unloaded.&lt;/p&gt;</description>
      <pubDate>Tue, 11 Jan 2011 04:03:34 UTC</pubDate>
      <guid>https://snipplr.com/view/46891/show-preloader-message-when-page-is-unloading</guid>
    </item>
    <item>
      <title>(JavaScript) Google API JS short call - housecor</title>
      <link>https://snipplr.com/view/42585/google-api-js-short-call</link>
      <description>&lt;p&gt;Be sure to call the exact version desired or the script is only cached for one hour!&#13;
&#13;
http://encosia.com/2009/10/11/do-you-know-about-this-undocumented-google-cdn-feature/&lt;/p&gt;</description>
      <pubDate>Wed, 20 Oct 2010 06:29:52 UTC</pubDate>
      <guid>https://snipplr.com/view/42585/google-api-js-short-call</guid>
    </item>
    <item>
      <title>(JavaScript) Umlimited arguments to function - housecor</title>
      <link>https://snipplr.com/view/40933/umlimited-arguments-to-function</link>
      <description>&lt;p&gt;Pass as many arguments as you wish. You can access them in the arguments array.&lt;/p&gt;</description>
      <pubDate>Thu, 23 Sep 2010 05:05:09 UTC</pubDate>
      <guid>https://snipplr.com/view/40933/umlimited-arguments-to-function</guid>
    </item>
    <item>
      <title>(JavaScript) Default parameters - housecor</title>
      <link>https://snipplr.com/view/40932/default-parameters</link>
      <description>&lt;p&gt;This sets b to 3 if b isn\'t passed. So all params all optional.&lt;/p&gt;</description>
      <pubDate>Thu, 23 Sep 2010 05:03:33 UTC</pubDate>
      <guid>https://snipplr.com/view/40932/default-parameters</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript scope - housecor</title>
      <link>https://snipplr.com/view/40931/javascript-scope</link>
      <description>&lt;p&gt;There are two scopes in JavaScript: global and function. If you don\'t declare a variable (using var), it assumes global. \r\n\r\nVariables declared in functions have function scope.&lt;/p&gt;</description>
      <pubDate>Thu, 23 Sep 2010 05:01:56 UTC</pubDate>
      <guid>https://snipplr.com/view/40931/javascript-scope</guid>
    </item>
    <item>
      <title>(JavaScript) Format string as money - housecor</title>
      <link>https://snipplr.com/view/40536/format-string-as-money</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 15 Sep 2010 23:31:29 UTC</pubDate>
      <guid>https://snipplr.com/view/40536/format-string-as-money</guid>
    </item>
    <item>
      <title>(JavaScript) Enforce maxlength for all textareas on page - housecor</title>
      <link>https://snipplr.com/view/40504/enforce-maxlength-for-all-textareas-on-page</link>
      <description>&lt;p&gt;Just be sure to slap the div for the chars left message within the same div/p as the textarea so the dom walk works.&lt;/p&gt;</description>
      <pubDate>Wed, 15 Sep 2010 11:22:25 UTC</pubDate>
      <guid>https://snipplr.com/view/40504/enforce-maxlength-for-all-textareas-on-page</guid>
    </item>
  </channel>
</rss>
