Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), 'default_libs')
require File.join(File.dirname(__FILE__), 'vundle')
GitStyleBinary.command do
version "yadr-list-vim-plugin 1.0"
short_desc "List installed vim plugins"
banner <<-'EOS'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Assert Test Suite</title>
<script type="text/javascript">
(function() {
var results;
this.assert = function assert(value, desc) {
var li = document.createElement('li');
@lyuehh
lyuehh / bin.rb
Last active December 16, 2015 01:09
#!/usr/bin/env ruby
path = ENV['PATH'].split(':')
all = []
path.each do |p|
all.push(Dir.entries(p))
end
puts all.flatten.select{ |a| a != '.' && a != '..' }
@lyuehh
lyuehh / all.html
Created April 17, 2013 07:10
web development CheatSheet
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
@lyuehh
lyuehh / _.throttle.js
Created August 8, 2013 06:51
_.throttle
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
options || (options = {});
var later = function() {
previous = options.leading === false ? 0 : new Date;
timeout = null;
result = func.apply(context, args);
};
@lyuehh
lyuehh / _.debounce.js
Created August 8, 2013 06:51
_.debounce
_.debounce = function(func, wait, immediate) {
var result;
var timeout = null;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) result = func.apply(context, args);
};
var callNow = immediate && !timeout;
function uuid() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = "-";