Skip to content

Instantly share code, notes, and snippets.

@tomkrush
tomkrush / User Model
Created June 10, 2011 03:54
User Model and authentication using Jot
<?php
class User_Model extends My_Model
{
public function init()
{
$this->transient('confirm_password');
$this->before_save('encrypt_password');
$this->validates('password', array('presence', 'confirm'));
/*-------------------------------------------------
RESETS
-------------------------------------------------*/
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, a, abbr, address, cite, code, del, dfn, em,
img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i,
dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figure, figcaption, hgroup,
function query()
{
$args = func_get_args();
if ( $args > 0 )
{
$sql = array_shift($args);
$pos = 0;
foreach ($args as $val)

Rounded rectangle with gradient background on the iPhone, NSTokenFieldCell style.

Screenshot

Unlike my previous implementation, this one is drawn inside a single view using Core Graphics. It can thus be used for optimized, fast-scrolling cells per Apple's TableViewSuite sample.

The gradient shades are changed from that implementation, too, and the border itself is gradiented (by drawing a smaller rectangle inside a larger one that becomes the border).

You need to include the uicolor-utilities category by Ars Technica.

#include <stdio.h>
int main (int argc, const char * argv[]) {
unsigned long value = 10000000001;
printf("Large Value %lu", value);
return 0;
}
// This is pulled from Kohana. You should be able to extract the basic concept of it and implement it in CodeIgniter
public function send_file($filename, $download = NULL, array $options = NULL)
{
if ( ! empty($options['mime_type']))
{
// The mime-type has been manually set
$mime = $options['mime_type'];
}