Skip to content

Instantly share code, notes, and snippets.

View locvfx's full-sized avatar

Dylan Lopez locvfx

View GitHub Profile
@locvfx
locvfx / index.php
Last active September 3, 2023 15:19 — forked from uhtred/placeholdit.php
PHP: Placehold it image
<?php
/*
How to use
/940x278
/940x278/000000
/940x278&text=Texto
/940x278/000000&text=Texto
RewriteEngine On
@locvfx
locvfx / Random Images on Refresh
Created June 22, 2016 03:03 — forked from stephenscaff/Random Images on Refresh
Super simple way to randomly load new images on refresh via Jquery and DOM injection. Great for banners.
<!DOCTYPE html>
<head>
<!--Little CSS fade in -->
<style>
.fade-in{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;
@locvfx
locvfx / example.html
Created August 21, 2016 02:25 — forked from nu7hatch/example.html
Simple banner rotator with jQuery
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<link href="rotate.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="rotate.js"></script>
<script type="text/javascript">
$(window).load(function() {
startRotator("#rotator");
})
</script>
@locvfx
locvfx / gist:57e0633138d3abf09c9c59a1cd32f333
Created November 7, 2016 03:14 — forked from matoakley/gist:1092571
MySQL to convert a string into a slug
LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM('My String'), ':', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) AS `post_name`
@locvfx
locvfx / .php
Created November 7, 2017 11:10
PHP Clean up cache folder
function CleanUp_Cache_Folder(){
## Automatic cleanup Cache folder
$cache_folder = 'cache/';
$file_type = '*.mp3';
$files = glob($cache_folder.$file_type);
$time = time();
foreach ($files as $file)
if (is_file($file))
if ($time - filemtime($file) >= 60*60*24*1) // 1 days
@locvfx
locvfx / .htaccess
Created November 11, 2017 06:08
Force https
# -----------------------Force https----------------------------------------------------------
RewriteEngine On
# This will enable the Rewrite capabilities
RewriteOptions InheritDownBefore
# This prevents the rule from being overrided by .htaccess files in subdirectories.
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
@locvfx
locvfx / .php
Last active November 14, 2017 04:24
//Create a File
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); //implicitly creates file
//Open a File
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); //open file for writing ('w','r','a')...
//Read a File
$my_file = 'file.txt';
@locvfx
locvfx / .sh
Created November 14, 2017 15:03
Linux server info script
wget http://akamaras.com/bench.sh
sh bench.sh
@locvfx
locvfx / .php
Last active November 15, 2017 15:03
Only allow certain country code, useful to protect admincp
<?php
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$url = "http://api.wipmania.com/".$ip;
$country = file_get_contents($url); //ISO code for Nigeria it is NG check your country ISO code
@locvfx
locvfx / .htaccess
Created November 16, 2017 11:59 — forked from dlueth/.htaccess
Unset all cookies via Apache .htaccess
Header unset Cookie
Header unset Set-Cookie