This is zero lines JS game. Only CSS and HTML, without JS =)
A Pen by Alexander Majorov on CodePen.
| var lex = | |
| { | |
| InputElementDiv:"<WhiteSpace>|<LineTerminator>|<Comment>|<ReservedWord>|<Identifier>|<NumericLiteral>|<Punctuator>|<StringLiteral>|<DivPunctuator>", | |
| InputElementRegExp:"<WhiteSpace>|<LineTerminator>|<Comment>|<ReservedWord>|<Identifier>|<NumericLiteral>|<Punctuator>|<RegularExpressionLiteral>|<StringLiteral>", | |
| ReservedWord:"<Keyword>|<FutureReservedWord>|<NullLiteral>|<BooleanLiteral>", | |
| WhiteSpace:/[\t\v\f\u0020\u00A0\u1680\u180E\u2000-\u200A\u202F\u205f\u3000\uFEFF]/, | |
| LineTerminator:/[\n\r\u2028\u2029]/, | |
| Comment:"<SingleLineComment>|<MultiLineComment>", | |
| SingleLineComment:/\/\/[^\n\r\u2028\u2029]*/, | |
| MultiLineComment:/\/\*(?:[^*]|\*[^\/])*\*?\*\//, |
| <!doctype html> | |
| <html> | |
| <body> | |
| <script> | |
| var timers = {}; | |
| var _console = {}; | |
| var _console_cache = []; | |
| _console.time = function( name ) { | |
| if ( name ) { | |
| timers[ name ] = (new Date()); |
| var timers = {}; | |
| if ( console && !console.time ) { | |
| console.time = function( name ) { | |
| if ( name ) { | |
| timers[ name ] = Date.now(); | |
| } | |
| } | |
| console.timeEnd = function( name ) { | |
| if ( timers[ name ] ) { | |
| console.log( name + ': ' + (Date.now() - timers[ name ]) + 'ms' ); |
| /** | |
| * | |
| * 将第一个CSV字符串参数,按纵横比分类 | |
| * usage: analytics_specs("800*1600, 400*800, 800*2000", "x", ",") | |
| */ | |
| function analytics_specs( string, a, b ) { | |
| a = a || '×'; | |
| b = b || ','; |
This is zero lines JS game. Only CSS and HTML, without JS =)
A Pen by Alexander Majorov on CodePen.
| function isPointInPath(x, y, poly){ | |
| var num = poly.length, | |
| i = 0, | |
| j = num - 1, | |
| c = false; | |
| for( ; i < num; ++i ) { | |
| if ( ((poly[i][1] > y) != (poly[j][1] > y)) | |
| && (x < (poly[j][0] - poly[i][0]) * (y - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])) | |
| c = !c; | |
| j = i; |
| //红黑树, 二叉树改写而来 | |
| /***************************result************************ | |
| * | |
| * 中序遍历红黑树: | |
| * value=3 color=RED parent=7 | |
| * value=7 color=BLACK parent=10 left=3 | |
| * value=10 color=RED parent=14 left=7 right=12 | |
| * value=12 color=BLACK parent=10 | |
| * value=14 color=BLACK parent=17 left=10 right=16 | |
| * value=15 color=RED parent=16 |
| #!/bin/sh | |
| #刷新css中的资源:图片什么的 | |
| #检查流程: | |
| # 1. 检查变更的资源文件 git status -s | |
| # 2. 将取得的文件名在所有css文件中进行搜索 | |
| # 3. 在匹配的css中取得符合的资源相对路径 | |
| # 4. 检查相对路径指向的是否为目标文件 | |
| # 5. 更新匹配的相对路径的时间戳为当前时间 | |
| root=`pwd` |
| [ | |
| { | |
| name:"HTML5", | |
| uri:"http://www.w3.org/TR/html5/single-page.html", | |
| category:"markup" | |
| }, | |
| { | |
| name:"HTML 5.1", | |
| uri:"http://www.w3.org/TR/html51/single-page.html", | |
| category:"markup" |
| div{ | |
| width:200px; | |
| padding: 5px 0 0 5px; | |
| _padding-left: 10px; | |
| border: none; | |
| } | |
| a{ | |
| float: left; | |
| line-height: 20px; | |
| margin: -5px 0 0 -5px; |