This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* usage: | |
* $('div').draggable(); | |
* $('*').draggable(); | |
*/ | |
$.fn.draggable = function() { | |
var $document = $(document) | |
, mouse = { update: function(e) {this.x = e.pageX; this.y = e.pageY;} }; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<main></main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<css-doodle> | |
:doodle { | |
@grid: 20x1 / 60vmin; | |
overflow: hidden; | |
} | |
:container { | |
transform: scale(25); | |
filter: @svg-filter(<svg> | |
<filter> | |
<feTurbulence baseFrequency="@r(.016, .056, .001)" seed="@r(100)" numOctaves="@r(8, 15)" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MARK = { | |
symbol: { | |
name: '__mark__', | |
type: 'condition', | |
}, | |
add(fn) { | |
let { name, type } = this.symbol; | |
let addon = { [name]: type }; | |
return Object.assign((...args) => fn(...args), addon); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
const cons = (a, list) => _cons => _cons(a, list); | |
const car = list => list(head => head); | |
const cdr = list => list((_, tail) => tail); | |
const nil = () => null; | |
const is_nil = list => car(list) === nil(); | |
const length = list => | |
is_nil(list) ? 0 : 1 + length(cdr(list)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<style> | |
body { | |
background: #333; | |
text-align: center; | |
} | |
#num { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Watch a directory recursively | |
* | |
* @param {String} dir | |
* @param {Function} cb | |
* | |
* watchRecursive('directory', function(current) { | |
* console.log(current, ' changed'); | |
* }); | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Both */ | |
li:last-child, li.last-child { | |
border: none; | |
} | |
/* AND */ | |
li.last-child, li:last-child { | |
border: none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 1. 打开百姓网首页,http://www.baixing.com | |
* 2. 把下面这段代码复制到控制台并运行(需要chrome :D), | |
* 3. 然后鼠标移动到 LOGO 上可以看到效果 | |
*/ | |
(function() { | |
if (!document.createElement('canvas').getContext) return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
例如 prezero(200) 返回 0200 | |
*/ | |
var prezero = function(number) { | |
var str = number.toString(10); | |
var len = str.length; | |
while((len++) < 4) { | |
str = '0' + str; |
NewerOlder