<?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>zuzara &#187; Create</title> <atom:link href="http://zuzara.com/blog/category/create/feed/" rel="self" type="application/rss+xml" /><link>http://zuzara.com/blog</link> <description>code and thoughts</description> <lastBuildDate>Fri, 03 Feb 2012 20:58:27 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Built a tiny website that shows iPhone apps featured in @TechCrunch</title><link>http://zuzara.com/blog/2012/02/03/built-a-tiny-website-that-shows-iphone-apps-featured-in-techcrunch/</link> <comments>http://zuzara.com/blog/2012/02/03/built-a-tiny-website-that-shows-iphone-apps-featured-in-techcrunch/#comments</comments> <pubDate>Fri, 03 Feb 2012 20:58:27 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=418</guid> <description><![CDATA[iPhone Apps Featured in @TechCrunch This website shows bunch of iPhone apps that are featured in TechCrunch. Top 25 apps on App Store is usually filled by games but those are not very attractive to me. TechCrunch writes about iPhone apps which were made by brand new startups, and I like to check them out. [...]]]></description> <content:encoded><![CDATA[<p><strong><a
href="http://tced.heroku.com/">iPhone Apps Featured in @TechCrunch</a></strong></p><p>This website shows bunch of iPhone apps that are featured in TechCrunch. Top 25 apps on App Store is usually filled by games but those are not very attractive to me. TechCrunch writes about iPhone apps which were made by brand new startups, and I like to check them out. So, to check those apps easily <a
href="http://tced.heroku.com/">here&#8217;s this website</a>.</p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2012/02/03/built-a-tiny-website-that-shows-iphone-apps-featured-in-techcrunch/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>A Chrome Extension: Keyboard Shortcuts for Facebook</title><link>http://zuzara.com/blog/2011/09/21/a-chrome-extension-keyboard-shortcuts-for-facebook/</link> <comments>http://zuzara.com/blog/2011/09/21/a-chrome-extension-keyboard-shortcuts-for-facebook/#comments</comments> <pubDate>Wed, 21 Sep 2011 08:07:27 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=349</guid> <description><![CDATA[The Chrome extension provides Gmail like keyboard shortcuts for Facebook. Currently it supports: j: down one item on your News Feed k: up u: jump to the top Download via Google Web Store Source code Thanks! keyboard icons]]></description> <content:encoded><![CDATA[<p><a
href="http://zuzara.com/blog/wp-content/uploads/2011/09/Untitled-2.png"><img
src="http://zuzara.com/blog/wp-content/uploads/2011/09/Untitled-2.png" alt="" title="Screenshot" width="440" height="280" class="alignnone size-full wp-image-350" /></a><br
/> The Chrome extension provides Gmail like keyboard shortcuts for Facebook. Currently it supports:</p><ul><li>j: down one item on your News Feed</li><li>k: up</li><li>u: jump to the top</li></ul><ul><li><a
href="https://chrome.google.com/webstore/detail/bjfnkbhnmhblmehgnnjglihlgcoiladc">Download via Google Web Store</a></li><li><a
href="https://github.com/zuzara/Keyboard-Shortcuts-for-Facebook">Source code</a></li></ul><p>Thanks!</p><ul><li><a
href="http://www.iconfinder.com/icondetails/64397/32/key_u_icon">keyboard icons</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2011/09/21/a-chrome-extension-keyboard-shortcuts-for-facebook/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Slanted tabular menu with CSS3</title><link>http://zuzara.com/blog/2011/07/30/slanted-tabular-menu-with-css3/</link> <comments>http://zuzara.com/blog/2011/07/30/slanted-tabular-menu-with-css3/#comments</comments> <pubDate>Sun, 31 Jul 2011 01:08:27 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=343</guid> <description><![CDATA[Some of variables are hard coded. To make it flexible, you may want to use JavaScript. The demo is a vertical menu, but making a horizontal menu shouldn&#8217;t be difficult. &#60;div style=&#34;margin-top:100px;&#34; class=&#34;slant&#34;&#62; &#60;div class=&#34;contents first&#34;&#62;menu1&#60;/div&#62; &#60;/div&#62; &#60;div class=&#34;slant second&#34;&#62; &#60;div class=&#34;contents&#34;&#62;menu2&#60;/div&#62; &#60;/div&#62; div.slant &#123; width: 150px; height: 100px; -moz-transform: matrix&#40;1, -0.2, 0, 1, 0, [...]]]></description> <content:encoded><![CDATA[<p>Some of variables are hard coded. To make it flexible, you may want to use JavaScript. The demo is a vertical menu, but making a horizontal menu shouldn&#8217;t be difficult.</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;div style=&quot;margin-top:100px;&quot; class=&quot;slant&quot;&gt;
    &lt;div class=&quot;contents first&quot;&gt;menu1&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;slant second&quot;&gt;
    &lt;div class=&quot;contents&quot;&gt;menu2&lt;/div&gt;
