Skip to content

Instantly share code, notes, and snippets.

View leeluolee's full-sized avatar
🎯
Focusing

ZhengHaibo leeluolee

🎯
Focusing
View GitHub Profile
@leeluolee
leeluolee / keyOf
Created June 9, 2015 12:44
keyOf讨论
var keyOf = function(oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
@leeluolee
leeluolee / xpath.md
Created April 25, 2014 12:12
xpath finder

var xpath = function(path, node, tag) { node = node || document; tag = tag || '*'; var patterns = "", xhtmlNamespace = "http://www.w3.org/1999/xhtml", namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null, returnElements = [], elements, _node;

@leeluolee
leeluolee / advanced state lexer
Last active August 29, 2015 13:57
simple lex
```javascript
// find sub Match;
var lex = (function(){
var ignoredRef = /\(\?\!|\(\?\:|\?\=/;
var slice = [].slice;
var wrapHander = function(handler){
return function(all){
return {
type: handler,
value: all
@leeluolee
leeluolee / fixed-detect.js
Created March 17, 2014 01:58
fixed 判断方式
function isSupportFixed() {
var userAgent = window.navigator.userAgent,
ios = userAgent.match(/(iPad|iPhone|iPod)\s+OS\s([\d_\.]+)/),
ios5below = ios && ios[2] && (parseInt(ios[2].replace(/_/g, '.'), 10) < 5),
operaMini = /Opera Mini/i.test(userAgent),
body = document.body,
div, isFixed;
div = document.createElement('div');
div.style.cssText = 'display:none;position:fixed;z-index:100;';
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
// Top-level build file where you can add configuration options common to all sub-projects/modules.
@leeluolee
leeluolee / MCSS.tmLanguage
Created September 3, 2013 08:41
mcss syntax
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>MCSS</string>
<key>fileTypes</key>
<array>
<string>mcss</string>
<string>css</string>
@leeluolee
leeluolee / response-mcss.md
Created August 24, 2013 04:50
response-army8735

回答@army8735

http://leeluolee.github.io/mcss/ 这里虽然很简陋 ,但是可以在这里测试下。

%是啥?只是个语法糖而已

%在mcss里是类似&的东西即预制符(与SASS中的意义不一样), 只是会除去顶层选择器的

很多场景下,我们需要扩展类型比如一个.m-form 的表单模块,我们需要通过扩展类.m-form-stack来修改一个表单模块内的元素,即一个节点同时写两个名称m-form m-form-stack ,这种增量扩展类的写法应该也是目前类型bootstrap的css框架的选择。

这时我们可以这样做