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

Security is Hard

Massive Assignment

  • watch for ActiveRecord Relation, like has_many, has_many :through
  • watch for user_roles, `group_users
  • UPDATE action


xdite / gist:758319
Created Dec 29, 2010
Ruby / Rails Convention of Techbang
View gist:758319

Rails 開發注意要點

About Ruby Syntax

  • 編輯器設定 soft tab (space=2),以 2 格空白符號做為程式內縮距離(不分語言)。
  • 函式如果只有一個參數,就不強制打()
  • 函式如果有二個以上的參數,通通都要有 ()
    • (避免發生奇怪的paser bug跟保持專案一致性)
  • 字串限定用雙引號包覆
  • 善用 "#{str1} #{str3} " 等字串改寫技巧取代不需要的字串加法。
xdite / gist:3106785
Created Jul 13, 2012
Speedup Rails Asset Pipeline precompile process
View gist:3106785
xdite / gist:1641818
Created Jan 19, 2012
RR-020 RR Object Oriented Programming in Rails with Jim Weirich
View gist:1641818

Jim: What I really like is that there are so many Ruby podcasts out there that are newsy. This one dives into technical issues, and I really enjoy that.

Charles: Hey everybody, and welcome back to the Ruby Rhodes podcast. This is your host Charles Max Wood, and this week on our panel we have a special guest rogue. I met him at the Rocky Mountain Ruby Conference in Boulder. He actually suggested this week's topic, so we're going to welcome Jim Weirich to the podcast.

Jim: Thanks for having me. Glad to be here.

Charles: Do you want to introduce yourself really quickly Jim for those one or two people that don't know who you are?

Jim: Sure, absolutely. Jim Weirich. I'm from Cincinnati, Ohio. I've been doing Ruby for over ten years now. I work for EdgeCase. I'm the chief scientist, and I've probably written software that you are using, such as Rake and various mocking frame works and some XML builder stuff, too. You're probably using some of my code somewhere.

xdite /
Created Jul 14, 2012
Ten (42) Things You Didn't Know Rails Could Do
xdite /
Created Oct 12, 2018
Hedge Fund Legend Ray Dalio On The Economy

Hedge Fund Legend Ray Dalio On The Economy-5C43i3yclec.mp4


[00:00:00] Ray D'Alessio is the founder and chief investment officer of Bridgwater the world's largest and most successful hedge fund and he is a best selling author. Coming off the launch of principles which we'll talk about in a minute but Ray welcome. I see you've written one of the largest and I have no doubt most comprehensive analysis of debt crises that I have ever seen. You say this pattern repeats itself again

xdite /
Created Aug 8, 2018
得到例会 创业以来,我们干过哪99件不靠谱的事 2018/08/07

得到例会 创业以来,我们干过哪99件不靠谱的事 2018/08/07





xdite /
Created Jul 25, 2018
Matt Mickiewicz (Hired, 99designs, Flippa) 7 lessons learned from scaling to 250+ employees

Matt Mickiewicz (Hired, 99designs, Flippa) 7 lessons learned from scaling to 250+ employees.zh-si

  • 大家好,我是MattMichiewicz。




View 我如何看这个疯狂的 ICO 世界.md

今天来谈谈我如何看这个疯狂的 ICO 世界。



  1. 一个正常的硅谷创业公司。运气好非常好五年可以退出。这是1% 的情况。2-3% 可以 IPO。其馀的大概90%死在 seed round 与 A round。
  2. 传统天使投资人获利的方式,假设是他在种子轮投了100万人民币占10%股份,经过三四年,经过不断的接盘侠 VC,融到了 C 轮,D轮,市值变成了10个亿。那么他当初的100万就变成了1亿。
  3. 公开发行(IPO)让大众去买股票,可能 10 个亿又变成了 40 个亿。
xdite / omniauth_callbacks_controller.rb
Created Jun 17, 2018
View omniauth_callbacks_controller.rb
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def self.provides_callback_for(*providers)
providers.each do |provider|
class_eval %{
def #{provider}
if not current_user.blank?
current_user.bind_service(request.env["omniauth.auth"])#Add an auth to existing
redirect_to edit_user_registration_path, :notice => "成功绑定了 #{provider} 帐号。"
You can’t perform that action at this time.