&lt;/div&gt;</pre></div></div><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;">div<span style="color: #6666ff;">.slant</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
    -moz-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> -<span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
 -webkit-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> -<span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
      -o-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> -<span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -ms-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> -<span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
         transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> -<span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> gold<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #6666ff;">.contents</span> <span style="color: #00AA00;">&#123;</span>
    -moz-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
 -webkit-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
      -o-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -ms-transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
         transform<span style="color: #00AA00;">:</span> matrix<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #6666ff;">.first</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> gold<span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-15px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #6666ff;">.second</span> <span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> brown<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p><strong><a
href="http://jsfiddle.net/zuzara/y6zCD/">Demo</a></strong>. <a
href="https://developer.mozilla.org/en/CSS/-moz-transform">CSS reference</a>.</p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2011/07/30/slanted-tabular-menu-with-css3/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Grabio: A Twitter Bio Update Notifier</title><link>http://zuzara.com/blog/2011/07/26/grabio-a-twitter-bio-update-notifier/</link> <comments>http://zuzara.com/blog/2011/07/26/grabio-a-twitter-bio-update-notifier/#comments</comments> <pubDate>Wed, 27 Jul 2011 06:17:10 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=321</guid> <description><![CDATA[Grabio sends notifications via email when your followings update their bio on Twitter. I&#8217;ve collaborated with @Tbakdesigns through Builditwith.me. In my experience, people update their bio when something big happened. I&#8217;m following more than 100 people and to be honest, I check quite rarely. But I would like to know their big updates like started [...]]]></description> <content:encoded><![CDATA[<p><strong><a
href="http://grabio.co/">Grabio</a></strong> sends notifications via email when your followings update their bio on Twitter. I&#8217;ve collaborated with <a
href="http://twitter.com/#!/Tbakdesigns">@Tbakdesigns</a> through <a
href="http://builditwith.me/">Builditwith.me</a>.</p><p><a
href="http://grabio.co/"><img
src="http://zuzara.com/blog/wp-content/uploads/2011/07/grabio.png" alt="" title="Grabio" width="528" height="326" class="alignnone size-full wp-image-323" /></a><br
/> In my experience, people update their bio when something big happened. I&#8217;m following more than 100 people and to be honest, I check quite rarely. But I would like to know their big updates like started a new company, moved to somewhere or found another hobby. So, <a
href="http://grabio.co/">Grabio</a> is here.</p><p>It is a dead simple application, just signup with Twitter account and enter your email address. You won&#8217;t get more than an email per a day. The contents of notifications would look like an output of &#8216;diff&#8217; command.</p><p><a
href="http://grabio.co/">Check Grabio out</a> <img
src='http://zuzara.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2011/07/26/grabio-a-twitter-bio-update-notifier/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Extracting thumbs-up tracks on Pandora, paste into Spotify playlist</title><link>http://zuzara.com/blog/2011/07/23/extracting-thumbs-up-tracks-on-pandora-paste-into-spotify-playlist/</link> <comments>http://zuzara.com/blog/2011/07/23/extracting-thumbs-up-tracks-on-pandora-paste-into-spotify-playlist/#comments</comments> <pubDate>Sun, 24 Jul 2011 01:34:27 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=305</guid> <description><![CDATA[Finally, Spotify is here in US. Pandora&apos;s endless recommendation works pretty well, but sometimes I would love to listen to one particular artist songs or one song repeatedly. It seems there&apos;s no way to export bookmarked songs on Pandora to anywhere, so made it. Download Pandora-to-Spotify Google Chrome Extension You need to use Google Chrome, [...]]]></description> <content:encoded><![CDATA[<p>Finally, <a
href="http://www.spotify.com/us/hello-america/">Spotify</a> is here in US. <a
href="http://www.pandora.com/">Pandora</a>&apos;s endless recommendation works pretty well, but sometimes I would love to listen to one particular artist songs or one song repeatedly. It seems there&apos;s no way to export bookmarked songs on Pandora to anywhere, so made it.</p><p><strong><a
href="https://chrome.google.com/webstore/detail/cgkmfkggcmoclhipfkabaemflflellek">Download Pandora-to-Spotify Google Chrome Extension</a></strong><br
/> <a
href="https://chrome.google.com/webstore/detail/cgkmfkggcmoclhipfkabaemflflellek"><img
src="http://zuzara.com/blog/wp-content/uploads/2011/07/Google-Chrome.png" alt="" title="Screenshot" width="432" height="544" class="alignnone size-full wp-image-383" /></a><br
/> You need to use <a
href="http://www.google.com/chrome/">Google Chrome</a>, may the latest version is required, simply download and install it with click the above link.</p><p>After that, let&#8217;s access your Pandora station page. The address looks like this: www.pandora.com/stations/1df87ce&#8230;random&#8230; You&#8217;ll find &#8216;Thumbed-up Tracks&#8217; on that page. You may want to click &#8216;show all&#8217; button. Then, hit the extension icon (I picked a brown bowl with chopsticks icon randomly). Probably most of tracks you thumbed-up will be extracted and converted to pastable Spotify formatted text. Finally, copy on the extension&#8217;s popup (Cmd-C if you use Mac) and paste (Cmd-V) on your playlist on Spotify. Of course, you need to run Spotify and create a playlist by yourself.</p><p>Unfortunately, there&#8217;s no bookmark page or something your bookmarked songs gathered, so need to access each station page respectively.</p><p>Hope it works and makes your music life even more fun.</p><p>Source code: <a
href="https://github.com/zuzara/Pandora-To-Spotify">https://github.com/zuzara/Pandora-To-Spotify</a></p><p><em>Update</em>:<br
/> <del
datetime="2011-09-21T17:01:13+00:00">Right, it&#8217;s not easy to find a way to access the station pages. Here&#8217;s a hint. Hit &#8216;options&#8217; then choose &#8216;Edit&#8217;. You&#8217;ll probably get a popup block alart. Allow to open a popup on pandora.com. You can also access the station page through &#8216;Your Profile&#8217; link. Unluckily, you can&#8217;t hit the extension icon on the popup because it doesn&#8217;t have Chrome&#8217;s navigation bar at all&#8230; Please copy its URL and open with another tab.</del></p><p><ins
datetime="2011-07-30T22:54:38+00:00">Update 7/30</ins>:<br
/> Here we go! The extension is on Chrome Webstore now.<br
/> Thanks for contributing, <a
href="https://github.com/briand">Brian</a> <img
src='http://zuzara.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>And, yes, <a
href="http://lifehacker.com/5825176/how-can-i-add-radio+like-playlists-to-spotify">Lifehacker gave me a link to this article</a>.</p><p><ins
datetime="2011-09-21T17:01:13+00:00">Update 9/21</ins>:<br
/> Now it supports Pandora&#8217;s new UI. <a
href="http://www.pandora.com/#/profile/feed">You&#8217;ll find your stations here</a>.</p><p><ins
datetime="2011-11-23T00:28:42+00:00">Update 11/18</ins>:<br
/> Supports extracting tracks from Bookmarks/Likes page respectively.</p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2011/07/23/extracting-thumbs-up-tracks-on-pandora-paste-into-spotify-playlist/feed/</wfw:commentRss> <slash:comments>40</slash:comments> </item> <item><title>Facebook Connect for Chrome Extension</title><link>http://zuzara.com/blog/2011/02/11/facebook-connect-for-chrome-extension/</link> <comments>http://zuzara.com/blog/2011/02/11/facebook-connect-for-chrome-extension/#comments</comments> <pubDate>Fri, 11 Feb 2011 20:09:28 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <category><![CDATA[chrome extension]]></category> <category><![CDATA[facebook]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=296</guid> <description><![CDATA[Unfortunately, Facebook JavaScript SDK doesn&#8217;t work on Chrome Extension because an extension is working with &#8220;chrome-extension://&#8221; protocol. Google provides a tutorial for using OAuth, but it seems there&#8217;s an easier way which is explained by Facebook. You can download source code from Github.]]></description> <content:encoded><![CDATA[<p>Unfortunately, <a
href="http://developers.facebook.com/docs/reference/javascript/">Facebook JavaScript SDK</a> doesn&#8217;t work on Chrome Extension because an extension is working with &#8220;chrome-extension://&#8221; protocol. Google provides <a
href="http://code.google.com/chrome/extensions/tut_oauth.html">a tutorial for using OAuth</a>, but it seems there&#8217;s an easier way which is <a
href="http://developers.facebook.com/docs/authentication/#client-side-flow">explained by Facebook</a>.</p><p>You can <a
href="https://github.com/zuzara/facebook-connect-for-chrome-extension">download source code from Github</a>.</p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2011/02/11/facebook-connect-for-chrome-extension/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>SweetCatcher for Skype is now on github</title><link>http://zuzara.com/blog/2010/06/06/sweetcatcher-for-skype-is-now-on-github/</link> <comments>http://zuzara.com/blog/2010/06/06/sweetcatcher-for-skype-is-now-on-github/#comments</comments> <pubDate>Sun, 06 Jun 2010 19:39:36 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <category><![CDATA[SweetCatcher]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=218</guid> <description><![CDATA[One year ago I released SweetCatcher for Skype. Now it is on github. I haven&#8217;t had any chances to upgrade it, but it might be worth to be open source. You can use a normal icon instead of the lovely heart one. SweetCatcher is using some codes from SkypeAPITest which is provided by Skype. I [...]]]></description> <content:encoded><![CDATA[<p>One year ago I released <a
href="http://zuzara.com/blog/2009/06/30/sweetcatcher-for-skype-first-release/">SweetCatcher for Skype</a>. Now <a
href="http://github.com/zuzara/SweetCatcher">it is on github</a>. I haven&#8217;t had any chances to upgrade it, but it might be worth to be open source. You can use a normal icon instead of the lovely heart one.</p><p>SweetCatcher is using some codes from SkypeAPITest which is provided by Skype. I couldn&#8217;t find a license for SkypeAPITest, but it seems it&#8217;s under public license (I found a repository on github that includes SkypeAPITest).</p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2010/06/06/sweetcatcher-for-skype-is-now-on-github/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>jQuery plugin for Twitter OAuth via popup window (Facebook style)</title><link>http://zuzara.com/blog/2010/05/15/jquery-plugin-for-twitter-oauth-via-popup-window-facebook-style/</link> <comments>http://zuzara.com/blog/2010/05/15/jquery-plugin-for-twitter-oauth-via-popup-window-facebook-style/#comments</comments> <pubDate>Sun, 16 May 2010 02:37:06 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <category><![CDATA[jquery]]></category> <category><![CDATA[oauth]]></category> <category><![CDATA[pecl_oauth]]></category> <category><![CDATA[php]]></category> <category><![CDATA[twitter]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=194</guid> <description><![CDATA[Disqus and some applications are using Twitter OAuth, but their user flow is not sequential single window process. A child window comes up, then it shows twitter.com and user can click Deny/Allow through that popup. When the user hits the deny or allow button, the popup will be closed immediately and the parent window will [...]]]></description> <content:encoded><![CDATA[<p>Disqus and some applications are using Twitter OAuth, but their user flow is not sequential single window process. A child window comes up, then it shows twitter.com and user can click Deny/Allow through that popup. When the user hits the deny or allow button, the popup will be closed immediately and the parent window will be reloaded. I couldn&#8217;t find a jQuery plugin for that, so wrote a tiny one.</p><p><ins
datetime="2011-07-27T03:15:24+00:00">Updates:</ins><br
/> Current Twitter shows &#8216;Authorize app&#8217; and &#8216;No, thanks&#8217; button respectively instead of Deny/Allow.</p><ul><li><a
href="http://zuzara.org/pub/oauth_popup/">Demo</a></li><li><a
href="https://github.com/zuzara/jQuery-OAuth-Popup">Download from Github</a></li></ul><p>When you make a complete script, you may want to use PHP with PECL_OAuth. (% pecl install oauth-beta)</p><p>Here are sample files:<br
/> <strong>index.php</strong></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Twitter OAuth via popup&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;jquery.oauthpopup.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
    $('#connect').click(function(){
        $.oauthpopup({
            path: 'connect.php',
            callback: function(){
                window.location.reload();
            }
        });
    });
});
&lt;/script&gt;
&lt;div&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
&lt;input type=&quot;button&quot; value=&quot;Connect with Twitter&quot; id=&quot;connect&quot; /&gt;&lt;br /&gt;
&lt;a href=&quot;signout.php&quot;&gt;Sign Out&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div><p><strong>connect.php</strong></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TWITTER_CONSUMER_KEY'</span><span style="color: #339933;">,</span>      <span style="color: #0000ff;">'***'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TWITTER_CONSUMER_SECRET'</span><span style="color: #339933;">,</span>   <span style="color: #0000ff;">'***'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TWITTER_REQUEST_URL'</span><span style="color: #339933;">,</span>       <span style="color: #0000ff;">'https://api.twitter.com/oauth/request_token'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TWITTER_ACCESS_URL'</span><span style="color: #339933;">,</span>        <span style="color: #0000ff;">'https://api.twitter.com/oauth/access_token'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TWITTER_AUTHORIZE_URL'</span><span style="color: #339933;">,</span>     <span style="color: #0000ff;">'https://api.twitter.com/oauth/authorize'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'twitter'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    setOAuth<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'twitter'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> getUserInfo<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> setOAuth<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//  pecl_oauth</span>
    <span style="color: #000088;">$oauth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OAuth<span style="color: #009900;">&#40;</span>TWITTER_CONSUMER_KEY<span style="color: #339933;">,</span> TWITTER_CONSUMER_SECRET<span style="color: #339933;">,</span> OAUTH_SIG_METHOD_HMACSHA1<span style="color: #339933;">,</span> OAUTH_AUTH_TYPE_FORM<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enableDebug</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    try <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setToken</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$accessToken</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAccessToken</span><span style="color: #009900;">&#40;</span>TWITTER_ACCESS_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$accessToken</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$accessToken</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLastResponse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #990000;">parse_str</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #339933;">,</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Authentication failed.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$requestToken</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestToken</span><span style="color: #009900;">&#40;</span>TWITTER_REQUEST_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$requestToken</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: '</span> <span style="color: #339933;">.</span> TWITTER_AUTHORIZE_URL <span style="color: #339933;">.</span> <span style="color: #0000ff;">'?oauth_token='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$requestToken</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_token'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debugInfo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getUserInfo<span style="color: #009900;">&#40;</span><span style="color: #000088;">$token</span><span style="color: #339933;">,</span> <span style="color: #000088;">$secret</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$oauth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OAuth<span style="color: #009900;">&#40;</span>TWITTER_CONSUMER_KEY<span style="color: #339933;">,</span> TWITTER_CONSUMER_SECRET<span style="color: #339933;">,</span> OAUTH_SIG_METHOD_HMACSHA1<span style="color: #339933;">,</span> OAUTH_AUTH_TYPE_URI<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setToken</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$token</span><span style="color: #339933;">,</span> <span style="color: #000088;">$secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://twitter.com/account/verify_credentials.json'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$buf</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLastResponse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buf</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Connect&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script&gt;
