Skip to content

Instantly share code, notes, and snippets.

View dejanmarkovic's full-sized avatar
💭
WordPress development 24/7

Dejan Markovic dejanmarkovic

💭
WordPress development 24/7
View GitHub Profile
@dejanmarkovic
dejanmarkovic / WordPress debug log location
Created January 9, 2014 20:10
WordPress debug log location
wp-content/debug.log
@dejanmarkovic
dejanmarkovic / MD5 Hash Generator
Created January 8, 2014 21:55
MD5 Hash Generator
http://www.md5hashgenerator.com/index.php
@dejanmarkovic
dejanmarkovic / NOBLOGREDIRECT explained and fix
Created January 8, 2014 20:15
NOBLOGREDIRECT explained and fix
A little explanation for those who have no idea what NOBLOGREDIRECT is.
The define(‘NOBLOGREDIRECT’, ‘%siteurl%’); inside of the wp-config.php makes it so that when someone enters a subdomain that does not exist on your site to redirect to whatever url you wish it to. You can use this to have it either go to a specific FAQ page or directly back to the main root installation, anywhere you want to direct it. the %siteurl% can be replaced for example define(‘NOBLOGREDIRECT’, ‘http://frumph.net/FAQ/site-create’);
When someone in their browser tries to go to (for example) http://badsubdomain.frumph.net/ a subomain which doesn’t exist, it will go to what is defined in NOBLOGREDIRECT.
Without using NOBLOGREDIRECT the (for example) http://badsubdomain.frumph.net/ – which is a subdomain that doesn’t exist would direct to the signup page asking which reports whether or not the user can create the bad subdomain in question. This is fine, there’s nothing wrong with it redirecting to the signup page if someone put
@dejanmarkovic
dejanmarkovic / Linux commands
Created January 7, 2014 17:29
Linux commands
nmap
----
(scans ports)
iptables
--------
??
system
------
@dejanmarkovic
dejanmarkovic / new_gist_file.php
Created January 5, 2014 20:11
10 wp-config Tweaks That You Should Know About
In this tutorial, we’ll show you 10 wp-config tweaks that you may not know yet.
Let’s go through them one by one.
Move Your Configurations File:
Moving wp-config outside the web root directory is one of the best security practices. Doing so keeps your important information, like your authentication keys and database login details, away from malicious scripts and hackers who can try to access your site’s database using default location of wp-config file.
Generally, WordPress looks for wp-config file in its web root. If it’s not available there, then it will automatically look one level above. So, just move this file one folder above the web-root folder. In this way, nobody will be able to access it without SSH or FTP access.
If you’re moving your wp-config file, it is recommended to create another wp-config file in the root folder that will point to the “real” wp-config.
<?php
/**
* Plugin Name: Disable all plugins
* Plugin URI: https://gist.github.com/JCPry/8026015
* Description: Short-circuits the function in WordPress that determines which plugins are activated, and tells WordPress that no plugins are activated
* Version: 1.0
* Author: Jeremy Pry
* Author URI: http://jeremypry.com/
*/
@dejanmarkovic
dejanmarkovic / new_gist_file.js
Created December 16, 2013 17:50
Get window width and height as variables
var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
Source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript
@dejanmarkovic
dejanmarkovic / new_gist_file.js
Created December 16, 2013 17:49
Javascript test(s) for mobile browsers/devices
// test 1
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
@dejanmarkovic
dejanmarkovic / new_gist_file.js
Created December 16, 2013 17:48
if variable is undefined
if (typeof (availableTags) == "undefined")
//don't forget the () around the var/array name
@dejanmarkovic
dejanmarkovic / new_gist_file.js
Created December 16, 2013 17:46
Find the vaule of of a row in 2 dimensional array by Index value
function ValueOfRowByIndex(id, arr) {
//console.log("ValueOfRowByIndex");
//console.log("id :" + id);
//console.log("arr :" + arr);
//console.log("arr[id][0] :" + arr[id][0]);
//console.log("arr[id][1] :" + arr[id][1]);
return arr[id][0];
}