This file contains 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
/** | |
* @author Matthew Penkala <hello@matthewpenkala.com> | |
* @website https://matthewpenkala.com/ | |
* @version 1.0.0 | |
* @description This JavaScript file contains a function named `calculateZIndex` | |
* which, quite evidently, calculates the z-index (CSS) of a given | |
* HTML element by traversing its parents and checking the computed | |
* z-index values. The function ensures an accurate determination of | |
* the z-index even if the z-index value is specified using different | |
* units or if it's inherited from parent elements.*/ |
This file contains 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
// The code - first bit is all the UserAgent library. | |
(function(scope) { | |
var Browsers, OS, Platform, Versions, browser_name, browser_version, os, platform; | |
Versions = { | |
Firefox: /firefox\/([\d\w\.\-]+)/i, | |
IE: /msie\s([\d\.]+[\d])/i, | |
Chrome: /chrome\/([\d\w\.\-]+)/i, | |
Safari: /version\/([\d\w\.\-]+)/i, | |
Ps3: /([\d\w\.\-]+)\)\s*$/i, | |
Psp: /([\d\w\.\-]+)\)?\s*$/i |
This file contains 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
// Copyright 2010 The Emscripten Authors. All rights reserved. | |
// Emscripten is available under two separate licenses, the MIT license and the | |
// University of Illinois/NCSA Open Source License. Both these licenses can be | |
// found in the LICENSE file. | |
// The Module object: Our interface to the outside world. We import | |
// and export values on it. There are various ways Module can be used: | |
// 1. Not defined. We create it here | |
// 2. A function parameter, function(Module) { ..generated code.. } | |
// 3. pre-run appended it, var Module = {}; ..generated code.. |
This file contains 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
history.replaceState && history.replaceState( | |
null, '', location.pathname + location.search.replace(/[\?&]message=[^&]+/, '').replace(/^&/, '?') | |
); |
This file contains 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
:: #cmd #bat #tee #redirect #output | |
:: Author: http://stackoverflow.com/users/1012053/dbenham | |
:: http://stackoverflow.com/questions/11239924/windows-batch-tee-command | |
:: | |
:: batchTee.bat OutputFile [+] | |
:: | |
:: Write each line of stdin to both stdout and outputFile. | |
:: The default behavior is to overwrite any existing outputFile. | |
:: If the 2nd argument is + then the content is appended to any existing | |
:: outputFile. |
This file contains 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
NOTE: This document is OLD - and most of the tips here are probably outdated, since newer versions of Javascript have been | |
released over the years - with newer optimizations and more emphasis on optimizing newly supported syntax. | |
// Array literal (= []) is faster than Array constructor (new Array()) | |
// http://jsperf.com/new-array-vs-literal/15 | |
var array = []; | |
// Object literal (={}) is faster than Object constructor (new Object()) | |
// http://jsperf.com/new-array-vs-literal/26 |
This file contains 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
// browser detect | |
var BrowserDetect = { | |
init: function() { | |
this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; | |
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; | |
this.OS = this.searchString(this.dataOS) || "an unknown OS"; | |
}, | |
searchString: function(data) { | |
for (var i = 0; i < data.length; i++) { | |
var dataString = data[i].string; |
This file contains 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
// Taken from http://upshots.org/javascript/jquery-copy-style-copycss | |
(function($) { | |
$.fn.getStyleObject = function() { | |
var dom = this.get(0); | |
var style; | |
var returns = {}; |