你想要用文學編程來寫程式嗎?我們先來做一個列出 1 至 10 的簡單程式吧!
我們需要做一些宣告、接著以迴圈產出一個數字的陣列,最後才能列印出 1 至 10 的數字。
start = 1
end = 10
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
AddOutputFilterByType SUBSTITUTE text/html | |
Substitute "s|</body>|<script src=\"//localhost:35729/livereload.js\"></script>\n</body>|i" |
{ | |
"app": { | |
"stack": "fixtures" | |
}, | |
"reports/index": { | |
"data": { | |
"reports": [] | |
}, | |
"didInvalidate": false, | |
"isFetching": false, |
<% | |
title = (title.blank?) ? t('shared.activity_list.title') : title | |
is_empty = (activities.size == 0) | |
has_pagination = (activities.size > 0) | |
type = controller_name.singularize | |
action_path = activities_path(:type => type, | |
:id => params[:id], | |
:start_date => params[:start_date] ) | |
if activities.try(:last) | |
query = params.except(:controller, :action).merge(:last_timestamp => activities.last.try(:created_at).to_i).to_query |
@import compass/css3/box-shadow | |
@import compass/css3/border-radius | |
@import compass/css3/images | |
#activity-filter | |
min-width: 350px | |
.hd .btn.btn-filter | |
padding: 0 | |
/* Resets */ |
@import compass/css3/box-shadow | |
@import compass/css3/border-radius | |
@import compass/css3/user-interface | |
@import compass/css3/images | |
@import compass/css3/transition | |
@import compass/css3/transform | |
@import keybridge/theme | |
+keyframes(loading) | |
0% |
module TranslationHelper | |
def trans(key, options = {}) | |
root_path = "#{Dir.pwd}/app/views/" | |
path = caller.first.sub(root_path, '').split(':')[0] | |
extension = '.html.erb' | |
segments = path.sub(extension, '').split('/') | |
segments.map! do |segment| | |
(segment.index('_') == 0) ? segment.sub('_', '') : segment | |
end |
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard 'livereload' do | |
watch(%r{app/views/.+\.(erb|haml|slim)$}) | |
watch(%r{app/helpers/.+\.rb}) | |
watch(%r{public/.+\.(css|js|html)}) | |
watch(%r{spec/.+\.(css|js|html)}) | |
watch(%r{config/locales/.+\.yml}) | |
# Rails Assets Pipeline |
# use pbcopy and pbpaste | |
# need preinstall the reattach-to-user-namespace 'brew install reattach-to-user-namespace' | |
# | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy" | |
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer" | |
set -g default-shell /bin/zsh | |
# start window index of 1 | |
set -g base-index 1 |