window.close();
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div><p><strong>signout.php</strong></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">session_destroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #339933;">;</span></pre></div></div><p>Hope it helps <img
src='http://zuzara.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2010/05/15/jquery-plugin-for-twitter-oauth-via-popup-window-facebook-style/feed/</wfw:commentRss> <slash:comments>16</slash:comments> </item> <item><title>Bracket auto completion in vim for PHPer</title><link>http://zuzara.com/blog/2010/01/25/bracket-auto-completion-in-vim-for-phper/</link> <comments>http://zuzara.com/blog/2010/01/25/bracket-auto-completion-in-vim-for-phper/#comments</comments> <pubDate>Tue, 26 Jan 2010 04:11:39 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <category><![CDATA[vim]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=127</guid> <description><![CDATA[I used to use this setting in .vimrc: inoremap \&#40; &#40; inoremap &#40; &#40;&#41;&#60;LEFT&#62; But escape bracket every time for second\&#40;first&#40;&#41;; is a little bit stressful. (typed &#8220;first()&#8221;, then move to the head of the line, typing &#8220;second&#8221;, back slash and bracket) Here is an improved script: function! CompleteDetachedBracket&#40;&#41; let line = line&#40;'.'&#41; let col [...]]]></description> <content:encoded><![CDATA[<p>I used to use this setting in .vimrc:</p><div
class="wp_syntax"><div
class="code"><pre class="vim" style="font-family:monospace;">inoremap \<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span>
inoremap <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>LEFT<span style="color: #000000;">&gt;</span></pre></div></div><p>But escape bracket every time for</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">second\<span style="color: #009900;">&#40;</span>first<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>is a little bit stressful. (typed &#8220;first()&#8221;, then move to the head of the line, typing &#8220;second&#8221;, back slash and bracket)</p><p>Here is an improved script:</p><div
class="wp_syntax"><div
class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #804040;">function</span><span style="color: #000000;">!</span> CompleteDetachedBracket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #804040;">let</span> <span style="color: #25BB4D;">line</span> = <span style="color: #25BB4D;">line</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'.'</span><span style="color: #000000;">&#41;</span>
    <span style="color: #804040;">let</span> <span style="color: #25BB4D;">col</span> = <span style="color: #25BB4D;">col</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'.'</span><span style="color: #000000;">&#41;</span>
    <span style="color: #804040;">let</span> c = <span style="color: #25BB4D;">getline</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #25BB4D;">col</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
    <span style="color: #804040;">execute</span> <span style="color: #C5A22D;">&quot;normal <span style="">\&lt;</span>RIGHT&gt;%&quot;</span>
    <span style="color: #804040;">if</span> c == <span style="color: #C5A22D;">&quot;$&quot;</span>
        <span style="color: #804040;">execute</span> <span style="color: #C5A22D;">&quot;normal 2wi)&quot;</span>
    <span style="color: #804040;">elseif</span> <span style="color: #25BB4D;">line</span> <span style="color: #000000;">!</span>= <span style="color: #25BB4D;">line</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'.'</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">||</span> <span style="color: #25BB4D;">col</span> <span style="color: #000000;">!</span>= <span style="color: #25BB4D;">col</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'.'</span><span style="color: #000000;">&#41;</span>
        <span style="color: #804040;">execute</span> <span style="color: #C5A22D;">&quot;normal a)&quot;</span>
    <span style="color: #804040;">else</span>
        <span style="color: #804040;">execute</span> <span style="color: #C5A22D;">&quot;normal a)&quot;</span>
        startinsert
    <span style="color: #804040;">endif</span>
