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
/** | |
* Converts a ColdFusion query into an array of structures. | |
* | |
* @param query The ColdFusion query to be converted. | |
* @return An array of structures representing the query data. | |
*/ | |
function queryToArrStruct(query) { | |
// Serialize the query into JSON with "struct" as the second parameter | |
var serializedQuery = serializeJSON(query, "struct"); | |
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
function bionicizeText(str) { | |
let phrase = str.split(" "); | |
let results = []; | |
results.push(phrase.map(word => bionicizeWord(word))); | |
return results.join(" "); | |
function bionicizeWord(w) { | |
let strong = document.createElement('strong'); |
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
function isPrime(thisNum){ | |
if ( thisNum <= 1 ) | |
return false; | |
for ( x = 2; x <= Math.sqrt(thisNum); x++ ){ | |
if ( thisNum % x == 0 ) | |
return false; | |
} | |
return true; |
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
/** | |
* ChineseZodiac.js - JavaScript object, find Chinese Zodiac animal based on birthyear provided | |
* @type {Object} | |
* @namespace | |
*/ | |
var ChineseZodiac = { | |
/** | |
* animals, array of all 12 animals in the Chinese Zodiac |
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
function propComparator(sortBy){ | |
return function(a,b){ | |
let fieldsToSortBy = sortBy.split(","); | |
for ( x = 0; x < fieldsToSortBy.length; x++ ) { | |
let results = 0; | |
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
// inspired by Academind's "JavaScript Algorithms Crash Course" | |
// see https://www.youtube.com/watch?v=JgWm6sQwS_I for more like this | |
// Imagine you have a list of items, and each item has a value and a weight associated with it. | |
items = [ | |
{ id: "b", val: 6, w: 8 }, | |
{ id: "a", val: 10, w: 3 }, | |
{ id: "c", val: 3, w: 3 }, | |
]; |
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
function titleToggle( currTitle, tmpTitle, msInterval){ | |
var currTitle = currTitle; | |
var tmpTitle = tmpTitle; | |
var msInterval = msInterval; | |
var timerID = -1; | |
this.stop = function() { | |
if ( timerID != -1) { | |
clearInterval(timerID); |
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
// gets a random number between min and max, inclusive. Source: Mozilla Developer Network | |
function getRandomIntInclusive(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1) + min); | |
} | |
// find lucky number, going from 1 to 100, in sequence | |
function runLowToHighTrial(){ | |
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
<!--- change datasource as needed ---> | |
<cfset thisDatasource = "example"> | |
<!--- retrieve and display all table names in order ---> | |
<cfquery name="getAllTableNames" datasource="#thisDatasource#"> | |
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' | |
ORDER BY Table_Name | |
</cfquery> | |
<cfdump var="#getAllTableNames#" label="getAllTableNames" expand="false"> |
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: (function () { /* finds current URL in Wayback Machine */ document.location = "https://web.archive.org/web/*/" + document.location; }()); |
NewerOlder