2014年10月16日 星期四

jquery 過濾 字串 空白鍵

jQuery.trim()

jquery 過濾 字串 空白鍵 

Example: 

$.trim("         hello, how are you?       ");

Result:

"hello, how are you?"

CKEditor (jQuery Plugin) 文字編輯工具列

文字編輯工具
原本以為做文字編輯器很難,沒想到這麼簡單!
首先下載 CKEditor.js,你可以客製化喜歡的外觀,
還可以選擇 簡易版、標準版或完整版,
選完後下載下來,匯入的時候注意連結位置。

匯入CKEditor.js之後 View 的處理很簡單,
幫 <textarea> 加上一個 class="ckeditor",
大功告成。

=========================================

includ:
<script src="yourfolder/ckeditor.js" type="text/javascript"></script>

View:
<textarea class='ckeditor' id='' rows='' name=""></textarea>

萬一你需要自己呼叫 CKEditor你可以參考下列程式碼!
call CKEditor method:
CKEDITOR.replace("textarea#id");



2014年9月2日 星期二

SASS學習歷程

Sass 是一個比較嚴謹且提升寫 Css 效率的程式語言,用過 Sass 就回不去 Css 啦!
請服用 - 30天掌握Sass語法 - by 廖洧杰

以下是學習心路歷程:
2. 增聽 "compass watch coffee" ( coffee 是你新增的專案資料夾)
  • cmd //開始搜尋框輸入 "cmd"
  • d: 
  • compass create coffee
  • cd coffee
  • compass watch coffee
3. 新增網頁框架 index.html
4. 編輯樣式 sass/index.sass
5. images sprites
  • $tab-spacing: 5px //圖片合併間隔空間
    @import "tab/*.png"  //在 images 底下你設定的 png 資料夾所有的 png 圖檔
    @include all-tab-sprites //匯入合併圖檔
  • images sprites hover & active
If you want to add selectors for your sprites, it's easy todo by adding _active _target or _hover to the file name. Sprite Tutorial
  • images path - relative
config.rb - relative_assets = true //把註解打開
注意:當修改 config 設定後,要重新在命令提示字元 watch 資料夾一次,設定才會生效。

6. How to replace a tab with four spaces in sublime text2 ?
    http://stackoverflow.com/questions/9575739/how-to-replace-four-spaces-with-a-tab-in-sublime-text-2
    Sass 相當嚴謹如果你的空格是一個 tab 就跑不出來啦!空格要用使用空白鍵。
    如果你是使用 sublime text 2 來編輯,這個網站教你如何將空格預設為四個空白鍵。

7. sass structure
  • @import mixin //放置所有 Sass 全域變數與 Mixin  
  • @import reset // reset.css  
  • @import extnd // 拿來合併樣式,都放 @extend 用的檔案  
  • @import layout //共同框架  
  • @import index //首頁  
  • @import page //內頁   
  • @import xxx  //各單元 Css  
  • 規劃你的 Sass 結構 http://ithelp.ithome.com.tw/question/10132821


F2E菜鳥的進擊

  • 寫程式三步驟
    1. 想好整個流程
    2. 建構架構
    3. 慢慢補細節及簡化
  • for each 耗資源,請改用 hash 寫法
  • 先不要急著問答案,先找一個解決辦法試試看 - 什麼方法都 Ok 畢竟工作是「結果論」,這樣子才學到東西,如果別人直接告訴你答案,當下次又遇到了是不是就忘記了? 
  • 公版要拆開,這是前端的工作 
  • function first css is secondary. ( 完成比完美更重要。)
  • 檢查完再給後端,放到公共沒問題就 OK!
  • debug - 下 console 或中斷都可,看有無跑到這支程式? 
  • 工程師真正的價值,不是在於多了解自己的產品,而是能處理別人不能解決問題,並整合一切元件,使一切專案順利

  • 2014.06 ~ 09 前端關鍵字:
Jarallax.js 
parallax
2D Box, spin, 碰撞, canvas framework, TWEEN, create.js/kinetic.js( canvas web ) - 2014.07.31
同場加映: cocos2D - 場景、角色、鏡頭、視角。preload.js, sound.js
border-box for RWD 好用 ( css boxsizing ) 
SVG, iconfont
TweenMax
PostMan

  • 前端工作環境
Sublime
SourceTree
Skype
Google drive
Photoshop
Sass ( node.js )
Compass / Ruby
Git

  • 生活:
    1. 尊重、信任、忠誠、承諾
    2. 金剛經、自性經、渡人
    3. 戒、定、慧 ←→ 貪、嗔、癡 (常讀師訓語、凡中聖長存)
    4. 浩然之氣 - 自性
    5. 故事: 亞歷山大的三個願望 - 兩手空空什麼都帶不走
    6. 一定要11點躺平睡覺
    7. 經驗不足可以用學習補足(態度很重要)
    8. 作品集
    9. 年薪兩百萬人生哲學 -
      • 人生有意思&變化
      • 工作內容有挑戰性
      • 不愛抱怨
      • 有幽默感
      • open mind 不排斥 fresh things
      • 投資自己
      • 不花時間看偶像劇

2014.09.02  - by 菲比 

2014年1月17日 星期五

Image replacement by css 用純CSS方法換掉 圖片

original: http://www.audenaerde.org/csstricks.html#

CSS:
img.imgClick{  
    height: 0;
    width: 0;
    padding: 17.5px;
    background: url("camera_35x35_MD.png") repeat scroll 0 0 rgba(0, 0, 0, 0);
}

HTML:

<img class="imgClick" src="camera_35x35.png">


CSS Tips:
1. use CSS height & width hide the html img
2. padding make the background space
3. css background attribute is appear

2014年1月16日 星期四

小天燈DIY



小天燈DIY-材料
1. 文化線一條 ( 約50cm )
2. 小鈴鐺 x 1
3. 兩顆珠珠
4. 天燈紙型
5. 祝福小紙片

工具
1. 剪刀
2. 雙面膠
3. 迴紋針(穿線小幫手)
4. 打洞機

小天燈紙型:  按此處下載

轉載請標明出處<Frontend 無底洞-http://phoenote.blogspot.tw/2014/01/diy.html>


2013年12月10日 星期二

Javascript split() 方法

在javascript Parse值的問題: .split() 

var str = "01_02_03_04_05";


str.split("_");  //["01", "02", "03", "04", "05"]

str.split("_",1);//["01"]

str.split("_",3);//["01", "02", "03"]

str.split("_",5);//["01", "02", "03", "04", "05"]

用小括號得到的是陣列!


如果要取陣列中的值,要再加中括號[]取你要的值

str.split("_")[0];//"01"

str.split("_")[1];//"02"

str.split("_")[2];//"03"

str.split("_")[3];//"04"

str.split("_")[4];//"05"

舉個例子:
var str="Hello, my name is Phoebe" ;//如果我要在字串中拿"Phoebe"出來

str.split(" ");                                    //["Hello,", "my", "name", "is", "Phoebe"]

str.split(" ")[4];                                //得到"Phoebe"