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 cok = (function() { | |
| var jos = 1; | |
| var sem = (function() { | |
| if (jos !== 1) { | |
| return 1; | |
| } else { | |
| throw new Error("Error iki lho bro") | |
| } | |
| }()); |
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
| /* | |
| * From http://stackoverflow.com/a/22780569/141363 modified | |
| * to return Promise. | |
| * | |
| * Usage: jsonp(url) | |
| * .then(success) | |
| * .catch(error); | |
| */ | |
| var jsonp = (function(global, body) { | |
| 'use strict'; |
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(WIN) { | |
| var sem = 1; | |
| WIN.sui = function() { | |
| console.log(sem) | |
| }; | |
| function cok() { | |
| WIN.sui(); | |
| } |
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 refineJsonpResponseText(response, callbackName) { | |
| var responseText = response.replace(/\s/g, ""), | |
| tryFirstBorder = responseText.indexOf(callbackName + "({"), | |
| isFirstBorder = tryFirstBorder !== -1, | |
| tryEndBorder = responseText.lastIndexOf("})"), | |
| firstBorder = isFirstBorder ? tryFirstBorder : responseText.indexOf(callbackName + "(\""), | |
| endBorder = tryEndBorder !== -1 ? tryEndBorder : responseText.lastIndexOf("\");"); | |
| responseText = responseText.slice((firstBorder + 3), (endBorder + 1)); | |
| responseText = JSON.parse(responseText); |
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 xhrPromise(url) { | |
| return new Promise(function(resolve, reject) { | |
| var ajax = new XMLHttpRequest(); | |
| ajax.onload = function () { | |
| if (this.status >= 200 && this.status < 300 || this.status == 304) { | |
| resolve(this.response); | |
| } else { | |
| reject(this.statusText); | |
| } |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <!-- Make a DNS handshake with a foreign domain, so the connection goes faster when the user eventually needs to access it. This works well for loading in assets (like images) from another domain, or a JavaScript library from a CDN. --> | |
| <link rel="dns-prefetch" href="//ajax.googleapis.com" /> | |
| <link rel="dns-prefetch" href="//s3.amazonaws.com" /> | |
| <!-- Make sure the latest version of IE is used --> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
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
| /* | |
| * http://christian-fei.com/tutorials/how-to-lazy-load-disqus-comments/ | |
| * | |
| * <div class="comments"></div> | |
| */ | |
| var comments = document.getElementsByClassName('comments')[0], | |
| disqusLoaded = false; | |
| function loadDisqus() { |
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
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
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
| // create a <link> with specific URL | |
| var addLink = function(url){ | |
| var link = document.createElement('link'); | |
| link.src = url; | |
| link.rel = 'stylesheet'; | |
| link.type = 'text/css'; // no need for HTML5 | |
| document.getElementsByTagName('head')[0].appendChild(link); // for IE6 | |
| }; | |
| // create a style that can append CSS rules to <head> |
NewerOlder