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
| $('#toc').tocify({ | |
| 'showAndHideOnScroll': false | |
| }); |
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
| // Checks to see if any CSS rule using inline-block also includes the IE6 and IE7 inline-block hack | |
| // If the IE hacks are not there, they are added | |
| var css = require('css'), | |
| _ = require('lodash'), | |
| exampleCSS = '.example-selector { display: inline-block; }', | |
| ast = css.parse(exampleCSS); | |
| _.each(ast.stylesheet.rules, function(rule) { | |
| fixIEBugs(rule); | |
| }); |
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 esprima = require('esprima'), | |
| estraverse = require('estraverse'), | |
| escodegen = require('escodegen'); | |
| console.log('esprima', esprima); | |
| console.log('estraverse', estraverse); | |
| console.log('escodegen', escodegen); |
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
| // Node.js Environment | |
| var code = 'function jqcon() {}', | |
| esprima = require('esprima'), | |
| ast = esprima.parse(code); | |
| console.log('ast', ast); |
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
| // Node.js Environment | |
| var code = 'function jqcon() {}', | |
| esprima = require('esprima'), | |
| ast = esprima.parse(code), | |
| estraverse = require('estraverse'); | |
| estraverse.traverse(ast, { | |
| enter: function (node, parent) {}, | |
| leave: function(node, parent) {} | |
| }); |
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
| // Node.js Environment | |
| var code = 'function jqcon() {}', | |
| esprima = require('esprima'), | |
| ast = esprima.parse(code), | |
| estraverse = require('estraverse'); | |
| estraverse.replace(ast, { | |
| enter: function (node, parent) { | |
| if(node.type === 'Identifier' && node.name === 'jqcon') { | |
| // Changes the 'jqcon' function name to 'jqcon_is_awesome' |
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
| // Node.js Environment | |
| var code = 'function jqcon() {}', | |
| esprima = require('esprima'), | |
| ast = esprima.parse(code), | |
| estraverse = require('estraverse'); | |
| estraverse.traverse(ast, { | |
| enter: function (node, parent) { | |
| if(node.type === 'Identifier') { | |
| node.name = node.name + '_is_awesome'; |
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 debounce(func, wait) { | |
| // we need to save these in the closure | |
| var timeout, args, context, timestamp; | |
| return function () { | |
| // save details of latest call | |
| context = this; | |
| args = [].slice.call(arguments, 0); | |
| timestamp = new Date(); | |
| // this is where the magic happens | |
| var later = function () { |
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 each (collection, callback) { | |
| var x, len; | |
| if(Utils.isArray(collection)) { | |
| x = -1; | |
| len = collection.length; | |
| while(++x < len) { | |
| if (callback(x, collection[x]) === false) { | |
| break; | |
| } | |
| } |
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 replayYouTubeVideo() { | |
| var video = document.querySelector('.html5-main-video'); | |
| setInterval(function() { | |
| if(video.currentTime === video.duration) { | |
| video.currentTime = 0; | |
| } | |
| }, 5000); | |
| }()); |
OlderNewer