<?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>Sosuke &#187; JavaScript</title>
	<atom:link href="http://www.sosuke.com/index.php/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sosuke.com</link>
	<description>Dark music of the gods.</description>
	<lastBuildDate>Sat, 02 Feb 2013 04:06:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Launching the TheKnot.com Search BETA</title>
		<link>http://www.sosuke.com/index.php/2012/12/24/launching-the-theknot-com-search-beta/</link>
		<comments>http://www.sosuke.com/index.php/2012/12/24/launching-the-theknot-com-search-beta/#comments</comments>
		<pubDate>Mon, 24 Dec 2012 22:31:38 +0000</pubDate>
		<dc:creator>Barrett Sonntag</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Website Analysis]]></category>

		<guid isPermaLink="false">http://www.sosuke.com/?p=199</guid>
		<description><![CDATA[My major project of 2012, TheKnot.com Search BETA, launched earlier this month, the morning of December 14th, and it was a journey worth documenting. It began back in May when the company decided to start our own labs or internal incubator groups. One began right away in New York City and the other started a [...]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-210" alt="Screen Shot 2012-12-24 at 4.22.03 PM" src="http://www.sosuke.com/wp-content/uploads/2012/12/Screen-Shot-2012-12-24-at-4.22.03-PM-300x174.png" width="300" height="174" /></p>
<p>My major project of 2012, <a href="http://search.theknot.com/search/?q=eden%20bridals">TheKnot.com Search BETA</a>, launched earlier this month, the morning of December 14th, and it was a journey worth documenting. It began back in May when the company decided to start our own labs or internal incubator groups. One began right away in New York City and the other started a couple weeks later in Austin. I had the opportunity to join the Austin group with a team of developers and product people that I highly respected. I was grinning the whole time with excitement. With the direction that we were independent from the company but had access to the data we sequestered ourselves in a room for a few weeks. Over pots of coffee and pints of beer after work we brainstormed our some good ideas for our brides to find inspiration for their weddings. Our group started out as Judy Galani, Product Strategist, Forrest Andrews and Matt Oehlers, Senior Software Engineers, Erin Bender, Freelance Art Director, and myself as Interactive Media Developer. We &#8220;sold&#8221; the idea and working prototype to our &#8220;investors&#8221; by October and it was then time to go from prototype to production.</p>
<p>We had to take the design in house from this point on, but after a fond farewell and thank you to Erin we started to add in more management to the group. It was a <a href="http://en.wikipedia.org/wiki/Greenfield_project">greenfield project</a> so our back-end developers Matt and Forrest were excited to push forward into new territories. Within a day or two we were able to deploy projects straight from Visual Studio to the AWS servers, I was blown away. Forrest focused on our <a href="http://www.mongodb.org/">MongoDB NoSQL</a> data store and the API that I would later pull all the front-end content from, <a href="http://www.asp.net/mvc">ASP.NET MVC</a>. Matt worked on massaging the data into <a href="http://lucene.apache.org/solr/">Apache Solr</a> and in a matter of days we had an impressive result set coming back for queries.</p>
<p><img class="alignleft size-medium wp-image-212" alt="Screen Shot 2012-12-24 at 4.22.40 PM copy" src="http://www.sosuke.com/wp-content/uploads/2012/12/Screen-Shot-2012-12-24-at-4.22.40-PM-copy-196x300.png" width="196" height="300" /></p>
<p>The front-end technology was built to be a responsive two page website that used a combination ofjQuery and <a href="http://underscorejs.org/">Underscore.js</a> along with HTML and CSS to create a multi-device interface that would be familiar and easy to use. The <a href="http://search.theknot.com/search/?q=eden%20bridals">main grid view</a> uses <a href="http://masonry.desandro.com/">Masonry</a> to create the Pinterest-esque layout for search results and Underscore.js templates to load in a different layout for different data types. The <a href="http://search.theknot.com/search/single?q=eden%20bridals">single page view</a> focuses on a low browser width touch interface to give a very image focused search experience. To combine and minify the page scripts down I used the <a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification">BundleCollection</a> library in ASP.NET MVC which worked great. There are still a large number of extra scripts on the page but I&#8217;ve tried to load them asynchronously and not let them interfere with using the interface immediately.</p>
<p>The site has been up and working great for a few weeks now and launched along side a new look and feel for <a href="http://TheKnot.com">TheKnot.com</a>. Go take a look, and of course let me know if you find any bugs here or on the feedback tab on the bottom!</p>
<p><span id="more-199"></span></p>
<hr style="clear: left;" />
<p>&nbsp;</p>
<p><strong>Search beta team at launch:</strong><br />
Forrest Andrews<br />
Judy Galani<br />
Keith Higbee<br />
Ringo Lertprecha<br />
Matt Oehlers<br />
Barrett Sonntag</p>
<p><strong>Special thanks:</strong><br />
Erin Bender<br />
Rob Fassino<br />
David Liu<br />
Carley Roney<br />
Matthew Rook<br />
Jason Sirota<br />
All our loved ones patience!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sosuke.com/index.php/2012/12/24/launching-the-theknot-com-search-beta/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Pinterest sharing to your iOS app</title>
		<link>http://www.sosuke.com/index.php/2012/05/08/adding-pinterest-sharing-to-your-ios-app/</link>
		<comments>http://www.sosuke.com/index.php/2012/05/08/adding-pinterest-sharing-to-your-ios-app/#comments</comments>
		<pubDate>Wed, 09 May 2012 00:14:25 +0000</pubDate>
		<dc:creator>Barrett Sonntag</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Pinterest]]></category>

		<guid isPermaLink="false">http://www.sosuke.com/?p=171</guid>
		<description><![CDATA[Update: It looks like this latest version of Pinterest has removed the URL scheme to post directly to the app. I do hope they add it back in with another update. I&#8217;ve been working on a new version of the iOS app, Wedding Dress Look Book by The Knot, and I wanted to add in sharing [...]]]></description>
				<content:encoded><![CDATA[<p><strong>Update:</strong> It looks like this latest version of Pinterest has removed the URL scheme to post directly to the app. I do hope they add it back in with another update.</p>
<p>I&#8217;ve been working on a new version of the iOS app, <a title="Wedding Dress Look Book by The Knot" href="http://itunes.apple.com/us/app/wedding-dress-look-book-by/id362763144?mt=8" target="_blank">Wedding Dress Look Book by The Knot</a>, and I wanted to add in sharing features for the most popular networks. This a wedding dress browsing and sharing app, it has to be the top three social networks, Facebook, Twitter, and of course, Pinterest. I know that Pinterest doesn&#8217;t have a public sharing API yet, but I use there app on my iPhone, and I have a good idea of how it works. For Facebook and Twitter I find out that iOS supports <a href="http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html" target="_blank">URL Schemes</a>, which allow me to just open an app as I would open Safari. Just change the protocol, http for regular URLs, to the name of the app. I found a site that has a list of all sorts of apps that support this, fb:// for Facebook, twitter:// for the Twitter app etc. Unfortunately they didn&#8217;t have Pinterest, but an easy guess of pinterest:// launched the app right away, though I didn&#8217;t know of the options, and I still couldn&#8217;t find any documentation. I started to think about how the Pin It bookmark works, the URL scheme must be inside that JavaScript file that Pinterest loads onto the site in mobile Safari. After running the file, <a href="http://passets-cdn.pinterest.com/js/pinmarklet.js" target="_blank">http://passets-cdn.pinterest.com/js/pinmarklet.js</a>, through a <a href="http://jsbeautifier.org/" target="_blank">Javascript Beautifier</a> we can see Pinterest developers speak lolcat with plenty of hazSite and hazIOS. That was it!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>51
52
53
54
55
56
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">v</span>.<span style="color: #660066;">hazIOS</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	a.<span style="color: #660066;">w</span>.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		a.<span style="color: #660066;">w</span>.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;pinit12://&quot;</span> <span style="color: #339933;">+</span> e
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">25</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	a.<span style="color: #660066;">w</span>.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;http://&quot;</span> <span style="color: #339933;">+</span> e
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> a.<span style="color: #660066;">w</span>.<span style="color: #660066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://&quot;</span> <span style="color: #339933;">+</span> e<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;pin&quot;</span> <span style="color: #339933;">+</span> f<span style="color: #339933;">,</span> a.<span style="color: #660066;">a</span>.<span style="color: #660066;">pop</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>Pinterest&#8217;s URL scheme is pinit12, I&#8217;m guessing 12 is a version number. A little more digging around and I came up with a list of working parameters.</p>
<p><strong>URL Scheme: </strong>pinit12://pinterest.com/pin/create/bookmarklet/?</p>
<ul>
<li><strong>media</strong>: a direct link to the image or I think an encoded image (base64?)</li>
<li><strong>url</strong>: the URL of the source website where the image was found</li>
<li><strong>description</strong>: 500 characters max</li>
<li><strong>is_video</strong>: self describing</li>
</ul>
<p>Since this code isn&#8217;t officially supported it is subject to change, and thankfully there is a way to future proof your app from having a broken link. You are able to check if a URL can be opened without actually opening it in iOS. The trick then is prepping your URL, seeing if it can be opening, and only then displaying the option to share with Pinterest. Using a UIActionSheet, with ARC enabled, this is what I came up with.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">int</span> count <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;
UIActionSheet <span style="color: #002200;">*</span>sheet <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIActionSheet alloc<span style="color: #002200;">&#93;</span> initWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> delegate<span style="color: #002200;">:</span>self cancelButtonTitle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> destructiveButtonTitle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> otherButtonTitles<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Email&quot;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>post <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;pinit12://pin/create/bookmarklet/?media=%@&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://yourdomain.com/yourimage.jpg&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>escapedStringURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>post stringByAddingPercentEscapesUsingEncoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span>escapedStringURL<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span> canOpenURL<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>sheet addButtonWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Pinterest&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">++</span>count;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">&#91;</span>sheet addButtonWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Cancel&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>sheet setCancelButtonIndex<span style="color: #002200;">:</span>count<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>This way, in case the URL scheme changes from pinit12 in the future it won&#8217;t break your application.</p>
<p>It has been added as a URL scheme to <a href="http://wiki.akosma.com/IPhone_URL_Schemes">http://wiki.akosma.com/IPhone_URL_Schemes</a>, most links seem to hit that listing. Thanks <a href="https://twitter.com/#!/akosmasoftware">@akosmasoftware</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sosuke.com/index.php/2012/05/08/adding-pinterest-sharing-to-your-ios-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Magic Eight Ball with the Raphaël JavaScript Library (1.5.2)</title>
		<link>http://www.sosuke.com/index.php/2011/04/12/magic-eight-ball-with-the-raphael-javascript-library-1-5-2/</link>
		<comments>http://www.sosuke.com/index.php/2011/04/12/magic-eight-ball-with-the-raphael-javascript-library-1-5-2/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 17:46:31 +0000</pubDate>
		<dc:creator>Barrett Sonntag</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Website Analysis]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[PNG]]></category>
		<category><![CDATA[Raphael]]></category>

		<guid isPermaLink="false">http://www.sosuke.com/?p=96</guid>
		<description><![CDATA[Wrigley&#8217;s Magic Weight Ball is my first project using the Raphaël JavaScript Library and it just went live. I used Raphaël JS version 1.5.2 which you can download from GitHub. The project requirements came through as only being an iPad version that responded to a shake event. Getting to use a new technology for a [...]]]></description>
				<content:encoded><![CDATA[<p>Wrigley&#8217;s Magic Weight Ball is my first project using the <a href="http://raphaeljs.com/">Raphaël JavaScript Library</a> and it just went live. I used Raphaël JS version 1.5.2 which you can download from <a href="https://github.com/DmitryBaranovskiy/raphael/">GitHub</a>. The project requirements came through as only being an iPad version that responded to a shake event. Getting to use a new technology for a front-end project where you only have to support one resolution and one browser is an excellent opportunity to try new things. I knew in the back of my head that they would want a non-shakeable static version as well but they just didn&#8217;t ask for it yet. Internet Explorer still came into consideration when I was evaluating technology solutions because I was certain it would come up eventually.</p>
<p>When I saw the <a href="http://www.nissanusa.com/leaf-electric-car/">Nissan Leaf</a> site I was blown away by the heavy JavaScript animations being used. It really reminded me of the early Flash animations and sites in a way. The <a href="http://news.ycombinator.com/item?id=2234379">Hacker News submission</a> I saw the site from pointed out that the animations were being handled by the Raphaël JavaScript Library. This was still fresh in my mind when I got this project so I loaded up the Raphaël demos pages in a ever browser I test on, IE6-9, Safari, Firefox and Chrome and they all worked! This was the library for this project.</p>
<p>I finished up the iPad version of the site <a href="http://content.theknot.com/sitelets/magic-weight-ball/ipad">http://content.theknot.com/sitelets/magic-weight-ball/ipad</a> which requires iOS 4.2 or higher and was pretty happy with the results. It responds to a full shake event to give you another tip, the tip will bob lightly in the water when moved a little bit and the tip orients to the iPad. When the tip is touched it provides a little modal with more details. The site even supports landscape and portrait viewing.</p>
<p>About half way through developing the iPad version the email I was expecting arrived. &#8220;Oh no!&#8221; they said, &#8220;We need a static non-shakable version for desktop users to visit.&#8221; I was already prepared though. When I though about a desktop version I first defaulted to Flash but I wanted to give Raphaël a try first. With a <a href="http://www.dillerdesign.com/experiment/DD_belatedPNG/">IE6 PNG alpha transparency fix</a> and a small work around for <a href="http://stackoverflow.com/questions/5068408/raphael-js-how-to-update-the-source-of-an-image/5476932#5476932">IE to get the Raphaël image src</a> it was up and running on the desktop.</p>
<p>You can visit <a href="http://content.theknot.com/sitelets/magic-weight-ball/">http://content.theknot.com/sitelets/magic-weight-ball/</a> to see the result and if you happen to hit the page in an iPad you will get a slightly modified version that still responds to the shake events, always giving the best experience possible.</p>
<p>The weight ball interface itself is a series of 3 layered PNG images. The top most image is a 24bit eight ball and the rest of the tips, triangles and back black images are all 8bit PNG images with the a properly picked matte color. The total site size was reduced as much as possible and the designers loved the look. I reduced the number of colors where ever possible and used a pattern dither, it really seemed to look the best even though it bumped up the file size a bit.</p>
<p>For this animation interface the Raphaël JavaScript Library was a perfect fit and I was able to provide a cross platform and cross browser experience that I was very proud of.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sosuke.com/index.php/2011/04/12/magic-eight-ball-with-the-raphael-javascript-library-1-5-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
