Skip to content

Instantly share code, notes, and snippets.

Avatar

Dylan Lopez locvfx

View GitHub Profile
@locvfx
locvfx / Table
Last active Mar 18, 2020
SQL Collection
View Table
# 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 Jun 7, 2019 — forked from kmjones1979/nginx.conf
Example NGINX configuration to route based on country code using GeoIP
View nginx.conf
# 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 Jun 6, 2019 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

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 — forked from magnetikonline/precompresscssjswebfont.sh
Recursively pre-compress (gzip) CSS/JavaScript/webfont assets for use Nginx and its HttpGzipStaticModule module.
View precompresscssjswebfont.sh
#!/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 — forked from jrue/index.html
HTML & CSS Wheel Of Fortune / Bingo Game
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Wheel of Fortune Bingo</title>
<!--
MIT License
@locvfx
locvfx / function.php
Created May 21, 2019
How To Create a Page When the Theme Is Activated #wordpress
View function.php
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 — forked from rniswonger/wp-disable-plugin-update.php
WordPress - Disable specific plugin update check
View wp-disable-plugin-update.php
/**
* 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 Apr 21, 2019 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
View .gitattributes
## 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
View Get random Record (super fast 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 Jan 10, 2019 — forked from fuyuanli/php.ini
Disable Dangerous PHP Functions
View php.ini
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"
You can’t perform that action at this time.