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
<html> | |
<head> | |
<script language="javascript"> | |
function ArrayList() { | |
this.aList = []; //initialize with an empty array | |
} | |
ArrayList.prototype.Count = function() { | |
return this.aList.length; |
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 xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = isReady(function(xhr) { | |
console.log(xhr.responseText); | |
}); | |
function isReady(callback) { | |
if (xhr.readyState < 4) { | |
return; | |
} |
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
// ==UserScript== | |
// @name Use Markdown, sometimes, in your HTML. | |
// @author Paul Irish <http://paulirish.com/> | |
// @link http://git.io/data-markdown | |
// @match * | |
// ==/UserScript== | |
// If you're not using this as a userscript just delete from this line up. It's cool, homey. |
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 data = { | |
ids: [12, 18, 27, 35, 41, 53, 66, 68, 72, 85, 94, 103, 111, 120, 133] | |
} | |
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function(xhr) { | |
if (xhr.readyState < 4 || xhr.status !== 200) { | |
return; | |
} |
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
// Uber-basic templating.. good? bad? ugly? | |
function interpolate( str, data ) { | |
data = data || window; | |
return !str | |
? '' | |
: str.replace( /{([^}]*)}/g, function(a,b){ | |
return data[ 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
/* | |
== Tim == | |
A tiny JavaScript micro-templating script. | |
http://gist.github.com/521352 | |
You can use Tim to write simple templates that use JavaScript's | |
familiar dot notation to replace template tags with JSON object | |
properties. | |
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
// get the form | |
var theForm = document.getElementById("vitumob-user-form"); | |
var formdata = new FormData(theForm); | |
//Add the HTML file for the site that failed to be filtered | |
formdata.append("part_html", status.html); | |
// Though: why not also some important data | |
formdata.append("related_url", document.URL); | |
formdata.append("related_host", document.location.host) |
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
/** | |
* LOCAL STORAGE MANAGEMENT FUNCTION | |
* @param options - local(bool), content(object), backup(bool) | |
* @param key | |
* STORE CONTENT locally or in cookie or BOTH | |
* | |
* HOW TO USE: | |
localStorage('key') //Returns the content if existing, or false if it doesnt | |
localStorage('key', { | |
content: the content, can be a raw object, string or raw array //it is stringified by the function |
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 TO CAPITALIZE THE !ST LETTERS IN A STRING | |
String.prototype.capitalize = function() { | |
return this.replace(/(^|\s)([a-z])/g, function(m, p1, p2) { | |
return p1 + p2.toUpperCase(); | |
}); | |
}; |
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
Array.prototype.filter.call(e.querySelector("div").childNodes, function(e) { | |
return 3 == e.nodeType && -1 != e.nodeValue.indexOf(":") | |
}).forEach(function(e) { | |
e = e.nodeValue.split(":", 2); | |
t[e[0].trim().toLowerCase()] = e[1].trim() | |
}); |