Skip to content

Instantly share code, notes, and snippets.

View locvfx's full-sized avatar

Dylan Lopez locvfx

View GitHub Profile
@locvfx
locvfx / Table
Last active March 18, 2020 14:00
SQL Collection
# Dupplicate Table's Structure
Create table abc select * from def limit 0;
# Copy Table structure and Data
Create table `bf_products_weekly_featured` select * from `bf_products_inventory` WHERE `in_shops` = 'bf_products_weekly_featured' limit 10;
#Select Random record (in huge table)
SELECT name
FROM random AS r1 JOIN
(SELECT CEIL(RAND() *
@locvfx
locvfx / nginx.conf
Created June 7, 2019 17:00 — forked from kmjones1979/nginx.conf
Example NGINX configuration to route based on country code using GeoIP
# load dynamic modules
load_module /etc/nginx/modules/ngx_http_geoip_module.so;
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
@locvfx
locvfx / docker-cleanup-resources.md
Created June 6, 2019 04:28 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@locvfx
locvfx / precompresscssjswebfont.sh
Created May 30, 2019 03:56 — forked from magnetikonline/precompresscssjswebfont.sh
Recursively pre-compress (gzip) CSS/JavaScript/webfont assets for use Nginx and its HttpGzipStaticModule module.
#!/bin/bash -e
function compressResource {
gzip --best "$1" >"$1.gz"
touch --no-create --reference="$1" "$1.gz"
echo "Compressed: $1 > $1.gz"
}
@locvfx
locvfx / index.html
Created May 22, 2019 04:31 — forked from jrue/index.html
HTML & CSS Wheel Of Fortune / Bingo Game
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Wheel of Fortune Bingo</title>
<!--
MIT License
@locvfx
locvfx / function.php
Created May 21, 2019 09:32
How To Create a Page When the Theme Is Activated #wordpress
if (isset($_GET['activated']) && is_admin()){
$new_page_title = 'This is the page title';
$new_page_content = 'This is the page content';
$new_page_template = ''; //ex. template-custom.php. Leave blank if you don't want a custom page template.
//don't change the code bellow, unless you know what you're doing
$page_check = get_page_by_title($new_page_title);
$new_page = array(
@locvfx
locvfx / wp-disable-plugin-update.php
Created May 15, 2019 13:55 — forked from rniswonger/wp-disable-plugin-update.php
WordPress - Disable specific plugin update check
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
@locvfx
locvfx / .gitattributes
Created April 21, 2019 13:32 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@locvfx
locvfx / Get random Record (super fast query)
Last active April 12, 2020 04:33
Codeigniter DB Query
$table_name = '';
$results = array();
$limit = 1;
$sql = "SELECT *
FROM $table_name AS r1 JOIN
(SELECT CEIL(RAND() *
(SELECT MAX(id)
FROM $table_name)) AS id)
AS r2
WHERE r1.id >= r2.id
@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"