Skip to content

Instantly share code, notes, and snippets.

@smajda
smajda / aggregate-feed.php
Created October 7, 2009 16:41
Merge multiple RSS feeds with SimplePie
<?php
/* Merge multiple RSS feeds with SimplePie
*
* Just modify the path to SimplePie and
* modify the $feeds array with the feeds you want
*
* You should probably also change the channel title, link and description,
* plus I added a CC license you may not want
*
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/
@jeffrafter
jeffrafter / handler.js
Created April 2, 2010 20:59
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}
@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@coomsie
coomsie / validation.js
Created May 5, 2011 10:16
form validation for titaniuim mobile projects
//UI for valiation
function validationMessages() {
//*** 'me' acts as an alias that can be used within the methods
var me = this;
var imgPath=Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,"images/bubble.png");
validationMessages.totalErrors =0;
validationMessages.reqdfieldsRemaining=0;
@matoakley
matoakley / gist:1092571
Created July 19, 2011 14:38
MySQL to convert a string into a slug
LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM('My String'), ':', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) AS `post_name`
@kwhinnery
kwhinnery / parse.js
Created August 27, 2011 04:03
A Parse client for Titanium Mobile - sneak peek
//Public client interface
function Client(applicationId, masterKey) {
this.applicationId = applicationId;
this.masterKey = masterKey;
}
exports.Client = Client;
//Parse API endpoint
var ENDPOINT = 'https://api.parse.com/1/classes/';
@jeffbonnes
jeffbonnes / tracer.js
Created September 12, 2011 01:10
A tracer object to Titanium Mobile to show elapsed time and memory usage
var tracer = {};
(function() {
tracer.levels = {};
tracer.levels.DEBUG = 1;
tracer.levels.INFO = 2;
tracer.levels.WARN = 3;
tracer.levels.ERROR = 4;
tracer.levels.OFF = 5;
tracer.allTracers = [];
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@tzmartin
tzmartin / gist:1372475
Created November 17, 2011 05:53
UIModule Error Hack
/*
* This is a hack solves the "Invalid method passed to UIModule" error
* It works by forcing Titanium to load SDK components into memory.
*
* Drop this file anywhere in your project and DON'T Ti.include() it.
* Be sure this file extension is .js.
* Clean and recompile your project.
*
* Enjoy!
* @tzmartin
var win = Ti.UI.createWindow({
title : 'Profile'
});
var mainViewHeight = Ti.Platform.displayCaps.platformHeight
- ClubTonight.ui.defaults.iphone.statusBarHeight
- ClubTonight.ui.defaults.iphone.navBarHeight
- ClubTonight.ui.defaults.iphone.tabBarHeight;
var scrollView = Titanium.UI.createScrollView({
top : 0,
contentWidth : Ti.Platform.displayCaps.platformWidth,