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 hasProps(obj) { | |
var argsLen = arguments.length; | |
if (typeof obj !== 'object') return false; | |
if (argsLen <= 1) return false; | |
for (var i = 1, l = argsLen; i < l; i++) | |
if (!obj.hasOwnProperty(arguments[i])) return false; | |
return true; | |
} |
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
sadf |
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 handleLocation = function(pos) { | |
console.log(pos.coords); // User's approximate latitude and longitude | |
console.log(pos.coords.accuracy); // Approximate accuracy in meters | |
}; | |
navigator.geolocation.getCurrentPosition(handleLocation, locError, {maximumAge:10, enableHighAccuracy: true}); |
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
/** | |
* An alias for console.log. Only logs messages if the browser | |
* supports 'console' and the script is running in a dev environment. | |
* | |
* @param {Mixed} Any number of arguments | |
* @return {Undefined} | |
*/ | |
var safeLog = (function(){ | |
var url = window.location.href, | |
logAllowed = url.indexOf('8888') > -1 && window.console; |
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
/** | |
* Search through an array of objects. | |
* | |
* @param {Object} One or more key/value pairs that must exist | |
* in each object for it to be included in the result. | |
* @return {Array} Objects that match the search criteria. | |
*/ | |
Array.prototype.searchObjects = function (params) { | |
if (typeof params !== 'object') { | |
throw new TypeError("Must provide search parameters in object form."); |
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 Network = { | |
// Host we use for determining connectivity | |
pingHost: 'http://www.archmi.com', | |
pingInProgress: false, | |
// If it's PhoneGap or web app environment | |
isPhoneGapEnv: network && 'isReachable' in network, | |
// These default values should not be edited, but they may | |
// change at runtime |
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
Current hash for master: <span id="currentHash"></span> | |
<script> | |
/** | |
* This displays the commit hash for the HEAD of your chosen Git branch. | |
* It helps you stay on the same page with other team members during | |
* development. If their hash matches yours, your branches are in the same state. | |
* | |
* This is useful for web projects that don't follow a standard versioning process. | |
* If you have an automated process for keeping track of versions, this code may | |
* complement it. |
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
<script> | |
var rateLimit = (function () { | |
'use strict'; | |
var processes = {}; | |
return function (pID, fn, rateLimit) { | |
var process = processes[pID]; | |
if (!process) { |
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 vehicles = { | |
car: { | |
brand: 'Ferrari' | |
} | |
}; | |
// This check is obviously OK | |
if (vehicles.car.brand) { | |
} |
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 (exports) { | |
/** | |
* Dependencies | |
* - jsbn.js | |
* - jsbn2.js | |
* - prng4.js | |
* - ec.js | |
* - sec.js | |
* - rng.js |
OlderNewer