Skip to content

Instantly share code, notes, and snippets.

View chaoren1641's full-sized avatar
🤝
招前端

英布 chaoren1641

🤝
招前端
View GitHub Profile
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@chaoren1641
chaoren1641 / CSS3 Media Queries Template
Created January 7, 2012 15:33
CSS3 Media Queries template
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@chaoren1641
chaoren1641 / commands.sh
Created March 31, 2012 08:34 — forked from memphys/commands.sh
php-memcache with XAMPP on Mac OS X Lion
cd /tmp
pecl download memcache
tar xzf memcache-2.2.6.tar
cd memcache-2.2.6
phpize
MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=php-config
make
sudo make install
/*
* 'rem' is a Sass mixin that converts pixel values to rem values for whatever property is passed to it.
* It returns two lines of code — one of the regular pixel values (for IE), and another with the
* converted rem values (for everyone else). Special thanks to Chris Epstein (http://chriseppstein.github.com)
* and Martin Bavio (http://martinbavio.com) for the help and code!
*
* Sample input:
* .element {
* @include rem('padding',10px 0 2px 5px);
* }
@chaoren1641
chaoren1641 / gist:7427652
Last active December 28, 2015 02:19
Tengine合并后的URL转换成非合并引用的HTML 在线地址:http://jsfiddle.net/M864P/3/
输入tengine合并的URL:
<br/><br/>
<textarea id="J_tengineUrl">http://g.assets.daily.taobao.net/??malitx/card/1.0.5/c/global/global.css.js,malitx/card/1.0.5/p/index/index.css.js,tbc/m-loading/1.0.1/index.js,malitx/card/1.0.5/c/loading/m-loading/loading.css.js,malitx/card/1.0.5/c/loading/m-loading/index.js,malitx/card/1.0.5/c/loading/loading.css.js,malitx/card/1.0.5/c/loading/index.js,malitx/card/1.0.5/p/index/index.jst.js,malitx/card/1.0.5/p/index/model.jst.js,malitx/card/1.0.5/p/index/prestores.jst.js,malitx/card/1.0.5/c/spa/view-base.js,mtb/lib-windvane/1.4.7/windvane.cmd.js,tbc/km-toast/1.0.2/index.js,malitx/card/1.0.5/c/util/index.js,malitx/card/1.0.5/p/index/init.js,malitx/card/1.0.5/p/index/index.js</textarea>
<br/><br/>
<input type="button" value="转换为非合并的script/style代码" id="J_button" />
<br/><br/>
<textarea id="J_textarea"></textarea>
@chaoren1641
chaoren1641 / gist:7556472
Last active December 28, 2015 20:19
Aliyun UED 前端开发Tab规范
# editorconfig文件定义一致的code style规范
# 根据不同的开发IDE或编辑器统一代码风格
# 详情见 editorconfig.org
root = true
## 除了jade文件以外,全部以4个空格作为tab
[*]
end_of_line = lf
@chaoren1641
chaoren1641 / gist:9884829
Created March 31, 2014 03:39
editorConfig
# editorconfig文件定义一致的code style规范
# 根据不同的开发IDE或编辑器统一代码风格
# 详情见 editorconfig.org
root = true
## 文件新建除JS外使用GBK,JS文件使用utf-8
[*]
end_of_line = lf

Web Components Can Do That?! extras

Thanks a ton for coming down to my talk, folks <33z. Your energy was amazing. This page has a few extra resources for you.

Slides

http://addyosmani.github.io/fitc-wccdt/

# Output Directory
OUTPUT = build
all: css html js
css:
@echo "scss => css"
@compass \
compile
@chaoren1641
chaoren1641 / scrollTo.js
Created June 8, 2016 06:24 — forked from james2doyle/scrollTo.js
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// easing functions http://goo.gl/5HLl8
Math.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) {
return c/2*t*t + b
}
t--;
return -c/2 * (t*(t-2) - 1) + b;
};