endfunction
inoremap <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&lt;</span>ESC<span style="color: #000000;">&gt;:</span><span style="color: #804040;">call</span> CompleteDetachedBracket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #668080;">&lt;CR&gt;</span></pre></div></div><p>This is the first time to code vim script for me. I was guessing vim script is a weird language, so have avoided long time. But at least coding small one is not so difficult than I thought. <a
href="http://vimdoc.sourceforge.net/htmldoc/usr_41.html">Documentation</a> is very organized. There are many sample codes in your .vim/plugin directory. Not like a GUI programming, but still like a Tetris. It maybe just because of the first time, I think it&#8217;s pretty fun.</p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2010/01/25/bracket-auto-completion-in-vim-for-phper/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Complete working sample for Services_Twitter OAuth in PHP PEAR</title><link>http://zuzara.com/blog/2010/01/20/complete-working-sample-for-services_twitter-oauth-in-php-pear/</link> <comments>http://zuzara.com/blog/2010/01/20/complete-working-sample-for-services_twitter-oauth-in-php-pear/#comments</comments> <pubDate>Wed, 20 Jan 2010 21:59:38 +0000</pubDate> <dc:creator>Nobu</dc:creator> <category><![CDATA[Create]]></category> <category><![CDATA[oauth]]></category> <category><![CDATA[pear]]></category> <category><![CDATA[php]]></category> <category><![CDATA[twitter]]></category> <guid
isPermaLink="false">http://zuzara.com/blog/?p=117</guid> <description><![CDATA[You can get some sample codes for Services_Twitter with OAuth from php doc, but it&#8217;s not a complete code. I rewrote some parts. % pear install --alldeps Services_Twitter-alpha &#60;?php if &#40;isset&#40;$_GET&#91;'clear'&#93;&#41;&#41; &#123; // sometimes you need to clear session, just access ?clear=1 session_start&#40;&#41;; $_SESSION = array&#40;&#41;; session_destroy&#40;&#41;; die&#40;'session has been cleared.'&#41;; &#125; &#160; &#160; define&#40;'CONSUMER_KEY', [...]]]></description> <content:encoded><![CDATA[<p>You can get some sample codes for Services_Twitter with OAuth from <a
href="http://pear.php.net/package/Services_Twitter/docs/0.5.0/Services_Twitter/Services_Twitter.html">php doc</a>, but it&#8217;s not a complete code. I rewrote some parts.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> pear <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--alldeps</span> Services_Twitter-alpha</pre></div></div><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'clear'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// sometimes you need to clear session, just access ?clear=1</span>
    <span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$_SESSION</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">session_destroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'session has been cleared.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CONSUMER_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'***'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CONSUMER_SECRET'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'***'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Services/Twitter.php'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'HTTP/OAuth/Consumer.php'</span><span style="color: #339933;">;</span>
