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
zhuochun /
Last active Oct 10, 2019
List all posts, tags and categories in Jekyll.

Markdown-Writer for Atom

List all posts, tags and categories in Jekyll.

Octopress users: if you found " is escaped in the generated JSON file, please change them to \". Refer to this issue.

View stupid-header.go
package main
import (
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
wait := make(chan struct{})
View random-emoji.rb
#!/usr/bin/env ruby
require 'net/http'
require 'json'
uri = URI('')
resp = Net::HTTP.get_response(uri)
emoji = JSON.parse(resp.body)
num = [ARGV.first.to_i, 1].max
zhuochun / greeter_client.rb
Last active Mar 9, 2016
Ruby GRPC Memory Leak
View greeter_client.rb
# Sample app that connects to a Greeter service.
# Usage: $ path/to/greeter_client.rb
this_dir = File.expand_path(File.dirname(__FILE__))
lib_dir = File.join(this_dir, 'lib')
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
require 'grpc'
require 'helloworld_services'
View spec_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'
require 'database_cleaner'
# Requires supporting ruby files with custom matchers and macros, etc,
View master.vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
View html_log.rb
# this is a dirty implementation of logger that
# compiles AR queries with trace into /last_request_log.html
# the snippet is useful when optimizing performance of the endpoint
class QueryLogSubscriber < ActiveSupport::LogSubscriber
def initialize
View ruby-debugging.markdown


gem 'debugger', group: [:development, :test]


  • Add debugger to anywhere in code that needs a breakpoint.
  • Refresh the page, the rails server terminal will stop, use help.
View less-loop.less
.make_spans(@index, @total) when (@index < @total) {
.span@{index} {
height: unit((30 * @index), px);
.make_spans((@index + 1), @total);
.make_spans(1, 34);
View nodewebkit.json
"main": "index.html",
"name": "nw-demo",
"description": "demo app of node-webkit",
"version": "0.1.0",
"keywords": [ "demo", "node-webkit" ],
"window": {
"title": "node-webkit demo",
"icon": "link.png",
"toolbar": true,
You can’t perform that action at this time.