Skip to content

Instantly share code, notes, and snippets.

View doitian's full-sized avatar
🎯
Focusing

ian doitian

🎯
Focusing
View GitHub Profile

代码有点长,贴在gist了。

http://gist.github.com/430615#file_yield.js

主要思想就是把Enumerator里的程序分段存下来,然后手动控制执行。利用闭包保存状态。next()有负作用,懒得改了。

  • _s是一段不包含其它_开头函数的block.
  • _while, _if如字面
  • _yield 即yield
#!/bin/bash
# Get stats of changed of lines (accumulated by each commit)
# E.g.:
# git-col master...my_work_branch
git log --shortstat --abbrev-commit "$@" | awk '
BEGIN {
insertions = 0
deletions = 0
}
struct transition_table : mpl::vector<
// Start Event Next Action Guard
// +---------+ -------------+ ---------+ ---------------------+ ----------------------+
a_row < Stopped , play, Playing, &player_::start_playback >,
a_row < Stopped , open_close, Open, &player_::open_drawer >,
_row < Stopped , stop, Stopped >,
// +--------- -------------+ ---------+ ---------------------+ ----------------------+
a_row < Open , open_close , Empty , &player_::close_drawer >,
// +---------+ -------------+ ---------+ ---------------------+ ----------------------+
@doitian
doitian / wlist.rb
Created August 26, 2010 14:03
List windows for gpicker.
#!/usr/bin/env ruby
workspaces = {}
`wmctrl -d`.each_line do |line|
columns = line.split
if columns[7] == "N/A"
workspace_name = columns[8..-1].join(" ")
else
workspace_name = columns[9..-1].join(" ")
end
(defun color-theme-blackboard ()
"Color theme by JD Huntington, based off the TextMate Blackboard theme, created 2008-11-27.
I revise it a little, just change font-lock-function-name-face to make the headings in org-mode different."
(interactive)
(when (fboundp 'color-theme-install)
(color-theme-install
'(color-theme-blackboard
((background-color . "#0C1021")
(background-mode . dark)
(border-color . "black")
class Repo
attr_reader :project
def initialize(project)
@project = project
end
# Diverged:
#
# On branch master
# Your branch and 'origin/master' have diverged,
style "panel"
{
font_name = "Ubuntu 12"
}
widget "*PanelWidget*" style "panel"
widget "*PanelApplet*" style "panel"
module Spec
module Support
module UserSession
def self.included(base)
base.extend(InstanceMethods)
end
def unstub_login
begin
controller.unstub!(:current_session)
(require 'scala-mode-auto nil t)
(defun iy/scala-newline-and-indent ()
(interactive)
(when (and (looking-back "{ *") (looking-at " *}")) ;; open empty braces
(delete-horizontal-space)
(scala-newline)
(scala-indent-line-to (scala-indentation))
(forward-line -1)
(end-of-line))
@doitian
doitian / amimport
Created December 17, 2010 14:00
Batch import ED2K links to amule
#!/usr/bin/env python
amule_dir = "~/.aMule"
# Usage:
#
# Update amule_dir to your real location.
#
# The file or stdin must have one ED2K link per line.
#
# 1. Import file
#