<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.refactormycode.com,2007:users98</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/98" rel="self"/>
  <title>Dan Simard</title>
  <updated>Thu Dec 06 14:06:15 -0800 2007</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Code172</id>
    <published>2007-12-06T14:06:15-08:00</published>
    <updated>2011-05-14T08:33:22-07:00</updated>
    <title>[JavaScript] Javascript threading</title>
    <content type="html">&lt;p&gt;This submission is from a question I received on Javascript Kata (&lt;a href="http://www.javascriptkata.com/2007/12/06/ask-dan-more-on-javascript-threading/" target="_blank"&gt;http://www.javascriptkata.com/2007/12/06/ask-dan-more-on-javascript-threading/&lt;/a&gt;). Please read the post first and then try to refactor the code...&lt;/p&gt;

&lt;pre&gt;function startup() {
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;live&#226;&#8364;&#8482;,0)&#226;&#8364;&#157;,10000);
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;standby&#226;&#8364;&#8482;,1)&#226;&#8364;&#157;,10000);
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;dev&#226;&#8364;&#8482;,2)&#226;&#8364;&#157;,10000);
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;test1&#226;&#8364;&#178;,3)&#226;&#8364;&#157;,10000);
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;test2&#226;&#8364;&#178;,4)&#226;&#8364;&#157;,10000);
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;test3&#226;&#8364;&#178;,5)&#226;&#8364;&#157;,10000);
  setInterval(&#226;&#8364;&#157;pinger(&#226;&#8364;&#8482;test4&#226;&#8364;&#178;,6)&#226;&#8364;&#157;,10000);
}

function pinger(server,divit) {
  console=document.getElementById(&#226;&#8364;&#8482;ping_div&#226;&#8364;&#8482; + divit);
  console.innerHTML=&#226;&#8364;&#157;;
  sendRequest(&#226;&#8364;&#157;../php/ping_sys2.php?target=&#226;&#8364;&#157; + server);
}&lt;/pre&gt;</content>
    <author>
      <name>Dan Simard</name>
      <email>dsimard@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/172-javascript-threading" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor162</id>
    <published>2007-10-01T11:28:34-07:00</published>
    <title>[JavaScript] On Go Back To Yesterday</title>
    <content type="html">&lt;p&gt;I simplified things a little bit. I also made the &amp;quot;yesterday&amp;quot; relative to the date object. That way, you can have the &amp;quot;yesterday&amp;quot; of any date and not just the yesterday of today.&lt;/p&gt;

&lt;pre&gt;Date.prototype.getYesterday = function(){
  return d.setDate(d.getDate()-1);
}
var d = new Date();
document.write(d.getYesterday())

&lt;/pre&gt;</content>
    <author>
      <name>Dan Simard</name>
      <email>dsimard@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/38-go-back-to-yesterday/refactors/162" rel="alternate"/>
  </entry>
</feed>