&nbsp;
try <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token_secret2'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$twitter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Services_Twitter<span style="color: #339933;">;</span>
        <span style="color: #000088;">$oauth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTP_OAuth_Consumer<span style="color: #009900;">&#40;</span>CONSUMER_KEY<span style="color: #339933;">,</span> CONSUMER_SECRET<span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token_secret2'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOAuth</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$oauth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">statuses</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">home_timeline</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_verifier'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$twitter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Services_Twitter<span style="color: #339933;">;</span>
        <span style="color: #000088;">$oauth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTP_OAuth_Consumer<span style="color: #009900;">&#40;</span>CONSUMER_KEY<span style="color: #339933;">,</span> CONSUMER_SECRET<span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token_secret'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAccessToken</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://twitter.com/oauth/access_token'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oauth_verifier'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOAuth</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$oauth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token2'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getToken</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token_secret2'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTokenSecret</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">statuses</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;I'm coding with PEAR right now!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$oauth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTP_OAuth_Consumer<span style="color: #009900;">&#40;</span>CONSUMER_KEY<span style="color: #339933;">,</span> CONSUMER_SECRET<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestToken</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://twitter.com/oauth/request_token'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://zuzara.com/twitter_oauth.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// callback URL should be the same as that you registered at http://twitter.com/apps/new</span>
&nbsp;
        <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token'</span><span style="color: #009900;">&#93;</span>        <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getToken</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'token_secret'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTokenSecret</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$oauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAuthorizeUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://twitter.com/oauth/authorize'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #990000;">http_redirect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// function from pecl_http</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>ref.<br
/> <a
href="http://stackoverflow.com/questions/688766/getting-401-on-twitter-oauth-post-requests/2480218#2480218">Getting 401 on Twitter OAuth POST requests</a></p><p>related article.<br
/> <a
href="http://zuzara.com/blog/2010/04/29/how-to-make-an-autobot-on-twitter-without-basic-authentication/">How to Make an Autobot on Twitter with OAuth, not Basic Authentication</a></p> ]]></content:encoded> <wfw:commentRss>http://zuzara.com/blog/2010/01/20/complete-working-sample-for-services_twitter-oauth-in-php-pear/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> </channel> </rss>
