TODO: Write a project description
TODO: Describe the installation process
| CarrierWave.configure do |config| | |
| # For testing, upload files to local `tmp` folder. | |
| if Rails.env.test? || Rails.env.development? || Rails.env.cucumber? | |
| config.storage = :file | |
| else | |
| config.storage = :fog | |
| config.fog_credentials = { | |
| # Configuration for Amazon S3 should be made available through an Environment variable. |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Facebook Login JavaScript Example</title> | |
| <meta charset="UTF-8"> | |
| </head> | |
| <body> | |
| <script> | |
| // This is called with the results from from FB.getLoginStatus(). | |
| function statusChangeCallback(response) { |
| 大部分的時候,RubyGem都可以直接使用。 | |
| 但是Ruby有個大問題是:如果出錯的話,你很難找到為什麼出錯。 | |
| 通常在使用Gem的時候你不會遇到什麼問題,如果運氣不好碰到的話,Google也沒什麼用 | |
| 如果你不知道Gem到底是怎麼和程式一起運作的話,你就會花很多時間在debug上。 | |
| Gem的運作有點像在變魔術,不過花點時間研究,它其實很好懂的。 | |
| gem install做了什麼事? | |
| 一個Ruby gem只是一些打包起來的code,加上一些額外的data。 |
| ●sublime_rubocop | |
| Ruby的style guide | |
| ●BeautifyRuby | |
| Ruby排版 | |
| ●Sublime-HTMLPrettify | |
| html,js,css排版 | |
| ●ERB-Sublime-Snippets | |
| erb用的快速鍵 | |
| ●sublime-better-coffeescript | |
| coffeescript用的快速鍵 |
| Nginx使用者請看這 | |
| 由於Let's Encrypt的安裝程式目前還沒有提供nginx模組(其實有在開發,只是還在測試階段),我們依舊可以透過安裝程式自動取得certification後,手動更新nginx的設定黨即可。 | |
| 首先,我們先取得免費的憑證: | |
| # 如果nginx正在執行中,請先把它關閉 | |
| $ sudo -s | |
| $ service nginx stop | |
| $ ./letsencrypt-auto certonly --email 你的email@你的email.net -d freessl.csie.io |
| #osx | |
| brew install graphicsmagick | |
| brew install vips | |
| #linux | |
| sudo aptitude install libvips-dev libmagickwand-dev libxml2-dev | |
| #加裝libxml2在路徑裡 | |
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig |
| import React, { PropTypes } from 'react'; | |
| import { connect } from 'react-redux'; | |
| import { pushPath } from 'redux-simple-router'; | |
| export function requireAuthentication(Component) { | |
| class AuthenticateComponent extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } |
| ... | |
| def index | |
| @topics = Topic.joins(:topic_category).select('topics.id','topics.title_zh','topics.title_en','topics.topic_messages_count','topics.created_at','topic_categories.meta_key','topic_categories.name_zh','topic_categories.name_en') | |
| .order("topics.created_at desc").page(params[:page]).per(10) | |
| @topic_categories = TopicCategory.order("order_date desc") | |
| end | |
| ... |
| <%# view fragment %> | |
| <% @topic_categories.each do |category| %> | |
| <li role="presentation"><a v-on:click="one('<%= category.meta_key %>')" aria-controls="<%= category.meta_key %>" role="tab" data-toggle="tab"><%= category.send('name_'+ get_locale) %></a></li> | |
| <% end %> | |
| <tbody id="topics"> | |
| <tr v-for="topic in topics"> | |
| <td>{{ topic | locale }}</td> | |
| <td>{{ topic.created_at | moment }}</td> | |
| <td>{{ topic.title_zh }}</td> |