Skip to content

Instantly share code, notes, and snippets.

View zhuochun's full-sized avatar

Zhuochun zhuochun

View GitHub Profile
// 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();
{
"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,
.make_spans(@index, @total) when (@index < @total) {
.span@{index} {
height: unit((30 * @index), px);
}
.make_spans((@index + 1), @total);
}
.make_spans(1, 34);
@zhuochun
zhuochun / ruby-debugging.markdown
Created January 4, 2014 16:11
Ruby debugging

Gems

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

Debugging

  • Add debugger to anywhere in code that needs a breakpoint.
  • Refresh the page, the rails server terminal will stop, use help.
" 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)
# 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,
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using System.Windows.Threading;
using System.Collections.Generic;
namespace Ownskit.Utils
{
@zhuochun
zhuochun / rename.rb
Created April 28, 2014 15:41
Remove `%..` from files' filenames
files = Dir["*"].select { |filename| filename.include? "%" }
files.each do |filename|
new_name = filename.gsub(/%../, "")
File.rename(filename, new_name)
end
@zhuochun
zhuochun / README.md
Last active June 14, 2023 17:46
List all posts, tags and categories in Jekyll. https://github.com/zhuochun/md-writer

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.

/*
* Custom Markdown Styles for Atom
*/
.editor .gfm {
@gfm_gray0f: #F0F0F0;
@gfm_gray0b: #B2B2B2;
@gfm_gray07: #767676;
@gfm_gray05: #545454;
@gfm_pink: #FB007A;
@gfm_red_dark: #C30071;