This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# === Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers) === | |
# | |
# by Fotis Evangelou, developer of Engintron (engintron.com) | |
# | |
# ~ Updated February 2021 ~ | |
# | |
# | |
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores. | |
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $wpdb; | |
$query = "SELECT meta_value, meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata'"; | |
$result = $wpdb->get_results($query); | |
foreach ($result as $item) { | |
$meta = unserialize($item->meta_value); | |
unset($meta['sizes']); | |
$wpdb->update( 'wp_vira_postmeta', array('meta_value' => serialize($meta)), array('meta_id' => $item->meta_id) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A helper class for use in the Symfony Framework. Although there's no restriction to use it in | |
* any other framework or script. Just the autoloader needs to be setup before using this class. | |
* Sample code for initializing XenForo from your own script: | |
* | |
* <code> | |
* $startTime = microtime(true); | |
* $xenforoRoot = '/absolute/path/to/xenforo/root/directory'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddType image/svg+xml svg svgz | |
AddEncoding gzip svgz | |
# Webfonts | |
AddType application/vnd.ms-fontobject eot | |
AddType application/x-font-ttf ttf ttc | |
AddType font/opentype otf | |
AddType application/x-font-woff woff | |
#Gzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CI_Controller { | |
private static $instance; | |
public $data = array(); | |
/** | |
* Constructor | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.center = function(parent) { | |
if (parent) { | |
parent = $(this).parent(); | |
} else { | |
parent = window; | |
} | |
$(this).css({ | |
"margin-top": ((($(parent).height() - $(this).outerHeight()) / 2) + $(parent).scrollTop() + "px"), | |
"margin-left": ((($(parent).width() - $(this).outerWidth()) / 2) + $(parent).scrollLeft() + "px") | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.GetQueryString = function(q) { | |
return (function(a) { | |
if (a == "") return {}; | |
var b = {}; | |
for (var i = 0; i < a.length; ++i) { | |
var p = a[i].split('='); | |
if (p.length != 2) continue; | |
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); | |
} | |
return b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class: | |
CSSParser | |
Functions: | |
1 - minifier() | |
2 - beautifier() | |
3 - parser() | |
Input variables: | |
$this->input->post('content') OR $_POST['content'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function serve_file_resumable ($file, $contenttype = 'application/octet-stream') { | |
// Avoid sending unexpected errors to the client - we should be serving a file, | |
// we don't want to corrupt the data we send | |
@error_reporting(0); | |
// Make sure the files exists, otherwise we are wasting our time | |
if (!file_exists($file)) { |
NewerOlder