Skip to content

Instantly share code, notes, and snippets.

View tessas-capella's full-sized avatar

tessas-capella

View GitHub Profile
@tessas-capella
tessas-capella / jsFindCommonWrapperFiles.js
Created March 1, 2013 16:31
sniffs file's location and writes style sheet links and js script tags depending on what environment the file is being served from. Searches for that server's common wrapper files. - localhost, cis subdomain, ffti courseroom.
<script>
//check where page is coming from
var hostname = window.location.hostname;
if(hostname == 'localhost'){
var sharedResources = "//localhost/00-medtronic/";
}else if(hostname == 'customsolutions.capella-id.com'){
var sharedResources = "//customsolutions.capella-id.com/medtronic/";
}else{
var sharedResources = "//medtronic.capella.edu/file.php/1/media/";
@tessas-capella
tessas-capella / resiglogtrace.js
Last active October 12, 2015 08:18
John Resig's handy catch-all log (As seen in: "Secrets of the Javascript Ninja"). Amended with my own line number add-on for Chrome & Firefox. 2013.03.01 update: just added css support for chrome and console.time and console.timeEnd so you can track how fast your code is!
//John Resig's handy catch-all log (amended with my own linenumber add-on + new and improved CSS support for chrome!):
function trace() {//just cause I like "trace" better than his "log"
try {
var dA = navigator.userAgent.toLowerCase(), fF = dA.match(/(firefox)/);
//show linenumber in FireFox & Chrome
if(fF){var lnVal = 1;}else{var lnVal = 2;}//fireFox sorts Error stack differently
var linenumber = new Error().stack.split("\n")[lnVal], index = linenumber.indexOf("at "), clean = linenumber.slice(index+2, linenumber.length), cleaner = clean.split(":");
console.log.apply(console, arguments);
if(fF){
console.log("--------------------------------------------------------------- line:"+Array.prototype.slice.call(cleaner)[2]);