[Rails4]引入bootstrap3卻找不到icons

事由:

以前在Rails4 使用bootstrap2.3 沒有這樣問題,升級到bootstrap3.2 卻發生照官方文件引入icons卻無法順利顯示,只顯示方塊。

解決方法:

跑去bootstrap-sass的github查看了一下文件,引入以下原始碼就完成!

$subl app/assets/stylesheets/application.css.scss

@import "bootstrap-sprockets";
@import "bootstrap";

備註:
application.css記得改成application.css.scss不然還是無法顯示icon

不過網站從bootstrap2.3升級到bootstrap3.2,幾乎整個網站都得重寫過,改變很大!


參考網址:

https://github.com/twbs/bootstrap-sass

[MySQL] 更改預設編碼成UTF-8

前由:

MySQL預設編碼為latin1,但我希望建立新的tables時,預設編碼為utf8_unicode_ci連線校對。

環境:

Ubuntu 14.04
MySQL 5.5

設定過程:

$ sudo nano /etc/mysql/my.cnf

在[client]區塊加入
default-character-set = utf8

把[mysqld]區塊加入
character-set-server = utf8
collation-server = utf8_unicode_ci

[Rilas4] 從rvm轉到rbenv的過程

環境:

Ubuntu 14.04

操作過程:

1. 刪除RVM

rvm implode
其他注意事項:

Note you may need to manually remove /etc/rvmrc and ~/.rvmrc and ~/.rvm if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.
Also make sure to remove ‘rvm’ group if this was a system installation.
Finally it might help to relogin / restart if you want to have fresh environment (like for installing RVM again).

2. 簡單兩步驟安裝rbenv

First you install rbenv, and then ruby-build

$ cd ~
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ exec $SHELL

$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
$ exec $SHELL

$ rbenv install 2.1.2
$ rbenv global 2.1.2
$ ruby -v

3. 參考網址:

Setup Ruby On Rails on Ubuntu 14.04 Trusty Tahr
move from rvm to rbenv

[Mac] 本機安裝phpmyadmin

1.將內建的MAC的apache的php開啓

sudo vi /etc/apache2/httpd.conf

#LoadModule php5_module libexec/apache2/libphp5.so
改為
LoadModule php5_module libexec/apache2/libphp5.so

Listen 80 改成 Listen 8888    #這樣就可以和powder分開,不會彼此衝突。

2.安裝PHPMyAdmin到預設網站目錄

sudo apachectl restart

安裝PHPMyAdmin
將phpMyAdmin的檔案放到『 資源庫/WebServer/Documents/』

設定phpMyAdmin

config.sample.inc.php 改成 config.inc.php, 或是複製一份
到文件裡面將
$cfg['Servers'][$i]['host'] = ‘localhost’;
改為$cfg['Servers'][$i]['host'] = ’127.0.0.1′;

#註:此步驟如果沒做,會出現登入2002錯誤

記得要重新啟動apache

3.在瀏覽器打 http://localhost:8888/phpmyadmin,完成!

[Git]常用git指令備用

1.新增ssh key到 github,讓往後push 免帳號密碼

$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]

然後到 ~/.ssh 資料夾底下打開 id_rsa.pub ,將ssh-rsa內容複製到 github伺服器上面。

$ ssh -T git@github.com 

這段指令可以測試是否有成功免帳號密碼登入 github

閱讀全文〈[Git]常用git指令備用〉