PHP's array_intersect
throws a fit if you only pass in one array cause it's a whiney baby. This one is good.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directive @all( | |
""" | |
Specify the class name of the model to use. | |
This is only needed when the default model resolution does not work. | |
""" | |
model: String | |
""" | |
Apply scopes to the underlying query. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.location.href = `v-for-wiki://${window.location.host}${window.location.pathname}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE03="\[\033[38;5;234m\]" | |
BASE02="\[\033[38;5;235m\]" | |
BASE01="\[\033[38;5;240m\]" | |
BASE00="\[\033[38;5;241m\]" | |
BASE0="\[\033[38;5;244m\]" | |
BASE1="\[\033[38;5;245m\]" | |
BASE2="\[\033[38;5;254m\]" | |
BASE3="\[\033[38;5;230m\]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function new_recurring_instance($job_template_id) | |
{ | |
$job_template = Job_template_model::find($job_template_id); | |
$new_job_instance = Job_model::create(); | |
// Copy some fields from template | |
$new_job_instance->company_id = $job_template->company_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function print_if($string, $condition = null) | |
{ | |
if (is_null($condition)) | |
{ | |
if (is_null($string) || empty($string)) | |
{ | |
return ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
NewerOlder