Skip to content

Instantly share code, notes, and snippets.

/**
* Define our parser class. It takes in some text, and then you can call "linkifyURLs", or one of the other methods,
* and then call "getHTML" to get the fully parsed text back as HTML!
* @param text that you want parsed
*/
function Parser(text) {
var html = text;
var urlRegex = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
@rblalock
rblalock / app.js
Created April 23, 2011 02:23 — forked from dawsontoth/app.js
Simple remote on demand image caching.
var iconStore = Ti.Filesystem.applicationDataDirectory + '/CachedRemoteImages';
var dir = Ti.Filesystem.getFile(iconStore);
if (!dir.exists()) {
dir.createDirectory();
}
function cacheRemoteURL(image, imageURL) {
if (imageURL) {
var hashedSource = Ti.Utils.md5HexDigest(imageURL + '') + '.' + imageURL.split('.').pop();
var localIcon = Ti.Filesystem.getFile(iconStore, hashedSource);
if (localIcon.exists()) {