Skip to content

Instantly share code, notes, and snippets.

View larryisthere's full-sized avatar

Larry Zhang larryisthere

View GitHub Profile
@larryisthere
larryisthere / gist:a17366a8be29ec124500
Last active September 9, 2015 01:55
I got a Completed 500 Internal Server Error when I saved a duplicated record to a table which has validate of uniqueness and a composite index
User can like products, but as one product it should only be liked by one user once. So I add a composite index of product_id and user_id on table like and add a validate on model like.
Here is the codes:
like.rb
class Like < ActiveRecord::Base
belongs_to :user
belongs_to :product
accepts_nested_attributes_for :product
validates :user_id, uniqueness: {
@larryisthere
larryisthere / gist:9486bbc39fd49497aa5c
Created April 14, 2015 06:26
Log of QQ 4.0.2, keeps crashing on Yosemite 10.10.3
Process: QQ [3521]
Path: /Applications/QQ.app/Contents/MacOS/QQ
Identifier: com.tencent.qq
Version: 4.0.2 (18031)
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: QQ [3521]
User ID: 501
Date/Time: 2015-04-14 14:19:56.436 +0800
> brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 7c803e51d66371070616e32f6dd408ebba86e45d
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit haswell
OS X: 10.10-x86_64
Xcode: 5.1.1
@larryisthere
larryisthere / gist:3291905
Created August 8, 2012 03:51 — forked from panuta/gist:1852087
How to setup Django/Postgresql on OS X Mountain Lion using Homebrew-based

Command Line Tools for Xcode

Command line tools comes bundle with Xcode prior to 4.3 version. After 4.3, you need to install a separated command line tools yourself.

First, go to this url and login using Apple Developer account (Free to register)

https://developer.apple.com/downloads/index.action