Skip to content

Instantly share code, notes, and snippets.

View locvfx's full-sized avatar

Dylan Lopez locvfx

View GitHub Profile
@locvfx
locvfx / .htaccess
Created November 16, 2017 12:59
.htaccess file works with Vanish cache , serves content via https, should setup in root sub domain ex: https://images.domain.com
#Unset all Cookies!
Header unset Cookie
Header unset Set-Cookie
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
@locvfx
locvfx / install_mariadb_columnstore_centos_7_2.md
Created January 12, 2018 05:42 — forked from dtheodor/ install_mariadb_columnstore_centos_7_2.md
Install MariaDB 1.08 Columnstore on Centos 7.2
@locvfx
locvfx / text
Created January 12, 2018 06:53
CodeIgniter - when to use get_instance()
If you are new to CodeIgniter you may be confused as to when you need to use get_instance and when you don't, it certainly tripped me up when I first came back to CodeIgniter after leaving the PHP community for some time.
Luckily it is pretty simple to remember.
If you are writing code that lives within a controller, a model or a view that is under CodeIgniter's control then you do not need to use get_instance.
If however you are writing your own custom libraries or something that sits outside of the MVC files then you do need to use it.
So, if you are inside a model you could do something like this;
@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.

{"lastUpload":"2021-07-16T19:04:46.920Z","extensionVersion":"v3.4.3"}
@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);
@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 / 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 / Capitalize first letter of a text line
Last active March 21, 2020 15:42
PHP - Usefull functions
ucfirst(strtolower($row['name']));
@locvfx
locvfx / 1x1 blank image, smallest size
Created April 22, 2018 03:12
Smallest image #HTML
<img src="data:image/gif;base64,R0lGODlhAQABAAAAACw=" />