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
/** | |
* getFactors - find all factors of an integer in pairs | |
* @param, N, an integer | |
* returns a multidimensional array (e.g. 4 gets: [1,4],[2,2],[4,1]) | |
*/ | |
function getFactors(N) { | |
"use strict"; | |
var x; |
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
/** | |
* disemvowel - remove vowels from a string | |
* @param {string} phrase - the string you want to "disemvowel" | |
*/ | |
function disemvowel(phrase) { | |
"use strict"; | |
return phrase.replace(/[aeiou]/ig, ""); | |
} |
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
/** | |
* howManyXinYthruZ.js - solves those annoying "How Many X's Are There In Y Through Z?" puzzles | |
* @type {object} | |
* @namespace | |
*/ | |
var puzzle = { | |
/** | |
* Our variables/properties. No need to assign values, our function does that for us. |
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
var Euclid = {}; | |
Euclid.gcd = function greatestCommonDivisor( a, b) { | |
"use strict"; | |
var lilNum, bigNum, modulo; | |
lilNum = Math.min( a, b); | |
bigNum = Math.max( a, b); |
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
// improved (added line 10) | |
function k(a) { | |
var b = i("div", ["jw-sharing-row", "jw-sharing-" + a]) | |
, c = i("span", ["jw-sharing-svg-row-icon", "jw-sharing-icon-" + a]) | |
, d = i("span", ["jw-sharing-cell"], c); | |
b.appendChild(d); | |
var e = i("textarea", ["jw-sharing-text"]); | |
return new u(e).on("click tap", l, e), | |
e.setAttribute("readonly", "true"), | |
e.setAttribute("title", a) |
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
<cffunction name="CEDataArrayToQuery" returntype="query" description="convert array of structs from getCEData into a CF query"> | |
<cfargument name="CEDataArray" type="array" required="yes"> | |
<cftry> | |
<!--- begin by getting struct keys from Values first ---> | |
<cfset valueKeys = StructKeyList(arguments.CEDataArray[1].Values)> | |
<!--- then create our query, using those keys ---> | |
<cfset qData = QueryNew(valueKeys)> | |
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
// JavaScript OOP Notes & Examples | |
// The "Singleton" Approach | |
var fizzbuzz = { | |
start: 1, | |
stop: 100, | |
modFizz: 3, | |
modBuzz: 5, | |
sayFizz: "fizz", | |
sayBuzz: "buzz", |
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
var timeValue = "2:00 PM"; | |
var apptTimes = "10:00 AM, 12:00 PM, 3:00 PM"; | |
if (apptTimes.indexOf(timeValue) > -1) { | |
// selected time has already been added to apptTimes previously | |
alert("This time has already been added before."); | |
} |
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
<cfsavecontent variable="outputHTML"> | |
<cfoutput> | |
<script type="text/javascript" src="/common/commonspot/templates/js/jwplayer/jwplayer.js"></script> | |
<script type="text/javascript">jwplayer.key="PUT_YOUR_API_KEY_HERE_OBVIOUSLY";</script> | |
</cfoutput> | |
</cfsavecontent> | |
<cfoutput> | |
#application.adf.scriptsService.renderScriptOnce("JWPlayer", outputHTML)# | |
</cfoutput> |
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
// 1st given: the .get call on line 5 should fire only when .sidebar is present | |
// 2nd given: the current page does NOT have any element with a .sidebar attribute | |
if ($('.sidebar')) { | |
$.get( "ajax/fundraising.html", function( data ) { | |
$( '.sidebar' ).html( data ); | |
}); | |
} |