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 getWindowSize() { | |
| if (window.innerWidth || window.innerHeight) { | |
| return [window.innerWidth,window.innerHeight]; | |
| } | |
| else { | |
| return [(document.documentElement.clientWidth||document.body.clientWidth||document.body.scrollWidth),(document.documentElement.clientHeight||document.body.clientHeight||document.body.scrollHeight)]; | |
| } | |
| } |
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
| document.addEventListener("DOMContentLoaded", start); | |
| Array.prototype.slice.call(document.getElementsByTagName("p")); | |
| function Each(obj, fn) { | |
| if (obj.length) for (var i = 0, ol = obj.length, v = obj[0]; i < ol && fn(v, i) !== false; v = obj[++i]); | |
| else for (var p in obj) if (fn(obj[p], p) === false) break; | |
| }; | |
| document.getElementById("clickme").addEventListener("click", function(e) { |
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
| /* JavaScript polyfill to fix scope issues with the setInterval */ | |
| var __nativeST__ = window.setTimeout, __nativeSI__ = window.setInterval; | |
| window.setTimeout = function (vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */) { | |
| var oThis = this, aArgs = Array.prototype.slice.call(arguments, 2); | |
| return __nativeST__(vCallback instanceof Function ? function () { | |
| vCallback.apply(oThis, aArgs); | |
| } : vCallback, nDelay); | |
| }; |
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
| GNU nano 2.2.6 File: ./mysql-rename-db.sh | |
| #!/bin/bash | |
| # update username and password where mysql is executed in this file | |
| mysqlconn="mysql -u 'root' -p ''" | |
| # export the data for the old database name | |
| mysqldump -u root --password="" $1 > $2".sql"; | |
| # create a database for the new database name |
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
| /** | |
| * @param {HtmlElement} element | |
| */ | |
| function removeAllChildren(element) | |
| { | |
| while (element.firstChild) | |
| { | |
| element.removeChild(element.firstChild); | |
| } | |
| } |
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
| /** | |
| * @param {HtmlSelectElement} element | |
| */ | |
| function removeAllSelectOptions(element) | |
| { | |
| while (element.options.length) | |
| { | |
| element.remove(0); | |
| } | |
| } |
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
| /** | |
| * @param {HtmlSelectElement} selectElement | |
| */ | |
| function removeAllSelectOptions(selectElement) { | |
| selectElement.parentNode.replaceChild(selectElement.cloneNode(false), selectElement); | |
| } |
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 Executor = (function() | |
| { | |
| var commands = {}, | |
| executor = { | |
| handle: function(commandName, callback) | |
| { | |
| var commandHandler = { | |
| ref: this, | |
| callback: callback | |
| }; |
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
| for (var i=0, each; each = arr[i]; i++) { | |
| doSomething(each); | |
| } | |
| for (var i=arr.length; i--;) { | |
| var member = arr[i]; | |
| doSomething(member); | |
| } | |
| function sum(arr) { |
OlderNewer