Skip to content

Instantly share code, notes, and snippets.

View SammyLin's full-sized avatar
:octocat:
大家好

Sammy Lin SammyLin

:octocat:
大家好
View GitHub Profile
[~/Dropbox/RubyProject/tcoc] (master) 39h18m $ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# app/assets/javascripts/ad_lists.js.coffee
# app/assets/stylesheets/ad_lists.css.scss
[~/Dropbox/RubyProject/tcoc] (master) 39h37m $ rails g model adlist
invoke active_record
create db/migrate/20120112015328_create_adlists.rb
create app/models/adlist.rb
invoke test_unit
create test/unit/adlist_test.rb
create test/fixtures/adlists.yml
[~/Dropbox/RubyProject/tcoc] (master) 39h38m $ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
@SammyLin
SammyLin / article_total.rb
Created January 19, 2012 02:27
create article total on octopress
# encoding: utf-8
module Jekyll
class Site
def create_article_total_list(site)
write_to_Article_total_sidebar(site) if @config['article_total_sidebar']
end
private
@SammyLin
SammyLin / yahoo_webmaster.html
Created January 19, 2012 06:34
yahoo webmaster plugin on Octopress
{% if site.yahoo_webmaster_id %}
<script type="text/javascript" src="http://tw.js.webmaster.yahoo.com/{{ site.yahoo_webmaster_id }}/ystat.js"></script>
<noscript><a href="http://tw.webmaster.yahoo.com"><img src=http://tw.img.webmaster.yahoo.com/{{ site.yahoo_webmaster_id }}/ystats.gif></a></noscript>
{% endif %}
價錢 用量 總價
$0.00 per GB-month of provisioned storage under monthly free tier 30.000 GB-Mo 0.00
$0.00 per 1 million I/O requests under monthly free tier 2,000,000 IOs 0.00
$0.00 per GB-Month of snapshot data stored under monthly free tier 1.000 GB-Mo 0.00
$0.12 per GB-month of provisioned storage 157.833 GB-Mo 18.94
$0.12 per 1 million I/O requests 907,666 IOs 0.11
$0.15 per GB-Month of snapshot data stored 15.350 GB-Mo 2.30
@SammyLin
SammyLin / gist:2405795
Created April 17, 2012 12:53
下拉式選單
<select size="1" onchange="window.open(this.options[this.selectedIndex].value,'_self');">
<option>請 選 擇</option>
<option value="http://tw.yahoo.com" >yahoo</option>
<option value="http://sani362.com/">sani362.com</option>
<option value="http://pchome.com/">pchome</option>
</select>
<h1>Editing <%= model_name %></h1>
<%= simple_form_for @article, :url => admin_article_path(@article) , :html => {:class => 'form-horizontal' } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<% end %>
zh-TW:
activerecord:
models:
article: 文章
attributes:
article:
title: 標題
content: 內容
description: 描述
post_status: 文章顯示狀態
@SammyLin
SammyLin / gist:2485397
Created April 25, 2012 01:47
now article model
class Article < ActiveRecord::Base
default_scope order('post_date DESC')
#scope :public, where( :post_status => 'public' )
scope :public_article, where( :post_status => 'public' )
mount_uploader :article_image, ArticleImageUploader
end
@SammyLin
SammyLin / watermelon.rb
Created April 27, 2012 07:16
買了10個包子之後看到賣西瓜的買一顆西瓜的程式怎麼寫才對?
# 賣西瓜的人
has_sale = true
# 我的籃子
cart = []
# 賣西瓜事件1
puts "有賣西瓜1"
if has_sale
cart << "包子10個"