<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>每天看看《JavaScript设计模式》</description><title>Hey! OCEAN here!</title><generator>Tumblr (3.0; @oceanhere)</generator><link>http://oceanhere.tumblr.com/</link><item><title>String replace all:

var...</title><description>&lt;p&gt;String replace all:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var str="&amp;lt;&amp;gt;";
str=str.replace(/\'/g,"’");//替换半角单引号为全角单引号
str=str.replace(/\"/g,"”");//替换半角双引号为全角双引号
str=str.replace(/&amp;lt;/g,"《").replace(/&amp;gt;/g,"》");
&lt;/code&gt;&lt;/pre&gt;</description><link>http://oceanhere.tumblr.com/post/49848987043</link><guid>http://oceanhere.tumblr.com/post/49848987043</guid><pubDate>Tue, 07 May 2013 19:35:40 +0800</pubDate><category>javascript</category></item><item><title>POST with AnglarJS $http</title><description>&lt;p&gt;Default &lt;code&gt;conten-type&lt;/code&gt; is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;application/json;charset=UTF-8
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Need to change it and the data you sent with it:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stackoverflow.com/questions/11442632/how-can-i-make-angular-js-post-data-as-form-data-instead-of-a-request-payload/13490145#13490145"&gt;How can I make angular.js post data as form data instead of a request payload?&lt;/a&gt;&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/49773177250</link><guid>http://oceanhere.tumblr.com/post/49773177250</guid><pubDate>Mon, 06 May 2013 21:40:33 +0800</pubDate><category>javascript</category></item><item><title>AngularJS - Communication Between Controllers &amp; Directive - jsFiddle</title><description>&lt;a href="http://jsfiddle.net/simpulton/GeAAB/"&gt;AngularJS - Communication Between Controllers &amp; Directive - jsFiddle&lt;/a&gt;: &lt;p&gt;虽然感觉特别搓，但直接按&lt;a href="http://www.egghead.io/video/HXpHV5gWgyk"&gt;egghead里service方法&lt;/a&gt;写，通过&lt;code&gt;input.value&lt;/code&gt;的方法改变model值时two way binding竟然不生效，又不会用&lt;code&gt;$watch&lt;/code&gt;，最后还是这招解决了。&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/49683673169</link><guid>http://oceanhere.tumblr.com/post/49683673169</guid><pubDate>Sun, 05 May 2013 21:28:05 +0800</pubDate><category>javascript</category></item><item><title>javascript - check all extensions from a multiple upload file input - Stack Overflow</title><description>&lt;a href="http://stackoverflow.com/questions/14390757/check-all-extensions-from-a-multiple-upload-file-input"&gt;javascript - check all extensions from a multiple upload file input - Stack Overflow&lt;/a&gt;</description><link>http://oceanhere.tumblr.com/post/49432954707</link><guid>http://oceanhere.tumblr.com/post/49432954707</guid><pubDate>Thu, 02 May 2013 20:20:12 +0800</pubDate><category>javascript</category></item><item><title>How to change the Content of a  with Javascript - Stack Overflow</title><description>&lt;a href="http://stackoverflow.com/questions/1642447/how-to-change-the-content-of-a-textarea-with-javascript"&gt;How to change the Content of a  with Javascript - Stack Overflow&lt;/a&gt;: &lt;p&gt;For all the downvoters and non-believers.&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/48839020613</link><guid>http://oceanhere.tumblr.com/post/48839020613</guid><pubDate>Thu, 25 Apr 2013 14:34:05 +0800</pubDate><category>js</category></item><item><title>那些年,我们看过的各种设计理论法则</title><description>&lt;a href="http://www.uisdc.com/design-theory-law"&gt;那些年,我们看过的各种设计理论法则&lt;/a&gt;: &lt;p&gt;skeumorphic and flat(Barcelona)&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/48764345126</link><guid>http://oceanhere.tumblr.com/post/48764345126</guid><pubDate>Wed, 24 Apr 2013 17:29:39 +0800</pubDate><category>web</category><category>Design</category></item><item><title>.htaccess</title><description>&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.freewebmasterhelp.com/tutorials/htaccess/"&gt;.htaccess Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.htaccess-guide.com/"&gt;.htaccess Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Remove &lt;code&gt;index.php&lt;/code&gt; in the URL for Codeigniter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Options -Indexes

&amp;lt;IfModule mod_rewrite.c&amp;gt;

    RewriteEngine on
    RewriteBase /selfcontrol/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d 

    #Uncomment one of the following rewrite rules. 
    #Some servers require the ? after index.php, some don't

    #RewriteRule ^(.*)$ index.php?/$1 [NC,L,QSA]
    RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]

&amp;lt;/IfModule&amp;gt;

&amp;lt;IfModule !mod_rewrite.c&amp;gt;
    ErrorDocument 404 index.php
&amp;lt;/IfModule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description><link>http://oceanhere.tumblr.com/post/48678574469</link><guid>http://oceanhere.tumblr.com/post/48678574469</guid><pubDate>Tue, 23 Apr 2013 14:23:28 +0800</pubDate><category>web</category></item><item><title>ASCII and Binary</title><description>&lt;ol&gt;&lt;li&gt;FTP在传送文件时分为ASC和Bin两种格式，只有文字文件(例如 html 文件)使用ASC，其他的通通使用Bin格式(例如图像文件、压缩文件、可执行文件等等)。&lt;/li&gt;
&lt;li&gt;当我们使用ftp时，可简单地把文件分为两种基本类型：文本文件和二进制文件；文本文件也称为ASCII文件，其文件内容遵循ASCII的定义，其主要特征是文件内容由若干行组成，可以使用操作系统的显示、编辑命令来显示和编辑ASCII文件的内容，它使用的传输模式是asc；二进制文件（Binary File）是指除ASCII文件以外的所有文件格式，它使用的传输模式是bin；需要注意的是，可以将ASCII文件按二进制模式传输，但决不能将二进制文件按ASCII模式传输，否则二进制文件的内容会遭到破坏而无法使用。&lt;/li&gt;
&lt;li&gt;ASCII 切换传输模式为文字模式（只能用来传送文字文件）；
BINARY 切换传输模式为二进制模式（除文字文件外皆用此模式）；&lt;/li&gt;
&lt;li&gt;文字文件传输推荐ASC而程序或数据文件必须使用BIN。&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;From: &lt;a href="http://blog.csdn.net/xljiulong/article/details/7029842"&gt;FTP中传输模式：BIN与ASC的差别&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;.htaccess要用ASCII传。&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/48676639010</link><guid>http://oceanhere.tumblr.com/post/48676639010</guid><pubDate>Tue, 23 Apr 2013 13:37:49 +0800</pubDate><category>web</category></item><item><title>Elapsed Time: Why Video Discovery Startups All Fail</title><description>&lt;a href="http://www.hunterwalk.com/2013/04/why-video-discovery-startups-all-fail.html"&gt;Elapsed Time: Why Video Discovery Startups All Fail&lt;/a&gt;</description><link>http://oceanhere.tumblr.com/post/48604485542</link><guid>http://oceanhere.tumblr.com/post/48604485542</guid><pubDate>Mon, 22 Apr 2013 18:39:02 +0800</pubDate><category>web</category></item><item><title>世界上有两类软件公司：一类像工厂，而另一类像电影摄制组</title><description>&lt;a href="http://www.36kr.com/p/201366.html"&gt;世界上有两类软件公司：一类像工厂，而另一类像电影摄制组&lt;/a&gt;</description><link>http://oceanhere.tumblr.com/post/48602449790</link><guid>http://oceanhere.tumblr.com/post/48602449790</guid><pubDate>Mon, 22 Apr 2013 17:20:53 +0800</pubDate><category>web</category></item><item><title>Upload And Preview Image Without Refresh</title><description>&lt;blockquote&gt;
  &lt;p&gt;When we use the iframeSubmit function, we’ll have the form point to upload.php for image submissions and the result will be loaded within the iframe (which is now a hidden element in the page). The upload.php script should process the submission and generate an iframe content which will call the function defined and passed by iframeSubmit, with the results of the operation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That&amp;#8217;s the key.&lt;/p&gt;

&lt;p&gt;From: &lt;a href="http://tech.cibul.net/upload-and-display-an-image-without-a-page-refresh/"&gt;Upload and display an image without a page refresh&lt;/a&gt;.&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/48599579928</link><guid>http://oceanhere.tumblr.com/post/48599579928</guid><pubDate>Mon, 22 Apr 2013 15:29:14 +0800</pubDate><category>js</category></item><item><title>地震.css</title><description>&lt;p&gt;地震.css&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;html { 
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
    filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
    zoom: 1;
}
&lt;/code&gt;&lt;/pre&gt;</description><link>http://oceanhere.tumblr.com/post/48449042048</link><guid>http://oceanhere.tumblr.com/post/48449042048</guid><pubDate>Sun, 21 Apr 2013 01:00:00 +0800</pubDate><category>css</category></item><item><title>Smarty Replace Line Breaks</title><description>&lt;p&gt;{$var|regex_replace:&amp;#8221;/[\r\n]/&amp;#8221;&amp;#160;: &amp;#8221; &amp;#8220;}&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/48345458213</link><guid>http://oceanhere.tumblr.com/post/48345458213</guid><pubDate>Fri, 19 Apr 2013 16:30:06 +0800</pubDate><category>php</category></item><item><title>W3C DOM Compatibility - Core</title><description>&lt;a href="http://www.quirksmode.org/dom/w3c_core.html"&gt;W3C DOM Compatibility - Core&lt;/a&gt;: &lt;p&gt;&lt;code&gt;removeAttribute()&lt;/code&gt; IE6/7 support: almost.&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/48344907729</link><guid>http://oceanhere.tumblr.com/post/48344907729</guid><pubDate>Fri, 19 Apr 2013 16:06:50 +0800</pubDate><category>js</category></item><item><title>The danger of the trailing dot in the domain name</title><description>&lt;a href="http://saynt2day.blogspot.ru/2013/03/danger-of-trailing-dot-in-domain-name.html"&gt;The danger of the trailing dot in the domain name&lt;/a&gt;</description><link>http://oceanhere.tumblr.com/post/45491834337</link><guid>http://oceanhere.tumblr.com/post/45491834337</guid><pubDate>Sat, 16 Mar 2013 20:04:06 +0800</pubDate></item><item><title>Object comparison in JavaScript</title><description>&lt;p&gt;&lt;a href="http://stackoverflow.com/questions/1068834/object-comparison-in-javascript"&gt;&lt;a href="http://stackoverflow.com/questions/1068834/object-comparison-in-javascript"&gt;http://stackoverflow.com/questions/1068834/object-comparison-in-javascript&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why not &lt;code&gt;JSON.stringify&lt;/code&gt; it then compare?&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;&lt;code&gt;JSON.stringify&lt;/code&gt; removes properties that are set to &lt;code&gt;undefined&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;What if the data is the same but the order of the keys is different?&lt;/li&gt;
&lt;li&gt;String performance.&lt;/li&gt;
&lt;/ol&gt;</description><link>http://oceanhere.tumblr.com/post/42249978038</link><guid>http://oceanhere.tumblr.com/post/42249978038</guid><pubDate>Mon, 04 Feb 2013 11:59:14 +0800</pubDate><category>js</category></item><item><title>screen.height, screen.availHeight, window.innerHeight</title><description>&lt;p&gt;屏幕分辨率高度，屏幕内可用高度（桌面去掉任务栏，浏览器可用高度），浏览器内可用高度&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$.getWinSize = function() {
    if (window.innerWidth != undefined) {
        return [window.innerWidth, window.innerHeight];
    } else {
        var body = document.body, de = document.documentElement;
        return [Math.max(de.clientWidth, body.clientWidth), Math.max(de.clientHeight, body.clientHeight)];
    }
};
&lt;/code&gt;&lt;/pre&gt;</description><link>http://oceanhere.tumblr.com/post/39197597991</link><guid>http://oceanhere.tumblr.com/post/39197597991</guid><pubDate>Sun, 30 Dec 2012 14:38:00 +0800</pubDate><category>js</category></item><item><title>CodeIgniter Rest Server</title><description>&lt;p&gt;&lt;a href="http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/"&gt;&lt;a href="http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/"&gt;http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You&amp;#8217;ll need another file: /application/libraries/Format.php.&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/34552231685</link><guid>http://oceanhere.tumblr.com/post/34552231685</guid><pubDate>Mon, 29 Oct 2012 15:03:37 +0800</pubDate><category>php</category></item><item><title>Read Request Payload in Codeigniter</title><description>&lt;p&gt;I was using Codeigniter with Backbone. When I try to call the &lt;code&gt;save()&lt;/code&gt; method in the Backbone it sent a POST Request to the server. But it&lt;a href="http://stackoverflow.com/questions/10237539/handing-data-from-backbone-to-codeigniter"&gt; sends data to the server using a Request Payload and not the standard Form Data approach that jQuery, and standard HTML forms submit with.&lt;/a&gt;. After a bit study I think there are two easy way to handle this.&lt;/p&gt;

&lt;p&gt;On the front end you can enable &lt;code&gt;Backbone.emulateJSON()&lt;/code&gt; or on the server side, &lt;code&gt;$requestBody = json_decode(file_get_contents('php://input'),true);&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I heard something like &lt;code&gt;$this-&amp;gt;request-&amp;gt;body&lt;/code&gt; but it never works.&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/34404462334</link><guid>http://oceanhere.tumblr.com/post/34404462334</guid><pubDate>Sat, 27 Oct 2012 16:32:08 +0800</pubDate><category>web</category><category>js</category><category>php</category></item><item><title>RESTFUL API</title><description>&lt;p&gt;&lt;a href="http://blog.apigee.com/detail/restful_api_design"&gt;&lt;a href="http://blog.apigee.com/detail/restful_api_design"&gt;http://blog.apigee.com/detail/restful_api_design&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_mcjipytAXX1r0cnr9.png" alt=""/&gt;&lt;/p&gt;</description><link>http://oceanhere.tumblr.com/post/34402667265</link><guid>http://oceanhere.tumblr.com/post/34402667265</guid><pubDate>Sat, 27 Oct 2012 15:13:28 +0800</pubDate><category>web</category><category>php</category></item></channel></rss>
