cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus
This file contains hidden or 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
| Object.keys(require.cache) | |
| .forEach( function(key) { | |
| delete require.cache[key]; | |
| }) |
This file contains hidden or 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
| display inline-block | |
| display -webkit-flex | |
| display flex | |
| justify-content space-around | |
| -webkit-justify-content space-around |
This file contains hidden or 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
| function heredoc(fn) { | |
| return fn.toString().split('\n').slice(1,-1).join('\n') + '\n' | |
| } | |
| var a = heredoc(function(){/* | |
| <%data.forEach(function(e){%> | |
| <a class="item" href="pizzahut-detail.html?version=*&id=<%=e.pic%>"> | |
| <div class="cnt"> | |
| <img src="img/0<%=e.pic%>.jpg"> | |
| <div class="wrap"> |
This file contains hidden or 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
| display -webkit-box | |
| -webkit-line-clamp 2 | |
| -webkit-box-orient vertical | |
| overflow hidden |
This file contains hidden or 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
| function listenGesture(el) { | |
| // el.on('touchstart', function(e) { | |
| // startX = endX = 0; | |
| // var touch = e.touches[0]; | |
| // startX = touch.pageX; | |
| // }) | |
| // el.on('touchmove', function(e) { | |
| // e.preventDefault(); | |
| // }) |
This file contains hidden or 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
| var $ = require('zepto'), | |
| Toast = function(text) { | |
| var toast = $('<div class="toast"><div class="bg"></div>' + text + '</div>'); | |
| toast.appendTo($('body')); | |
| setTimeout(function() { | |
| toast.animate({opacity: 0}, 300, function() { | |
| $(this).remove(); | |
| }) | |
| }, 2000); |
This file contains hidden or 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
| 'use strict'; | |
| // Add ECMA262-5 method binding if not supported natively | |
| // | |
| if (!('bind' in Function.prototype)) { | |
| Function.prototype.bind= function(owner) { | |
| var that= this; | |
| if (arguments.length<=1) { | |
| return function() { | |
| return that.apply(owner, arguments); |
This file contains hidden or 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
| /** | |
| Initially,module.exports=exports , and the require function returns the object module.exports refers to. | |
| if we add property to the object, say exports.a=1, then module.exports and exports still refer to the same object. So if we call require and assign the module to a variable, then the variable has a property a and it's value is 1; | |
| But if we override one of them, for example, exports=function(){}, then they are different now: exports refers to a new object and module.exports refer to the original object. And if we require the file, it will not return the new object, since module.exports is not refer to the new object. | |
| For me, i will keep adding new property, or override both of them to a new object. Just override one is not right. And keep in mind that module.exports is the real boss. | |
| **/ |