Skip to content

Instantly share code, notes, and snippets.

View lenage's full-sized avatar
:octocat:
Focusing

Yuan He lenage

:octocat:
Focusing
View GitHub Profile
@lenage
lenage / example.lsp
Created November 6, 2012 07:16
some common lisp stuffs
(defun our-copy-tree (tr)
(if (atom tr)
tr
(cons (our-copy-tree (car tr))
(our-copy-tree (cdr tr)))))
(defun get_max_v1 (lst)
(if (null lst)
"没有要比较的元素"
(if (null (cdr lst))
@lenage
lenage / wait_until.rb
Created November 5, 2012 08:38 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: 'will@not.work'
fill_in 'password', with: 'test'
@lenage
lenage / awesome_config.md
Created November 3, 2012 18:32
Awesome configruation
@lenage
lenage / .tmux.conf
Created November 3, 2012 15:37
My tmux conf
set -g default-terminal "screen-256color"
set -g history-limit 20000
# use VI
set-window-option -g mode-keys e
# Use ctrl-a instead of ctrl-b
set -g prefix C-a
unbind C-b
bind C-a send-prefix
@lenage
lenage / mos_youtube.js
Created October 19, 2012 03:58
madeofsport embed youtube js
asics_mos.mos.common.video.YouTubePlayer.prototype.init = function (a) {
$(".video-overlay-share-title").text(asics_mos.mos.globalData.share.shareTitle);
asics_mos.mos.common.video.YouTubePlayer.prototype.getInstance().setContainer($("#video-player"));
asics_mos.mos.common.video.YouTubePlayer.prototype.getInstance().setOverlay($("#video-overlay"));
swfobject.embedSWF("http://www.youtube.com/v/" + a + "?enablejsapi=1&playerapiid=ytplayer&version=3&autohide=1&modestbranding=1&rel=0&showinfo=0&fs=1&hd=1", "ytplayer", this.ytPlayerWidth,
this.ytPlayerHeight, "8", null, null, {
allowScriptAccess: "always",
allowFullScreen: "true"
}, {
id: "ytplayer"
@lenage
lenage / test.rb
Created August 28, 2012 17:45
Get mp3info from a fold use ruby
require 'mp3info'
dir = File.expand_path("../", __FILE__)
Dir["#{dir}/*"].each do |sub_dir|
if File.directory?(sub_dir)
Dir.entries(sub_dir).each do |file|
if file =~ /mp3/
title = file.split("-").last.sub(/.mp3/, "")
artist = file.scan(/_(\w+)/).flatten.first
Mp3Info.open( sub_dir + "/" + file ) do |mp3|
@lenage
lenage / commit-msg
Created August 3, 2011 07:51 — forked from mmrwoods/commit-msg
Commit and merge hooks for Github and Lighthouse
#!/usr/bin/env ruby
# When committing directly to master, look for lighthouse ticket number in commit msg and, if necessary, append in format recognised by github
# When committing to a topic/feature branch, barf if the branch name doesn't include a ticket number that can be parsed by the post-merge hook
# Note: this hook only applies when -m option used and can also be skipped by using --no-verify option
COMMIT_MASTER_STATE = 'coding-done'
branchname = `git branch --no-color 2> /dev/null`[/^\* (.+)/, 1]
@lenage
lenage / gist:1115580
Created July 30, 2011 14:22
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
@lenage
lenage / uniq-git-date.sh
Created August 5, 2015 02:33
List all Git commit date
git log --format='%ci' --no-merges | awk '{print $1}' | uniq | wc -l
@lenage
lenage / .vimrc
Last active August 29, 2015 14:25
A simple vimrc config
syntax on
set encoding=utf8
set tabstop=4
set softtabstop=4
set textwidth=80
set expandtab
set number
set ruler