# AngularJS - routing 這裡不探究 AngularJS 是如何辦到的 基本上就是用 hash #, 也可用 HTML5 的 history API 這裡只有說有哪些用法
## 基本 sample 這寫法是 1.2.16 的寫法, 不保證以後會變(因為在舊版的 AngularJS 寫法不一樣, 差點搞死我, 當升版本後以前的 code run 不出來時最好去官方看文件)
load AngularJS & angular-route AngularJS v1.2.16 angular-route backup
HTML index.html
<!DOCTYPE html> <html ng-app="route"> <head> <meta charset="utf-8"> <title>routing</title> <script src="http://tedshd.lionfree.net/lib/angular_v1.2.16.js"></script> <script src="http://tedshd.lionfree.net/lib/angular-route.js"></script> </head> <body> <h1>A-Mail</h1> <div ng-view></div> </body> <script src="controllers.js"></script> </html> list.html
<table ng-controller="ListController"> <tr> <td><strong>Sender</strong></td> <td><strong>Subject</strong></td> <td><strong>Date</string></td> </tr> <tr ng-repeat="message in messages"> <td>{{message.
...
# JavaScript - custom facebook share button Before use facebook API, must create facebook app on facebook's [developer website](https://developers.facebook.com/) to get a app id
Facebook support share API to people and it is easy to use. But sometimes we need customize share button style in our web. We can use 2 way.
# 1. Link share api link Simple way
## HTML <a href="http://www.facebook.com/share.php" class="custom">Share</a> and then you can use CSS custom a style.
...
# JavaScript - Random Array Sort function randOrd(){ return (Math.round(Math.random())-0.5); } anyArray = [1, 's', 3, 'arr', 4]; anyArray.sort( randOrd ); alert(anyArray); Refer - Random Array Sort
...
# HTML5 - Full Screen Mode It can control full screen the browser IE if it is to be more than IE11
## Code function toggleFullScreen() { if (!document.fullscreenElement && // alternative standard method !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { // current working methods if (document.documentElement.requestFullscreen) { document.documentElement.requestFullscreen(); } else if (document.documentElement.msRequestFullscreen) { document.documentElement.msRequestFullscreen(); } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); } else if (document.documentElement.webkitRequestFullscreen) { document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } } else { if (document.
...
# MongoDB - Note MongoDB
Wiki
## 1st. Install It support Linux, Mac OS X, Windows
Install MongoDB
## 2nd. Getting Started Getting Started with MongoDB
In Mac, if show message
** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 input command
launchctl limit maxfiles 1024 1024 Refer
...
# Samsung Samrt TV - Network Error Handle ## Example Watch network connect status
Add web api in HTML <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script> Add JavaScript code var watchCB = { onconnect : function (type) { // (1) connected alert(type + " is connected successfully"); }, ondisconnect : function(type) { // (0) disconnected alert(type + " is disconnected"); } }; function successCB(networks) { for (var i = 0; networks.length; i++) { if (networks[i].
...
# PgREST - build note ## GitHub # This is Mac OS X build ## install PostgreSQL postgres.app PostgreSQL Tutorial
set PATH in shell(.bashrc, .zshrc, …) PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH" create the plv8 extension -> psql -U Ted_Shiu -c "create extension plv8" CREATE EXTENSION ## install PgREST(Must install node.js before) npm i -g pgrest Refer - PgREST: Node.js in the Database
...
# CSS - 垂直置中 ## 文字垂直置中 之前 ApplyBOY 在網路上分享了一個 CSS 垂直置中的一個解法 這裡整理出個小小模組出來
假如那一個區域內的東西需做垂直置中, 在該區域的 element 加上 class vertical-centering
.vertical-centering:before { content: ''; display: inline-block; vertical-align: middle ; height: 100%; } 該區域的文字就會垂直置中
Example
See the Pen vertical-centering by Ted (@tedshd) on CodePen.
## 區域垂直置中 如要在一區域內有一小塊區域置中則需把該區域做 vertical-align: middle;
.vertical-centering-area { vertical-align: middle; } .vertical-centering:before { content: ''; display: inline-block; vertical-align: middle ; height: 100%; } Example
See the Pen vertical centering area by Ted (@tedshd) on CodePen.
...
# Vim - colorscheme Vim 主題
mkdir ~/.vim/colors/ 找到 <colorscheme>.vim 並丟到 ~/.vim/colors/ 即可 在 .vimrc 設定 colorscheme <colorscheme> 就會變成該主題 ## Some Colorscheme Vim Colorscheme Gallery vimcolorschemetest vim online Newest - Vim Colors
Refer - 挑選 Vim 顏色(Color Scheme)
...
# Node.js - install ## Mac 利用 homebrew 安裝
brew install node node.js Refer - Install Node.js and npm using Homebrew on OS X
## Ubuntu sudo apt-get install nodejs-legacy sudo apt-get install npm Refer - Can not install packages using node package manager in Ubuntu
## Update Now node merge iojs and version update to v4
But now homebrew not updgrade to v4
So i use nvm
Refer - Node.
...