發表文章

[前端] 現代化網站技術分享日重點整理含hackpad

圖片
課程分為 hackPad :  https://hackpad.com/ZWVGk6BFDfn 現代化網頁開發技術三要素 SASS & RWD 前端版型架構規劃 Modern FrontEnd Devops - 104兒童美術館 (cicisasa.com)自動部署上線分享 前端網頁資料視覺化 網頁設計效能優化 現代網頁設計趨勢觀察

[Javascript] Javascript 物件與基本型態運算相關小知識

圖片
這篇是在Javascript.tw社團上有人發問的問題 原理可以參考保哥的 文章 簡單來說就是 保哥 : 任何物件無論做數值運算或字串相加,所有物件都會先執行 valueOf(),物件如果沒有實作 valueOf() 就會跑去執行 toString() 有更詳細的範例可以直接參考保哥的文章囉

[ AngularJS ] 上課筆記 20160131

AngularJS 純前端的Framework 適合 UI CRUD SPA (Single Page Application like Shoppingcarts...) 不適合 大量操縱DOM like CKEditor Webgame Why AngularJS? 如果用innerHtml的話瀏覽器還需要重新編譯 關注點分離,單純只看MVC Angular是直接修改DOM 免除大量的callback 特色 filter是可以一直串下去的,一樣用 | 串起來 Reference http://ngmodules.org/ https://docs.angularjs.org/api http://www.nganimate.org/ model 存在記憶體的某個變數 從頭到尾掃整個view有套用他的地方,並將改變的值寫回去 dirty check - 頻繁的全部掃描 假設輸入匡內輸入12345,但是可能會觸發controller,所以 至少 會掃5*2次 controller 控制所在宣告的DOM的範圍 初始化會先跑一次,透過scope,scope就是model form 內建的FormController DI 相依性注入 JS的數值運算都是用浮點數運算 (0.1 + 0.2) === 0.3 ---->false //2015-12-17 ng-bind-html="item.Description_L" --> 把model的值變成html 不然預設都會做escape ng-change="function/expression" --> 當input值改變時去呼叫function或是expression 感覺好像只有$scope的function才可以被執行(? 用1.4.X版的是這樣 angularJS內建jQuery angular.element('#element').css('height', '100px');

[Javascript] 從陣列中移除物件

原文引用 http://stackoverflow.com/questions/10024866/remove-object-from-array-using-javascript splice https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice Array.splice(index, delete_count);  //1 someArray . shift (); // first element removed //2 someArray = someArray . slice ( 1 ); // first element removed //3 someArray . splice ( 0 , 1 ); // first element removed //4 someArray . pop (); // last element removed someArray = [{ name : "Kristian" , lines : "2,5,10" }, { name : "John" , lines : "1,19,26,96" }, { name : "Brian" , lines : "3,9,62,36" }] johnRemoved = someArray . filter ( function ( el ) { return el . name !== "John" ; }); // johnRemoved = [{name:"Kristian", lines:"2,5,10"},{name:"Brian",lines:"3,9,62,36" }]

[Facebook API] graph api - search 簡單筆記

最近因專案需求需要某些資料 但那些資料如果都讓人為來做實在是太可憐了

[Javascript] convert-object-array-to-hash-map-indexed-by-an-attribute-value-of-the-object

var arr = [ { key : 'foo' , val : 'bar' }, { key : 'hello' , val : 'world' } ]; var result = arr . reduce ( function ( map , obj ) { map [ obj . key ] = obj . val ; return map ; }, {}); console . log ( result ); // { foo: 'bar', hello: 'world' } Note:   Array.prototype.reduce()  is IE9+, so if you need to support older browsers you will need to polyfill it. from  http://stackoverflow.com/questions/26264956/convert-object-array-to-hash-map-indexed-by-an-attribute-value-of-the-object from  https://lodash.com/docs#indexBy var keyData = [   { 'dir' : 'left' , 'code' : 97 } ,   { 'dir' : 'right' , 'code' : 100 } ] ; _. indexBy ( keyData , 'dir' ) ; // → { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } _. ind...

[MySQL] 當使用distinct/group by時產出的順序不是我們所需要

在做專案時很常會碰到要有個功能叫做 "瀏覽過的商品" 在我們系統是使用Log來做 使用Shopper_Id去Log中找出對應的商品ID,然後order by Timestamp desc 因為商品ID在Log中很容易重覆,所以可以使用distinct/group by來處理 但問題來了,明明有使用order by Timestamp desc,但順序卻不是我要的? 這是因為order by的欄位並不在我們的group by/distinct中 該如何解決? 使用order by MAX(Timestamp) desc就可以了 意思大概就是在我們Log中找Timestamp最大的來比對 更詳細的可以看國外高手的文章囉 So what is a workaround for this problem – in other words, how can we be more specific to get what we really want? Well, let’s rephrase the problem – what if we say we want to retrieve each salesperson ID sorted by their respective highest dollar amount value ( and only have each salesperson_id returned just once )? This is different than just saying that we want each distinct salesperson ID sorted by their Amount, because we are being more specific by saying that we want to sort by  their respective highest dollar amount value . Hopefully you see the difference. From: http://www.programmerinterview.com/index.php/database-sql/sql-select-distinct-a...