Skip to content

Instantly share code, notes, and snippets.

View neekey's full-sized avatar
🎯
Focusing

Neekey neekey

🎯
Focusing
View GitHub Profile
@neekey
neekey / gist-blog-specify-load-path-in-sass.md
Last active December 10, 2015 19:18
使用load-path来指定SASS的import查找路径

SASS@import是最常用的功能之一,默认我们可以使用相对,绝对路径来以当前目录为根节点进行文件的查找,但是有时候我们需要引入的文件并不在我们的当前目录下(并且文件位置相差很大,特别是很多需要被多个项目共用的框架等,如compass)。

针对这样的需求,SASS 可以通过指定--load-path 来添加一个额外用于查找的路径,可以看官方文档:http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import

Sass looks for other Sass files in the current directory, and the Sass file directory under Rack, Rails, or Merb. Additional search directories may be specified using the :load_paths option, or the --load-path option on the command line.

下面举个例子,来说明如何使用:

目录

@neekey
neekey / gist-blog-bubble-with-SASS.md
Last active December 10, 2015 14:48
用SASS编写Bubble组件

这两天在重构项目中的DPL(DESIGN PARTTEN LIBRARY),说白了就是项目需要的样式库(类似Bootstrap).本文结合Bubble的实现来看看如何用SASS来编写一个相对复杂的组件.

什么是Bubble?如图,现在web上这样的设计还是很多的:

Bubble

单单从实现上谈,无非两种,图片和DOM节点模拟:

  • 图片:好处是实现比较简单,但是缺点明显:若要修改箭头的位置/颜色/大小,需要重新作图,后期修改和维护的成本较高
  • DOM节点模拟:实现比较复杂,但是能解决图片方式的所有缺点。
@neekey
neekey / gist-blog-browser-js-error-catch-summary.md
Last active July 31, 2020 10:14
浏览器错误捕捉总结

捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。

window.onerror 讲接收3个参数:

  • msg:错误描述,比如:a is not defined
  • url:出错脚本所在的url
  • lineNumber:出错脚本的行数

本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。

@neekey
neekey / gist-blog-Cordova(PhoneGap)-plugin.md
Created December 24, 2012 10:01
Cordova(PhoneGap)插件编写
@neekey
neekey / sass.md
Last active November 30, 2022 16:03
SASS

Setup/Learning Curve 安装/学习曲线

SASS的安装和学习成本都不高,所有的CSS语法在SASS中都是合法的(.scss)

  • ruby & gem install sass
  • same as CSS / LESS

Mixin 混合

SASS在混合这块和LESS的却别主要在于需要显性地使用@mixin来定义混合,以及@include来引入混合,这样的方式看似麻烦,但是实际上增加了代码的可读性,并且让混合的功能更加专一。

  • @mixin
@neekey
neekey / seleniumWithChromedriver
Created December 15, 2012 11:26
Start Selenium Server with ChormeDirver
java -jar /Users/neekey/stuffs/selenium-server/selenium-server-standalone-2.25.0.jar -Dwebdriver.chrome.driver=/Users/neekey/stuffs/chromedriver/chromedriver
@neekey
neekey / openWindow.js
Created December 11, 2012 03:41
SyncRun的问题
exports.command = function( url, callback)
{
var self = this;
// 先获取当前的窗口windowHandle
this.protocol.windowHandles(function( ret ){
var oldHandles = ret.value;
// 执行脚本打开窗口
@neekey
neekey / jasmine-onFinish.js
Created November 22, 2012 13:21
获知Jasmine的test执行完毕
var jasmineEnv = jasmine.getEnv();
var oldCallback = jasmineEnv.currentRunner().finishCallback;
jasmineEnv.currentRunner().finishCallback = function () {
oldCallback.apply(this, arguments);
console.log(jasmine.getJSReport());
};
@neekey
neekey / protocol.executeAsync.spec.js
Created November 17, 2012 16:56
webdriverNode 多个实例操纵同个session
var assert = require( 'assert' );
var client = require( '../../lib/core/webdriverNode').remote({
desiredCapabilities: {
browserName:"chrome"
}
});
describe( 'Protocol methods', function(){
describe( '#execute()', function(){
it( 'Execute a script.', function( done ){