Skip to content

Instantly share code, notes, and snippets.

View locvfx's full-sized avatar

Dylan Lopez locvfx

View GitHub Profile
@locvfx
locvfx / wp-increase-timeout.php
Created August 3, 2018 08:15 — forked from sudar/wp-increase-timeout.php
Increase the curl timeout in WordPress
<?php
Copied from http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/
//adjustments to wp-includes/http.php timeout values to workaround slow server responses
add_filter('http_request_args', 'bal_http_request_args', 100, 1);
function bal_http_request_args($r) //called on line 237
{
$r['timeout'] = 15;
return $r;
}
@locvfx
locvfx / load-css
Created May 4, 2018 03:22
Bonfire - Assets & Templates
//Load CSS files
Assets::add_css(
array( 'bootstrap/bootstrap-3.3.7.min.css','font-awesome.css',
'styles.css','mystyles.css',
$data['scheme']
)
);
//Put in header section
echo Assets::css();
@locvfx
locvfx / 1x1 blank image, smallest size
Created April 22, 2018 03:12
Smallest image #HTML
<img src="data:image/gif;base64,R0lGODlhAQABAAAAACw=" />
@locvfx
locvfx / Capitalize first letter of a text line
Last active March 21, 2020 15:42
PHP - Usefull functions
ucfirst(strtolower($row['name']));
@locvfx
locvfx / check-type.php
Created April 21, 2018 14:31
PHP - Check variable's type
if (is_numeric($param)) {
//TRUE
}
else {
//FALSE
}
if (!empty($param)) {
//not empty
}
@locvfx
locvfx / Query helper methods
Last active January 16, 2024 15:22
Codeigniter - Query builder #database
$this->db->insert_id()
//The insert ID number when performing database inserts.
$this->db->affected_rows()
//Displays the number of affected rows, when doing “write” type queries (insert, update, etc.).
$this->db->last_query()
//Returns the last query that was run (the query string, not the result). Example:
$this->db->count_all()
@locvfx
locvfx / Count records
Last active December 26, 2018 02:17
Bonfire - Query builder #database #cibonfire #PHP
$tmp = $this->inventory_model->select('id')->as_array()->order_by($id, 'asc')->find_all();
$max = count($tmp);
echo $max;
//$tmp = $this->inventory_model->select('id')->as_array()->order_by($id, 'asc')->find_all();
//$max = end($tmp);
{"lastUpload":"2021-07-16T19:04:46.920Z","extensionVersion":"v3.4.3"}
@locvfx
locvfx / README.md
Created February 6, 2018 03:33 — forked from mikedfunk/README.md
CodeIgniter Pagination for Twitter Bootstrap

This uses Twitter Bootstrap classes for CodeIgniter pagination.

Drop this file into application/config.