Skip to content

Instantly share code, notes, and snippets.

Hazel Fidecaro hipsterjazzbo

Block or report user

Report or block hipsterjazzbo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View packing_slip_model.php
/**
* Determines the reconciliation status of the packing slip
*
* @return string $status The status of the packing slip. One of 'reconciled', 'partial', or 'unreconciled'
*/
function status()
{
// Get just the unreconciled item's first, because if it this is 0 we don't need to reconciled ones
$unreconciled_items = Actual_item_model::where(['packing_slip_id' => $this->id, 'merchant_invoice_line_item_id' => 0])->find();
View gist:4653971
<?
function print_if($string, $condition = null)
{
if (is_null($condition))
{
if (is_null($string) || empty($string))
{
return '';
}
View less-sucky.php
<?php
// option 1
$config['admin']['example'] = array(
'table' => 'tbl_example',
'name' => 'Example',
'fields' => array(
'field_1' => 'Field 1 Title',
'field_2' => 'Field 2 Title',
'field_3' => 'Field 3 Title'
@hipsterjazzbo
hipsterjazzbo / is_cached
Created Jul 28, 2011
Check is client is cached in the DB
View is_cached
public function is_cached($client_id)
{
$query = $this->db->select('id')->where('client_id', $client_id)->get('clients');
if($query->num_rows() == 0) {
return false;
}
return true;
}
View tweets.php
<?php
$query = 'weekendhacker';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://search.twitter.com/search.json?q=$query");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
$tweets = json_decode($json);
@hipsterjazzbo
hipsterjazzbo / ajax.php
Created Mar 16, 2011
A CodeIgniter controller to enable dynamic AJAX access to models from views.
View ajax.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Ajax extends CI_Controller {
function __construct()
{
parent::__construct();
}
/**
You can’t perform that action at this time.