Skip to content

Instantly share code, notes, and snippets.

View locvfx's full-sized avatar

Dylan Lopez locvfx

View GitHub Profile
@locvfx
locvfx / php.ini
Created January 10, 2019 10:51 — forked from fuyuanli/php.ini
Disable Dangerous PHP Functions
disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, mysql_pconnect, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode"
@locvfx
locvfx / CI modular
Created December 26, 2018 14:58
Call method cross module
$this->load->module('dashboard');
$this->dashboard->method();
@locvfx
locvfx / crop-resize-image
Created December 19, 2018 13:37
Crop and resize image
<?php
// File and new size
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-Type: image/jpeg');
// Get new sizes
list($width, $height) = getimagesize($filename);
@locvfx
locvfx / random.sql
Last active November 19, 2018 03:10
SQLl to select random record in huge data table #SQL
SELECT `post_title` FROM bf_article_posts AS r1 JOIN (SELECT CEIL(RAND() * (SELECT MAX(id) FROM bf_article_posts)) AS id) AS r2 WHERE r1.id >= r2.id ORDER BY r1.id ASC LIMIT 10
#https://stackoverflow.com/questions/4329396/mysql-select-10-random-rows-from-600k-rows-fast
#http://jan.kneschke.de/projects/mysql/order-by-rand/
@locvfx
locvfx / convert post's title to post's slug
Created August 24, 2018 08:47
convert post's title to post's slug #MYSQL
UPDATE TABLE_NAME SET post_slug = LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(post_title), ':', ''), '’', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-'))
@locvfx
locvfx / Get the first element of an array
Created August 24, 2018 07:39
Get the first element of an array #php
array_values($array)[0];
@locvfx
locvfx / constants
Created August 24, 2018 03:13
Usefull constants #CI #BF
BFPATH - > '/bonefire/'
FCPATH -> '/public/'
BASEPATH -> '/system/'
//in CI_Bonfire : /bonfire/ci3/
APPPATH -> '/application/'
#return filename
basename($path);
@locvfx
locvfx / html + javascript
Created August 23, 2018 09:16
Display thumbnail image when mouse hover #javascript
<span class="help-block"><a rel="featured_image_popover" href="<?=$data['post_featured_image'];?>" data-img="<?=$data['post_featured_image'];?>" target="_blank">image's URL</a></span>
$('a[rel=featured_image_popover]').popover({
html: true,
trigger: 'hover',
placement: 'bottom',
content: function () { return '<img class="img-responsive" src="' + $(this).data('img') + '" />'; }
});
@locvfx
locvfx / sitemao.xml
Created August 11, 2018 15:58
Sitemap example #xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>http://www.example.com/foo.html</loc>
<image:image>
<image:loc>http://example.com/image.jpg</image:loc>
<image:caption>Dogs playing poker</image:caption>
</image:image>
@locvfx
locvfx / .css
Created August 8, 2018 14:31
How To Make a Responsive 100% Width YouTube iFrame Embed #HTML #CSS #youtube
.container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}
.video {
position: absolute;
top: 0;
left: 0;