Skip to content

Instantly share code, notes, and snippets.

Zhuochun zhuochun

Block or report user

Report or block zhuochun

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 gulpfile-sass.js
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var lr = require('tiny-lr'),
refresh = require('gulp-livereload'),
server = lr();
View dci_alt.rb
class User < ActiveRecord::Base
# ... lots of persistence stuff
class GitHubUserProvisioner < SimpleDelegator
def provision_with!(user_info, extra_user_hash)
self.github_login = extra_user_hash['login'] = user_info['name'] = user_info['email']
self.github_url = user_info['urls']['GitHub']
View rails_association.rb
class User < ActiveRecord::Base
#let's just make it simple and only add one column for this model called 'username'
attr_accessible :username
#use "follower_id" as the foreign key since by default it will use "user_id" which does
#not exist inside the "relationships" table
has_many :relationships, foreign_key: :follower_id
#find all user with the ID matching the "followed_user_ids" of the result. If I did not
#include "source: :followed_user", it will look for the column "following_id" which is wrong
View weibo_page_delete.js
// Zhuochun
// 2013-12-15
function eventFire(el, etype) {
if (el.fireEvent) {
(el.fireEvent('on' + etype));
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
$ = jQuery
$.activeTransforms = 0
$(document).ajaxSend (e, xhr, settings) ->
return unless settings.type in TRANSFORM_TYPES
$.activeTransforms += 1
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
zhuochun / Macbook Air 2013
Last active Dec 23, 2015
Solve New Mountain Lion Update Webcams not accessible from applications
View Macbook Air 2013

After the latest OS X system update, Macbook Air 2013 Webcam no longer working on Chrome/Skype.


  1. Download the attached file.

  2. Go to Finder>Go>Go to Folder

  3. Copy and paste this into the search bar: /Library/CoreMediaIO/Plug-Ins/DAL/

View 20130426184456_devise_create_users.rb
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
View eigenclass.rb
class Person
#class method
class Person
def self.address
puts "hangzhou"
View loadCss.js
function loadCss(css) {
var link;
if ($.isArray(css)) {
$.each(css, function (idx, lk) {
} else {
link = document.createElement("link");
link.type = "text/css";
You can’t perform that action at this time.