<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MyFunnyDev</title>
	<atom:link href="http://michalkuklis.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://michalkuklis.com/blog</link>
	<description>web, coding and beyond</description>
	<lastBuildDate>Tue, 09 Feb 2010 02:29:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Clojure syntax</title>
		<link>http://michalkuklis.com/blog/2010/02/02/clojure-syntax/</link>
		<comments>http://michalkuklis.com/blog/2010/02/02/clojure-syntax/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 05:36:49 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Clojure]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=287</guid>
		<description><![CDATA[Making a note for myself:

&#40;1 2 3 4&#41; // list
&#91;1 2 3 fred&#93; // vector
&#123;:a 1 :b 2 :c 3&#125;, &#123;1 &#34;a&#34; 2 &#34;b&#34;&#125; // map key/value
#&#123;a b c&#125; // set

]]></description>
			<content:encoded><![CDATA[<p>Making a note for myself:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #cc66cc;">2</span> <span style="color: #cc66cc;">3</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// list</span>
<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span> <span style="color: #cc66cc;">2</span> <span style="color: #cc66cc;">3</span> fred<span style="color: #009900;">&#93;</span> <span style="color: #666666; font-style: italic;">// vector</span>
<span style="color: #009900;">&#123;</span><span style="color: #339933;">:</span>a <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span>b <span style="color: #cc66cc;">2</span> <span style="color: #339933;">:</span>c <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#125;</span>, <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">1</span> <span style="color: #0000ff;">&quot;a&quot;</span> <span style="color: #cc66cc;">2</span> <span style="color: #0000ff;">&quot;b&quot;</span><span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// map key/value</span>
#<span style="color: #009900;">&#123;</span>a b c<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// set</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/02/02/clojure-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dfs in ruby :)</title>
		<link>http://michalkuklis.com/blog/2010/01/14/bfs-in-ruby/</link>
		<comments>http://michalkuklis.com/blog/2010/01/14/bfs-in-ruby/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 05:38:42 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=277</guid>
		<description><![CDATA[I wrote simple dfs in ruby:

def dfs&#40;node, value, queue&#41;
  return false if node.nil?	
  return true if node.data == value
&#160;
  queue.push node.right unless node.right.nil?
  queue.push node.left unless node.left.nil?	
&#160;
  dfs&#40;queue.pop, value, queue&#41;	
end

for node:

class Node
  attr_accessor :left, :right, :data
end

]]></description>
			<content:encoded><![CDATA[<p>I wrote simple dfs in ruby:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> dfs<span style="color:#006600; font-weight:bold;">&#40;</span>node, value, queue<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">false</span> <span style="color:#9966CC; font-weight:bold;">if</span> node.<span style="color:#0000FF; font-weight:bold;">nil</span>?	
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#9966CC; font-weight:bold;">if</span> node.<span style="color:#9900CC;">data</span> == value
&nbsp;
  queue.<span style="color:#9900CC;">push</span> node.<span style="color:#9900CC;">right</span> <span style="color:#9966CC; font-weight:bold;">unless</span> node.<span style="color:#9900CC;">right</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
  queue.<span style="color:#9900CC;">push</span> node.<span style="color:#9900CC;">left</span> <span style="color:#9966CC; font-weight:bold;">unless</span> node.<span style="color:#9900CC;">left</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?	
&nbsp;
  dfs<span style="color:#006600; font-weight:bold;">&#40;</span>queue.<span style="color:#9900CC;">pop</span>, value, queue<span style="color:#006600; font-weight:bold;">&#41;</span>	
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>for node:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Node
  attr_accessor <span style="color:#ff3333; font-weight:bold;">:left</span>, <span style="color:#ff3333; font-weight:bold;">:right</span>, <span style="color:#ff3333; font-weight:bold;">:data</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/01/14/bfs-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>class variables, class instance variables and instance variables in ruby</title>
		<link>http://michalkuklis.com/blog/2010/01/13/class-variable-class-instance-variables-and-instance-variables-in-ruby/</link>
		<comments>http://michalkuklis.com/blog/2010/01/13/class-variable-class-instance-variables-and-instance-variables-in-ruby/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 06:03:22 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=270</guid>
		<description><![CDATA[This was covered multiple times already. I&#8217;ve created this little snippet to remember the difference between different types of variables in ruby:

class A
  @@foo = &#34;class variable of the class A&#34;
  @foo = &#34;class instance variable of the class A&#34;
&#160;
  def instance_method
   @foo = &#34;instance variable of the class A&#34;
 [...]]]></description>
			<content:encoded><![CDATA[<p>This was covered multiple times already. I&#8217;ve created this little snippet to remember the difference between different types of variables in ruby:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> A
  @@foo = <span style="color:#996600;">&quot;class variable of the class A&quot;</span>
  <span style="color:#0066ff; font-weight:bold;">@foo</span> = <span style="color:#996600;">&quot;class instance variable of the class A&quot;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> instance_method
   <span style="color:#0066ff; font-weight:bold;">@foo</span> = <span style="color:#996600;">&quot;instance variable of the class A&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">class_method1</span>
    <span style="color:#008000; font-style:italic;"># class variables are visible to and shared by the instance and class methods</span>
    @@foo
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">class_method2</span>
    <span style="color:#008000; font-style:italic;"># class instance variables are visible to and shared by the class methods</span>
    <span style="color:#0066ff; font-weight:bold;">@foo</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>	
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">p</span> A.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">instance_method</span> <span style="color:#008000; font-style:italic;"># instance variable of the class A</span>
<span style="color:#CC0066; font-weight:bold;">p</span> A.<span style="color:#9900CC;">class_method1</span> <span style="color:#008000; font-style:italic;"># class variable of the class A</span>
<span style="color:#CC0066; font-weight:bold;">p</span> A.<span style="color:#9900CC;">class_method2</span> <span style="color:#008000; font-style:italic;"># class instance variable of the class A</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> B <span style="color:#006600; font-weight:bold;">&lt;</span> A
  @@foo = <span style="color:#996600;">&quot;class variable of the class B&quot;</span>
  <span style="color:#0066ff; font-weight:bold;">@foo</span> = <span style="color:#996600;">&quot;class instance variable of the class B&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">p</span> B.<span style="color:#9900CC;">class_method1</span> <span style="color:#008000; font-style:italic;"># class variable in B</span>
<span style="color:#008000; font-style:italic;"># class variable in A is overwritten by one in B !!!</span>
<span style="color:#CC0066; font-weight:bold;">p</span> A.<span style="color:#9900CC;">class_method1</span> <span style="color:#008000; font-style:italic;"># class variable in B</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">p</span> B.<span style="color:#9900CC;">class_method2</span> <span style="color:#008000; font-style:italic;"># class instance variable of the class B</span>
<span style="color:#008000; font-style:italic;"># class instance variable in A is NOT overwritten by one in B !!!</span>
<span style="color:#CC0066; font-weight:bold;">p</span> A.<span style="color:#9900CC;">class_method2</span> <span style="color:#008000; font-style:italic;"># class instance variable of the class A</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/01/13/class-variable-class-instance-variables-and-instance-variables-in-ruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>anemone with hpricot</title>
		<link>http://michalkuklis.com/blog/2010/01/11/anemone-with-hpricot/</link>
		<comments>http://michalkuklis.com/blog/2010/01/11/anemone-with-hpricot/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 05:06:32 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=265</guid>
		<description><![CDATA[Anemone is a pretty cool DSL used for web crawling. I used it with Hpricot to get a feeling for what&#8217;s possible. Below is a simple example which crawls and scrappes data from a popular polish real estate website otodom:

require 'rubygems'
require 'sanitize'
require 'anemone'
require 'open-uri'
require 'hpricot'
&#160;
#otodom.pl
Anemone.crawl&#40;&#34;http://otodom.pl/index.php?mod=search&#38;act=searchResults&#38;qid=46911208&#34;, 
&#123;:storage =&#62; Anemone::Storage.PStore&#40;&#34;crawl1.pstore&#34;&#41;&#125;&#41; do &#124; anemone &#124;
&#160;
  # filter [...]]]></description>
			<content:encoded><![CDATA[<p><a title="anemone" href="http://anemone.rubyforge.org/">Anemone</a> is a pretty cool DSL used for web crawling. I used it with <a title="hpricot" href="http://github.com/whymirror/hpricot">Hpricot</a> to get a feeling for what&#8217;s possible. Below is a simple example which crawls and scrappes data from a popular polish real estate website <a title="otodom" href="http://otodom.pl/">otodom</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'sanitize'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'anemone'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'open-uri'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'hpricot'</span>
&nbsp;
<span style="color:#008000; font-style:italic;">#otodom.pl</span>
Anemone.<span style="color:#9900CC;">crawl</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;http://otodom.pl/index.php?mod=search&amp;act=searchResults&amp;qid=46911208&quot;</span>, 
<span style="color:#006600; font-weight:bold;">&#123;</span>:storage <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#6666ff; font-weight:bold;">Anemone::Storage</span>.<span style="color:#CC00FF; font-weight:bold;">PStore</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;crawl1.pstore&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> anemone <span style="color:#006600; font-weight:bold;">|</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># filter out useless pages</span>
  anemone.<span style="color:#9900CC;">focus_crawl</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>page<span style="color:#006600; font-weight:bold;">|</span>
   page.<span style="color:#9900CC;">links</span>.<span style="color:#9900CC;">delete_if</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#006600; font-weight:bold;">&#40;</span>x.<span style="color:#9900CC;">to_s</span> =~ <span style="color:#006600; font-weight:bold;">/</span>mod=search<span style="color:#006600; font-weight:bold;">&amp;</span>act=searchResults<span style="color:#006600; font-weight:bold;">&amp;</span>qid=<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#9966CC; font-weight:bold;">and</span>
    <span style="color:#006600; font-weight:bold;">&#40;</span>x.<span style="color:#9900CC;">to_s</span> =~ <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#91;</span>a<span style="color:#006600; font-weight:bold;">-</span>zA<span style="color:#006600; font-weight:bold;">-</span>Z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">+-</span>id<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\.<span style="color:#9900CC;">html</span>$<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
   <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># process details pages</span>
  anemone.<span style="color:#9900CC;">on_pages_like</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#91;</span>a<span style="color:#006600; font-weight:bold;">-</span>zA<span style="color:#006600; font-weight:bold;">-</span>Z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">+-</span>id<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\.<span style="color:#9900CC;">html</span>$<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> page <span style="color:#006600; font-weight:bold;">|</span>
     doc = Hpricot<span style="color:#006600; font-weight:bold;">&#40;</span>page.<span style="color:#9900CC;">doc</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     price =  doc.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;//strong[@id='offerPrice']&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     location = doc.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;//dl[@class='stripeMe'] &gt; dd&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     desc = doc.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;//div[@id='offerDesc'] &gt; p&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     offer_no = doc.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;//div[@id='offerFoot'] p[@class='toLeft']/span/strong&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     created_at = doc.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;//div[@id='offerFoot'] p[@class='toRight']/span/strong&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     photos = doc.<span style="color:#9900CC;">search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;//div[@id='imageList']/p/a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/01/11/anemone-with-hpricot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Academia vs. Business</title>
		<link>http://michalkuklis.com/blog/2009/11/18/academia-vs-business/</link>
		<comments>http://michalkuklis.com/blog/2009/11/18/academia-vs-business/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 17:05:02 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=256</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.xkcd.com/comics/academia_vs_business.png" alt="Academia vs. Business" width="566" height="291" /></p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/11/18/academia-vs-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>blocks, procs and lambdas in ruby</title>
		<link>http://michalkuklis.com/blog/2009/11/17/blocks-procs-and-lambdas-in-ruby/</link>
		<comments>http://michalkuklis.com/blog/2009/11/17/blocks-procs-and-lambdas-in-ruby/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 04:12:20 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=252</guid>
		<description><![CDATA[Nice post about block, procs and lambdas in ruby by Robert Sosinski.
]]></description>
			<content:encoded><![CDATA[<p>Nice post <a href="http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/">about block, procs and lambdas in ruby</a> by Robert Sosinski.</p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/11/17/blocks-procs-and-lambdas-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>changing function&#8217;s context in javascript</title>
		<link>http://michalkuklis.com/blog/2009/10/31/changing-functions-context-in-javascript/</link>
		<comments>http://michalkuklis.com/blog/2009/10/31/changing-functions-context-in-javascript/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 04:24:23 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=243</guid>
		<description><![CDATA[Today I learned how to change the context of a function in javascript. When we do:

function test&#40;&#41; &#123;
  this.foo = &#34;Hello from &#34; + this + &#34; context.&#34;;
&#125;
test&#40;&#41;;
alert&#40;foo&#41;; // will show &#34;Hello from [object Window] context.&#34;;

foo will belong to the global context. In other words global object foo will be created. We can change [...]]]></description>
			<content:encoded><![CDATA[<p>Today I learned how to change the context of a function in javascript. When we do:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">foo</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Hello from &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; context.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>foo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// will show &quot;Hello from [object Window] context.&quot;;</span></pre></div></div>

<p>foo will belong to the global context. In other words global object foo will be created. We can change the context to some other object by doing:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> otherContext <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
test.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span>otherContext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>otherContext.<span style="color: #660066;">foo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// will show &quot;Hello from [object Object] context.&quot;</span></pre></div></div>

<p>In this case foo will belong to otherContext.</p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/10/31/changing-functions-context-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gemcutter &amp; Jeweler</title>
		<link>http://michalkuklis.com/blog/2009/10/17/gemcutter-jeweler/</link>
		<comments>http://michalkuklis.com/blog/2009/10/17/gemcutter-jeweler/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 05:03:47 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=240</guid>
		<description><![CDATA[More about gemcutter &#038; jeweler  can be found here.
Here are the steps how to publish patched gem cloned from github:
1. Append username to gem name in .gemspec or if you use jeweler open Rakefile and edit Jeweler::Tasks section save it and run:

rake gemspec

2. Build gem with:

gem build

3. Push new gem to gemcutter

gem push

]]></description>
			<content:encoded><![CDATA[<p>More about <a href="http://gemcutter.org/">gemcutter</a> &#038; <a href="http://github.com/technicalpickles/jeweler">jeweler </a> can be found <a href="http://railscasts.com/episodes/183-gemcutter-jeweler">here</a>.</p>
<p>Here are the steps how to publish patched gem cloned from github:</p>
<p>1. Append username to gem name in .gemspec or if you use jeweler open Rakefile and edit Jeweler::Tasks section save it and run:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rake gemspec</pre></div></div>

<p>2. Build gem with:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem build</pre></div></div>

<p>3. Push new gem to gemcutter</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem push</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/10/17/gemcutter-jeweler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BDD with Cucumber by Ben Mabey</title>
		<link>http://michalkuklis.com/blog/2009/08/29/bdd-with-cucumber/</link>
		<comments>http://michalkuklis.com/blog/2009/08/29/bdd-with-cucumber/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 16:16:33 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=235</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><embed src='http://mwrc2009.confreaks.com/player.swf' height='380' width='640' allowscriptaccess='always' allowfullscreen='true' flashvars='image=images%2F14-mar-2009-15-00-bdd-with-cucumber-ben-mabey-preview.png&#038;file=http%3A%2F%2Fmwrc2009.confreaks.com%2Fvideos%2F14-mar-2009-15-00-bdd-with-cucumber-ben-mabey-small.mp4&#038;plugins=viral-1'/></p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/08/29/bdd-with-cucumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>auto escaping html in Rails to protect from XSS</title>
		<link>http://michalkuklis.com/blog/2009/07/29/auto-escaping-html-in-rails-to-protect-from-xss/</link>
		<comments>http://michalkuklis.com/blog/2009/07/29/auto-escaping-html-in-rails-to-protect-from-xss/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 01:24:02 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=233</guid>
		<description><![CDATA[Tonight I found a plugin to auto escape html in order to protect from XSS attacks. I&#8217;m not sure why rails doesn&#8217;t do it out of the box (you have to use h() helper). Anyway the plugin is called xss_terminate and it can be found here. The cool thing about it is that now you [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight I found a plugin to auto escape html in order to protect from XSS attacks. I&#8217;m not sure why rails doesn&#8217;t do it out of the box (you have to use h() helper). Anyway the plugin is called xss_terminate and it can be found <a href="http://github.com/look/xss_terminate/tree/master">here</a>. The cool thing about it is that now you can forget about h() <img src='http://michalkuklis.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/07/29/auto-escaping-html-in-rails-to-protect-from-xss/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
