Skip to content

Instantly share code, notes, and snippets.

View MaraScott's full-sized avatar
🇪🇺
Maras IT

MaraScott MaraScott

🇪🇺
Maras IT
View GitHub Profile
@MaraScott
MaraScott / wp_table_prefix.sql
Created February 20, 2013 06:48
Name : wp_table_prefix - Language : Sql - type : Update - platform : wordpress - tag : MySQL
/* update database after modification of $table_prefix = 'wp_'; in wp-config.php */
/* see : http://stackoverflow.com/questions/13815461/you-do-not-have-sufficient-permissions-to-access-this-page-without-any-change */
UPDATE `{%TABLE_PREFIX%}usermeta` SET `meta_key` = replace(`meta_key`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}');
UPDATE `{%TABLE_PREFIX%}options` SET `option_name` = replace(`option_name`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}');
/**/
@MaraScott
MaraScott / window.resize.js
Last active December 14, 2015 01:59
Name : window.resize - Language : javascript - type : feature - platform : jQuery - tag :
// do something if window size change
jQuery(window).resize(function() {
"use strict";
if(jQuery(window).height() < 500) {
console.log('do something');
}else{
console.log('do something else');
}
});
@MaraScott
MaraScott / checkEmptyInput.js
Created February 22, 2013 03:16
Name : checkEmptyInput(idemail ,defaultvalue) - Language : javascript - type : function - platform : jQuery - tag :
function checkEmptyInput(idInput ,defaultvalue) {
"use strict";
jQuery("#"+idInput).focus(function(){
if (defaultvalue === jQuery("#"+idInput).val()) {
jQuery(this).val('');
} // END IF
});
// FOCUSOUT INPUT
jQuery("#"+idInput).blur(function(){
if (jQuery("#"+idInput).val() === '') {
@MaraScott
MaraScott / delayer.js
Created February 22, 2013 03:27
Name : delayer - Language : javascript - type : feature - platform : jQuery - tag :
// delay redirect
function delayer(){
"use strict";
window.location = "https://gist.github.com/davask/";
}
jQuery(document).ready(function(){
"use strict";
setTimeout('delayer();', 10000);
});
@MaraScott
MaraScott / checkForSubmit.js
Created February 22, 2013 03:31
Name : checkForSubmit(o, fields) - Language : javascript - type : function - platform : jQuery - tag :
function checkForSubmit(o, fields) {
"use strict";
var submit = true;
var form = o.parents('form:eq(0)');
form.submit(function() {
if (typeof fields !== 'undefined') {
if (typeof fields.input !== 'undefined') {
if (typeof fields.input.text !== 'undefined') {
var text = fields.input.text;
for (var i = 0, len = text.length; i < len; ++i) {
@MaraScott
MaraScott / noConflict.js
Created February 22, 2013 03:33
Name : noConflict() - Language : javascript - type : function - platform : jQuery - tag :
var j = jQuery.noConflict();
// Do something with jQuery
j("div p").hide();
// Do something with another library's $()
$("content").style.display = 'none';
@MaraScott
MaraScott / topBar.js
Created February 22, 2013 03:47
Name : topBar - Language : javascript - type : feature - platform : jQuery - tag : messsage
jQuery('body').prepend('<div style="background:#BADA55;color:#ff0000;height:25px;text-align: center;">top moumoute</div>');
@MaraScott
MaraScott / HZip.class.php
Last active December 14, 2015 05:29
Name : HZip - Language : PHP - type : class - platform : php - tag :
<?php
/* see: http://www.php.net/manual/en/class.ziparchive.php#110719 */
class HZip
{
/**
* Add files and sub-directories in a folder to zip file.
* @param string $folder
* @param ZipArchive $zipFile
* @param int $exclusiveLength Number of text to be exclusived from the file path.
*/
@MaraScott
MaraScott / zipit.php
Created February 26, 2013 03:58
Name : zipit('pathToSourceFolder', 'pathToZipFile') - Language : PHP - type : cron - platform : linux - tag : backup
<?php
/* BACKUP a file
* HZip.class.php
* see: https://gist.github.com/davask/5035745
*/
include(__DIR__.'/HZip.class.php');
HZip::zipDir('pathToSourceFolder', 'pathToZipFile');
?>
@MaraScott
MaraScott / httpd-vhosts.conf
Last active December 14, 2015 07:58
Name : httpd-vhosts - Language : ApacheConf - type : conf - platform : xampp - tag :
# Virtual Hosts configuration on xampp
# see : http://www.tildemark.com/setting-up-virtual-hosts-with-xampp-running-on-windows-xp/
# add your domain name in F:\Windows\System32\drivers\etc\hosts like
# 127.0.0.1 sub.domain.tld
# see : http://httpd.apache.org/docs/2.2/vhosts/
# NameVirtualHost *:80 useless