Permalink
Browse files

Site updated at 2012-06-19 02:18:51 UTC

  • Loading branch information...
1 parent 9787c3d commit 082bea8aba350a92bf7d7a34efe1fd83faa793e5 @wongyouth committed Jun 19, 2012
View
@@ -4,7 +4,7 @@
<title><![CDATA[Wongyouth's Blog]]></title>
<link href="http://wongyouth.github.com/atom.xml" rel="self"/>
<link href="http://wongyouth.github.com/"/>
- <updated>2012-06-18T19:40:55+08:00</updated>
+ <updated>2012-06-19T10:18:14+08:00</updated>
<id>http://wongyouth.github.com/</id>
<author>
<name><![CDATA[Wongyouth]]></name>
@@ -24,10 +24,10 @@
<p>运行环境 ruby</p>
<pre><code>gem install capybara # install capybara
-ruby zha.rb # zha.rb在下方
+ruby zha.rb # zha.rb脚本
</code></pre>
-<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
+<figure class='code'><figcaption><span>zha.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
@@ -88,23 +88,13 @@ ruby zha.rb # zha.rb在下方
<span class='line-number'>59</span>
<span class='line-number'>60</span>
<span class='line-number'>61</span>
-<span class='line-number'>62</span>
-<span class='line-number'>63</span>
-<span class='line-number'>64</span>
-<span class='line-number'>65</span>
-<span class='line-number'>66</span>
-<span class='line-number'>67</span>
-<span class='line-number'>68</span>
-<span class='line-number'>69</span>
-<span class='line-number'>70</span>
-<span class='line-number'>71</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># encoding: utf-8</span>
</span><span class='line'><span class="c1">#</span>
</span><span class='line'><span class="c1"># 淘宝砸金蛋脚本</span>
</span><span class='line'><span class="c1"># 当前目录建立 tmall 文件放入帐号:密码,分号隔开</span>
</span><span class='line'><span class="c1">#</span>
-</span><span class='line'><span class="c1"># email to wongyouth@gmail.com</span>
-</span><span class='line'><span class="c1"># github blog http://wongyouth.github.com</span>
+</span><span class='line'><span class="c1"># mailto wongyouth@gmail.com</span>
+</span><span class='line'><span class="c1"># blog http://wongyouth.github.com</span>
</span><span class='line'>
</span><span class='line'><span class="nb">require</span> <span class="s1">&#39;rubygems&#39;</span>
</span><span class='line'><span class="nb">require</span> <span class="s1">&#39;capybara&#39;</span>
@@ -115,7 +105,7 @@ ruby zha.rb # zha.rb在下方
</span><span class='line'><span class="no">Capybara</span><span class="o">.</span><span class="n">app_host</span> <span class="o">=</span> <span class="s1">&#39;http://www.tmall.com&#39;</span>
</span><span class='line'>
</span><span class='line'><span class="k">def</span> <span class="nf">login</span>
-</span><span class='line'> <span class="n">username</span><span class="p">,</span> <span class="n">password</span> <span class="o">=</span> <span class="n">get_userinfo</span>
+</span><span class='line'> <span class="n">username</span><span class="p">,</span> <span class="n">password</span> <span class="o">=</span> <span class="no">IO</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s1">&#39;tmall&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'> <span class="n">visit</span><span class="p">(</span><span class="s1">&#39;http://login.tmall.com&#39;</span><span class="p">)</span>
</span><span class='line'>
@@ -129,16 +119,10 @@ ruby zha.rb # zha.rb在下方
</span><span class='line'> <span class="nb">puts</span> <span class="n">e</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
-</span><span class='line'><span class="k">def</span> <span class="nf">get_userinfo</span>
-</span><span class='line'> <span class="n">info</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="s1">&#39;../tmall&#39;</span><span class="p">,</span> <span class="bp">__FILE__</span><span class="p">),</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="p">{</span><span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span> <span class="p">}</span>
-</span><span class='line'> <span class="n">info</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">)</span>
-</span><span class='line'><span class="k">end</span>
-</span><span class='line'>
</span><span class='line'><span class="k">def</span> <span class="nf">setup_frame</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
</span><span class='line'> <span class="n">setup_jquery</span>
</span><span class='line'> <span class="n">page</span><span class="o">.</span><span class="n">execute_script</span> <span class="sx">%Q{</span>
</span><span class='line'><span class="sx"> jQuery(&#39;iframe&#39;).attr(&#39;name&#39;, &#39;</span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="sx">&#39;);</span>
-</span><span class='line'><span class="sx"> jQuery(&#39;iframe&#39;).attr(&#39;id&#39;, &#39;</span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="sx">&#39;);</span>
</span><span class='line'><span class="sx"> }</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
@@ -148,22 +132,18 @@ ruby zha.rb # zha.rb在下方
</span><span class='line'><span class="sx"> jq.src = &quot;http://code.jquery.com/jquery-latest.min.js&quot;;</span>
</span><span class='line'><span class="sx"> document.getElementsByTagName(&#39;head&#39;)[0].appendChild(jq);</span>
</span><span class='line'><span class="sx"> }</span>
-</span><span class='line'> <span class="nb">sleep</span> <span class="mi">3</span>
-</span><span class='line'> <span class="n">page</span><span class="o">.</span><span class="n">execute_script</span> <span class="sx">%Q{</span>
-</span><span class='line'><span class="sx"> jQuery.noConflict();</span>
-</span><span class='line'><span class="sx"> }</span>
-</span><span class='line'>
+</span><span class='line'> <span class="c1"># wait to load jquery</span>
+</span><span class='line'> <span class="nb">sleep</span> <span class="mi">2</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="k">def</span> <span class="nf">zha</span>
</span><span class='line'> <span class="n">visit</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
</span><span class='line'> <span class="mi">10000</span><span class="o">.</span><span class="n">downto</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span>
-</span><span class='line'> <span class="n">btn</span> <span class="o">=</span> <span class="n">find</span><span class="p">(</span><span class="s1">&#39;#J_Vol_Brick_Btn&#39;</span><span class="p">)</span>
-</span><span class='line'> <span class="n">btn</span><span class="o">.</span><span class="n">click</span>
-</span><span class='line'> <span class="nb">sleep</span> <span class="mi">0</span><span class="o">.</span><span class="mi">5</span>
+</span><span class='line'> <span class="n">find</span><span class="p">(</span><span class="s1">&#39;#J_Vol_Brick_Btn&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">click</span>
+</span><span class='line'> <span class="nb">sleep</span> <span class="mi">1</span>
</span><span class='line'> <span class="k">end</span>
-</span><span class='line'><span class="k">rescue</span> <span class="o">=&gt;</span> <span class="n">e</span>
-</span><span class='line'> <span class="nb">puts</span> <span class="n">e</span>
+</span><span class='line'><span class="k">rescue</span>
+</span><span class='line'> <span class="nb">sleep</span> <span class="mi">5</span>
</span><span class='line'> <span class="k">retry</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
@@ -11,13 +11,10 @@
<meta name="description" content="今天淘宝在砸猫猫,砸金蛋对抗京东店庆日。砸金蛋让人砸到手酸啊。
于是就写个脚本砸,虽然机会太微妙,不过看着自动砸挺开心哈。 运行环境 ruby gem install capybara # install capybara
-ruby zha.rb # zha.rb在下方 1
+ruby zha.rb # zha.rb脚本 zha.rb1
2
3
-4
-5
-6
-7 &hellip;">
+4 &hellip;">
<!-- http://t.co/dKP3o1e -->
@@ -106,10 +103,10 @@ <h1 class="entry-title">Tmall砸金蛋活动脚本</h1>
<p>运行环境 ruby</p>
<pre><code>gem install capybara # install capybara
-ruby zha.rb # zha.rb在下方
+ruby zha.rb # zha.rb脚本
</code></pre>
-<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
+<figure class='code'><figcaption><span>zha.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
@@ -170,23 +167,13 @@ <h1 class="entry-title">Tmall砸金蛋活动脚本</h1>
<span class='line-number'>59</span>
<span class='line-number'>60</span>
<span class='line-number'>61</span>
-<span class='line-number'>62</span>
-<span class='line-number'>63</span>
-<span class='line-number'>64</span>
-<span class='line-number'>65</span>
-<span class='line-number'>66</span>
-<span class='line-number'>67</span>
-<span class='line-number'>68</span>
-<span class='line-number'>69</span>
-<span class='line-number'>70</span>
-<span class='line-number'>71</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># encoding: utf-8</span>
</span><span class='line'><span class="c1">#</span>
</span><span class='line'><span class="c1"># 淘宝砸金蛋脚本</span>
</span><span class='line'><span class="c1"># 当前目录建立 tmall 文件放入帐号:密码,分号隔开</span>
</span><span class='line'><span class="c1">#</span>
-</span><span class='line'><span class="c1"># email to wongyouth@gmail.com</span>
-</span><span class='line'><span class="c1"># github blog http://wongyouth.github.com</span>
+</span><span class='line'><span class="c1"># mailto wongyouth@gmail.com</span>
+</span><span class='line'><span class="c1"># blog http://wongyouth.github.com</span>
</span><span class='line'>
</span><span class='line'><span class="nb">require</span> <span class="s1">&#39;rubygems&#39;</span>
</span><span class='line'><span class="nb">require</span> <span class="s1">&#39;capybara&#39;</span>
@@ -197,7 +184,7 @@ <h1 class="entry-title">Tmall砸金蛋活动脚本</h1>
</span><span class='line'><span class="no">Capybara</span><span class="o">.</span><span class="n">app_host</span> <span class="o">=</span> <span class="s1">&#39;http://www.tmall.com&#39;</span>
</span><span class='line'>
</span><span class='line'><span class="k">def</span> <span class="nf">login</span>
-</span><span class='line'> <span class="n">username</span><span class="p">,</span> <span class="n">password</span> <span class="o">=</span> <span class="n">get_userinfo</span>
+</span><span class='line'> <span class="n">username</span><span class="p">,</span> <span class="n">password</span> <span class="o">=</span> <span class="no">IO</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s1">&#39;tmall&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'> <span class="n">visit</span><span class="p">(</span><span class="s1">&#39;http://login.tmall.com&#39;</span><span class="p">)</span>
</span><span class='line'>
@@ -211,16 +198,10 @@ <h1 class="entry-title">Tmall砸金蛋活动脚本</h1>
</span><span class='line'> <span class="nb">puts</span> <span class="n">e</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
-</span><span class='line'><span class="k">def</span> <span class="nf">get_userinfo</span>
-</span><span class='line'> <span class="n">info</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="s1">&#39;../tmall&#39;</span><span class="p">,</span> <span class="bp">__FILE__</span><span class="p">),</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="p">{</span><span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span> <span class="p">}</span>
-</span><span class='line'> <span class="n">info</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">)</span>
-</span><span class='line'><span class="k">end</span>
-</span><span class='line'>
</span><span class='line'><span class="k">def</span> <span class="nf">setup_frame</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
</span><span class='line'> <span class="n">setup_jquery</span>
</span><span class='line'> <span class="n">page</span><span class="o">.</span><span class="n">execute_script</span> <span class="sx">%Q{</span>
</span><span class='line'><span class="sx"> jQuery(&#39;iframe&#39;).attr(&#39;name&#39;, &#39;</span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="sx">&#39;);</span>
-</span><span class='line'><span class="sx"> jQuery(&#39;iframe&#39;).attr(&#39;id&#39;, &#39;</span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="sx">&#39;);</span>
</span><span class='line'><span class="sx"> }</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
@@ -230,22 +211,18 @@ <h1 class="entry-title">Tmall砸金蛋活动脚本</h1>
</span><span class='line'><span class="sx"> jq.src = &quot;http://code.jquery.com/jquery-latest.min.js&quot;;</span>
</span><span class='line'><span class="sx"> document.getElementsByTagName(&#39;head&#39;)[0].appendChild(jq);</span>
</span><span class='line'><span class="sx"> }</span>
-</span><span class='line'> <span class="nb">sleep</span> <span class="mi">3</span>
-</span><span class='line'> <span class="n">page</span><span class="o">.</span><span class="n">execute_script</span> <span class="sx">%Q{</span>
-</span><span class='line'><span class="sx"> jQuery.noConflict();</span>
-</span><span class='line'><span class="sx"> }</span>
-</span><span class='line'>
+</span><span class='line'> <span class="c1"># wait to load jquery</span>
+</span><span class='line'> <span class="nb">sleep</span> <span class="mi">2</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="k">def</span> <span class="nf">zha</span>
</span><span class='line'> <span class="n">visit</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
</span><span class='line'> <span class="mi">10000</span><span class="o">.</span><span class="n">downto</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span>
-</span><span class='line'> <span class="n">btn</span> <span class="o">=</span> <span class="n">find</span><span class="p">(</span><span class="s1">&#39;#J_Vol_Brick_Btn&#39;</span><span class="p">)</span>
-</span><span class='line'> <span class="n">btn</span><span class="o">.</span><span class="n">click</span>
-</span><span class='line'> <span class="nb">sleep</span> <span class="mi">0</span><span class="o">.</span><span class="mi">5</span>
+</span><span class='line'> <span class="n">find</span><span class="p">(</span><span class="s1">&#39;#J_Vol_Brick_Btn&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">click</span>
+</span><span class='line'> <span class="nb">sleep</span> <span class="mi">1</span>
</span><span class='line'> <span class="k">end</span>
-</span><span class='line'><span class="k">rescue</span> <span class="o">=&gt;</span> <span class="n">e</span>
-</span><span class='line'> <span class="nb">puts</span> <span class="n">e</span>
+</span><span class='line'><span class="k">rescue</span>
+</span><span class='line'> <span class="nb">sleep</span> <span class="mi">5</span>
</span><span class='line'> <span class="k">retry</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
@@ -280,6 +257,12 @@ <h1 class="entry-title">Tmall砸金蛋活动脚本</h1>
<time datetime="2012-06-18T19:32:00+08:00" pubdate data-updated="true">2012-06-18</time>
+<span class="categories">
+
+ <a class='category' href='/blog/categories/ruby/'>ruby</a>
+
+</span>
+
</p>
View
@@ -10,10 +10,9 @@
<meta name="description" content="Blog Archive 2012 tmall砸金蛋活动脚本
-Jun 18 2012 Git分支常用操作
+Jun 18 2012 posted in ruby Git分支常用操作
Apr 26 2012 posted in git Git标签常用操作
-Apr 26 2012 posted in git 用octopress来写博客并发布到Github上
-Apr 21 &hellip;">
+Apr 26 2012 posted in git &hellip;">
<!-- http://t.co/dKP3o1e -->
@@ -86,6 +85,10 @@ <h1 class="entry-title">Blog Archive</h1>
<h1><a href="/blog/2012/06/18/tmall-za-jin-dan/">tmall砸金蛋活动脚本</a></h1>
<time datetime="2012-06-18T19:32:00+08:00" pubdate><span class='month'>Jun</span> <span class='day'>18</span> <span class='year'>2012</span></time>
+<footer>
+ <span class="categories">posted in <a class='category' href='/blog/categories/ruby/'>ruby</a></span>
+</footer>
+
</article>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: blog | Wongyouth's Blog]]></title>
<link href="http://wongyouth.github.com/blog/categories/blog/atom.xml" rel="self"/>
<link href="http://wongyouth.github.com/"/>
- <updated>2012-06-18T19:40:55+08:00</updated>
+ <updated>2012-06-19T10:18:14+08:00</updated>
<id>http://wongyouth.github.com/</id>
<author>
<name><![CDATA[Wongyouth]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: git | Wongyouth's Blog]]></title>
<link href="http://wongyouth.github.com/blog/categories/git/atom.xml" rel="self"/>
<link href="http://wongyouth.github.com/"/>
- <updated>2012-06-18T19:40:55+08:00</updated>
+ <updated>2012-06-19T10:18:14+08:00</updated>
<id>http://wongyouth.github.com/</id>
<author>
<name><![CDATA[Wongyouth]]></name>
@@ -4,7 +4,7 @@
<title><![CDATA[Category: github | Wongyouth's Blog]]></title>
<link href="http://wongyouth.github.com/blog/categories/github/atom.xml" rel="self"/>
<link href="http://wongyouth.github.com/"/>
- <updated>2012-06-18T19:40:55+08:00</updated>
+ <updated>2012-06-19T10:18:14+08:00</updated>
<id>http://wongyouth.github.com/</id>
<author>
<name><![CDATA[Wongyouth]]></name>
Oops, something went wrong.

0 comments on commit 082bea8

Please sign in to comment.