Skip to content

Instantly share code, notes, and snippets.

View tomkrush's full-sized avatar

Tom Krush tomkrush

  • Cars.com
  • Oswego IL
View GitHub Profile
// 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'];
}
#include <stdio.h>
int main (int argc, const char * argv[]) {
unsigned long value = 10000000001;
printf("Large Value %lu", value);
return 0;
}

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.

function query()
{
$args = func_get_args();
if ( $args > 0 )
{
$sql = array_shift($args);
$pos = 0;
foreach ($args as $val)
/*-------------------------------------------------
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,
@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'));
@tomkrush
tomkrush / gist:1149816
Created August 16, 2011 18:40
CodeIgniter Jot Migration for Sessions
<?php
class Create_Table_Sessions
{
function up()
{
create_table('ci_sessions', array(
array('name' => 'session_id', 'type' => 'varchar(40)', 'DEFAULT' => '0', 'NOT NULL' => TRUE),
array('name' => 'ip_address', 'type' => 'varchar(16)', 'DEFAULT' => '0', 'NOT NULL' => TRUE),
array('name' => 'user_agent', 'type' => 'varchar(50)', 'NOT NULL' => TRUE),
array('name' => 'last_activity', 'type' => 'int(10)', 'UNSIGNED' => TRUE, 'DEFAULT' => '0', 'NOT NULL' => TRUE),
@tomkrush
tomkrush / gist:1429057
Created December 4, 2011 03:31
Example of class_name
class Post_Model extends My_Model
{
public function init()
{
$this->belongs_to('contributor', array(
'class_name' => 'User_Model',
'foreign_key' => 'contributor_id'
));
$this->belongs_to('editor', array(
<?php
if ( ! function_exists('mailer') )
{
function mailer($to, $from, $subject, $template, $data = array())
{
$headers = "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "From: {$from}\r\n";
$path = get_theme_root() . '/' . get_template() . '/';
@tomkrush
tomkrush / gist:2208677
Created March 26, 2012 18:54
Simple Dropdown.
function dropdown($name, $options, $value, $keys = FALSE, $attrs = array()) {
$attributes = array();
foreach($attrs as $key => $attr)
{
$attributes[] = $key."=\"".$attr."\"";
}
echo '<select name="'.$name.'" '.implode(' ', $attributes).'>';
if ( $keys == TRUE )