Skip to content

Instantly share code, notes, and snippets.

View alfredwesterveld's full-sized avatar

Alfred Westerveld alfredwesterveld

View GitHub Profile
<?php defined('SYSPATH') or die('No direct script access.');
class User_Model extends ORM {
protected $ignored_columns = array('birthday_day', 'birthday_month', 'birthday_year');
public function validate(array & $array, $save = FALSE)
{
$array = Validation::factory($array)
->pre_filter('trim')
A unit test helper library for App Engine.
Note that this is currently COMPLETELY UNTESTED. Consider it demo code only.
This library aims to make it easier to unit-test app engine apps and libraries
by handling the creation and registration of service stubs and so forth for you.
It also provides a custom implementation of the Capability service that allows
you to specify what capabilities you want it to report as disabled, and it wraps
all stubs in a wrapper that will throw a CapabilityDisabledError if you attempt
to use a disabled service or method.
/*
To avoid polluting the global namespace this uses an anonymous
function which is called with either the URL for an external
JavaScript file or a function. In either case jQuery will be loaded
from the Google CDN before your code is executed so it's free to
depend on jQuery without checking for it and can do things like
jQuery.getScript() to load other components (e.g. jQuery UI),
stylesheets, etc.
*/
(function (target, msg) {
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
Simple snippets for http://github.com/alfredwesterveld/java-schedule-broadcaster
Predis.php
Predis_Compatibility.php
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
curl http://npmjs.org/install.sh | sh
<?php
class Cache {
private $Cache_Lite;
function __construct(array $options) {
$this->Cache_Lite = new Cache_Lite($options);
}
<html>
<head>
<link rel="stylesheet" href="token-input-facebook.css" type="text/css" />
</head>
<body>
<h1>Jquery Tokenizing Autocomplete Input</h1>
<div>
<h2>Facebook style</h2>