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
//listen for hash tag changes so we can remove the popup | |
$(window).bind('hashchange', | |
function(event){ | |
//did we add or substract the hash? | |
var currentHash = window.location.hash; | |
currentHash = currentHash.slice(1); | |
if(window.console && debug){ | |
console.log(['listings.js: hashchange event detected. currentHash is ', currentHash ].join('')); | |
} |
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
//there are exceptions to the rule | |
{ | |
"property1" : "value1", | |
"property2" : "value2", | |
"property3" : ["value3.1","value3.2"] | |
} |
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
SELECT NEW_LINE_INDEX | |
FROM ( | |
SELECT INSTR(value, "\n") | |
AS NEW_LINE_INDEX | |
FROM table | |
WHERE value != "" | |
ORDER BY value | |
) findNewLines | |
WHERE NEW_LINE_INDEX > 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
SELECT TRIM(TRAILING SUBSTR(value,NEW_LINE_INDEX-1) | |
FROM value) as NEW_VALUE | |
FROM ( | |
SELECT INSTR(value, "\n") | |
AS NEW_LINE_INDEX, | |
value | |
FROM table | |
WHERE value != "" | |
ORDER BY value | |
) findNewLines |
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 table = {}, cloth = {}; | |
table.clean = false; | |
cloth.clean = true; | |
// clean the table please | |
function wipeTable(cloth){ | |
console.log("cleaning table"); | |
if(cloth.clean){ | |
table.clean = 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
function log(message){ | |
if(window.console){ | |
console.log(message); | |
} | |
} | |
function warn(message){ | |
if(window.console){ | |
console.warn(message); | |
} |
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
// remove special characters from strings | |
// @return {string} | |
String.prototype.removeSpecialCharacters = function (){ | |
return this.replace(/\t|\?|\r/gi,'').replace(/\n|\_|\-/gi,' '); | |
}; |
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
// checks our test conditions | |
// @param - condition (function) test to run | |
// @param - ref (string) to display for result | |
assert = function (condition, ref){ | |
if(condition){ | |
console.log("+ Passed: " + ref); | |
} else { | |
console.log("- Failed: " + ref, 'warn'); | |
} | |
}; |
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
/* | |
* copy and paste into your browser's console to run and | |
* then use like so | |
* interprete("Jajwd tujwfynts wjfhmjx f wnxp-fxxjxxrjsy xyflj. Fy ymnx utnsy rd ijyjwrnsfynts nx ymfy snfsynh nx hfzxnsl rtwj ywtzgqj ymfs ny nx btwym") | |
*/ | |
// simple deciphering scheme | |
var alphabet = "abcdefghijklmnopqrstuvwxyz"; | |
var sillyAlphabet = "vwxyzabcdefghijklmnopqrstu"; | |
var decrypt = {}; |
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
it('create with 2 items', function () { | |
item.set({ | |
title: "The cloud atlas", | |
author: "David Mitchell" | |
}); | |
item.save(); | |
item.set({ | |
title: "Design of design", | |
author: "Brooks" |
OlderNewer