Skip to content

Instantly share code, notes, and snippets.

@nielsenrc
nielsenrc / css-vertically-center-line-of-text.css
Created September 9, 2015 19:48
CSS | Vertically Center Line of Text in a Container
#box {
height: 90px;
line-height: 90px;
}
@nielsenrc
nielsenrc / 410-redirect.txt
Created September 9, 2015 19:46
htaccess | Apache 410 Redirect
errordocument 410 default
redirectmatch 410 /url/
@nielsenrc
nielsenrc / wp-add-lines-to-wordpress-robots.php
Created September 9, 2015 19:45
PHP | Add lines to dynamic Wordpress robots.txt
function virtual_robots_disallow( $output, $public ) {
$output .= "\n" . 'Disallow: /backup' . "\n";
return $output;
}
add_filter( 'robots_txt', 'virtual_robots_disallow', 10, 2 );
@nielsenrc
nielsenrc / php-get-contents-of-robots-txt-file.php
Created September 9, 2015 19:43
PHP | Get Contents of Robots.txt File for a Text File of Domains
<?php
//Purpose to Check Contents of the Robots.txt File for a Series of Domains in a Local Text File
//define text file location
$old_url_text_file = "list.txt";
//get contents of text file
$old_url_list = file_get_contents($old_url_text_file);
//process text file
$old_urls = explode("\n", $old_url_list);
$old_urls = array_filter(array_map('trim', $old_urls));
//loop through text files
@nielsenrc
nielsenrc / bash-get-apache-version-number.txt
Created September 9, 2015 19:40
Bash | Get Apache Version Number
httpd -v
@nielsenrc
nielsenrc / vim-delete-all-files-containing-string.txt
Created September 9, 2015 19:39
VIM | Delete All Lines Containing String
:g/profile/d
@nielsenrc
nielsenrc / widest-element-on-page.js
Created September 9, 2015 19:37
JS | Find Widest Element on Page with Javascript
var widest = null;
// remember the width of the "widest" element - probably faster than calling .width()
var widestWidth = 0;
$("div").each(function() {
if (widest == null)
{
widest = $(this);
widestWidth = $(this).width();
}
else
@nielsenrc
nielsenrc / wp-add-ftp-info.php
Created September 9, 2015 19:32
Add FTP Info to Wordpress wp-config.php
define('FTP_USER', 'username'); // Your FTP username
define('FTP_PASS', 'password'); // Your FTP password
define('FTP_HOST', 'ftp.example.org:21'); // Your FTP URL:Your FTP port
@nielsenrc
nielsenrc / robots-deny-all.html
Created September 9, 2015 19:29
Robots Deny All Meta Tag
<meta name="robots" content="noindex, nofollow">
@nielsenrc
nielsenrc / force-ssl.txt
Created September 9, 2015 19:29
Enforce SSL in Apache htaccess File
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com/$1 [R,L]