Skip to content

Instantly share code, notes, and snippets.

Yi-Ting Cheng xdite

Block or report user

Report or block xdite

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View srt-download.rb
require 'digest'
filename = "House.Of.Cards.2013.S02E01.720p.WEB-DL.x264-Sohu.mp4"
f = File.new(filename, "rb")
puts f.stat.inspect
file_size = File.size?(filename)
offset = []
View YC2014-winter.md

官方報名網頁: http://ycombinator.com/apply.html

報名資訊

  • 報名截止日期: October 21.
  • 報名網址: https://news.ycombinator.com/w2014form (需登入 YC)
  • 在 8 pm PT on October 21. 之前把產品弄上線,越早上線優勢越大(YC有更多時間可以審核),
  • 所有的 cofounder 必需在 HN 有帳號
  • 報名表單按 "update" 並不會把報名資訊送出去,要按 submit 才會,報名截止之前,可以無限次數 submit。
  • YC不會用 Email 跟你聯絡,必須常常登入 HN 在首頁會看到資訊。
View gist:9345214
config.action_controller.asset_host = Proc.new { |source, request = nil, *_|
if request && !request.ssl?
"//cdn#{(source.length % 4) }.logdown.io"
else
"https://d1vzm1nztjpyu4.cloudfront.net"
end
}
@xdite
xdite / workshop.md
Last active Aug 29, 2015
Ruby on Rails Outreach Worshop
View workshop.md

場地條件

  1. 場地要有 50 M 對外頻寬。
  2. 場地要有強壯的 wifi, 可以讓 20-30 人同時抓東西不是問題。(需要 gem install)
  3. 方便到達(最好在市中心或其他容易到的地方)
  4. 場地要能提供至少 20-30 人的電源插座
  5. 場地要能提供供 20-30 人用的桌椅 (大桌約 6-8 張)
  6. 場地要能提供投影機以及布幕設備
  7. 場地要能提供飲料和零食。(或者不介意學員自己帶去)
View gist:c1b8e9e02d9c50a45aea
DEPENDENCIES
+ bootstrap-sass
coffee-rails (~> 4.0.0)
devise
jbuilder (~> 2.0)
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index a443db3..bcdb41c 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -12,4 +12,5 @@
@xdite
xdite / _navbar.html.erb
Created Jun 12, 2014
app/views/common/_navbar.html.erb
View _navbar.html.erb
<ul class="nav navbar-nav navbar-right">
<li>
<%= link_to "#" do %>
購物車 <i class="glyphicon glyphicon-shopping-cart"> </i> (0)
<% end %>
</li>
<% if !current_user %>
<li> <%= link_to("登入", new_user_session_path) %> </li>
@xdite
xdite / customer_serializer.rb
Created Aug 6, 2014
customer_serializer.rb
View customer_serializer.rb
class CustomerSerializer < ActiveModel::Serializer
attributes :id, :name, :email, :phone, :store_credit, :credit_card, :receive_daily_emails, :is_driver, :addresses
def store_credit
object.total_available_store_credit.to_f
end
def credit_card
object.card_last_4
end
View order_placing_service.rb
class OrderPlacingService
def initialize(cart,order)
@order = order
@cart = cart
end
def place_order!
@order.build_item_cache_from_cart(@cart)
@order.calculate_total!(@cart)
@cart.clear!
You can’t perform that action at this time.