Skip to content

Instantly share code, notes, and snippets.

@alexander-young
alexander-young / Wordpress gitignore
Last active January 13, 2016 17:00 — forked from octocat/.gitignore
Some common .gitignore configurations
# WordPress #
######################
# ignore everything in the root except the "wp-content" directory.
/*
!wp-content/
# ignore specific themes
wp-content/themes/twenty*/
@alexander-young
alexander-young / gist:756a8cf547b932c143c78a59adf044b8
Created October 24, 2016 20:47
Correct WordPress permissions
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
chown -R www-data:www-data /var/www
update tablename set fieldname = replace(fieldname,'stringtofind','stringtoreplace');
@alexander-young
alexander-young / heading-classes.scss
Created April 3, 2017 15:13
Foundation 6 heading classes
// Heading styles
@each $size, $headers in $header-styles {
@include breakpoint($size) {
@each $header, $header-defs in $headers {
$font-size-temp: 1rem;
.#{$header} {
@if map-has-key($header-defs, font-size) {
$font-size-temp: rem-calc(map-get($header-defs, font-size));
font-size: $font-size-temp;
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
@alexander-young
alexander-young / htaccess
Created May 12, 2017 15:24
redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,NC,L]
(function($){
var __placeholder__ = {
init : function(){
console.log('hello world');
}
};
$(document).ready(function() {
__placeholder__.init();
});
@alexander-young
alexander-young / is-phone-is-email.js
Created July 6, 2017 16:09
Email and Phone Regex JS
function isPhone(phone) {
var regex = /\(?([0-9]{3})\)?([ .-]?)([0-9]{3})\2([0-9]{4})/;
return regex.test(phone);
}
function isEmail(email) {
var regex =
/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^wp-content/uploads/(.*\.(gif|jpg|png)) http://EXAMPLE.com/wp-content/uploads/$1 [L,R]
</IfModule>