Skip to content

Instantly share code, notes, and snippets.

View joshuaadrian's full-sized avatar

Joshua Adrian joshuaadrian

View GitHub Profile
#Redirect Non-WWW to WWW with SSL
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [NC,R=301,L]
#Redirect Non-WWW to WWW
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
#Redirect alternative domains
RewriteCond %{HTTP_HOST} ^domain.com.php53-13.dfw1-1.websitetestlink.com$ [NC,OR]
@joshuaadrian
joshuaadrian / utilities.js
Last active July 7, 2021 19:23
My vanilla js utilities library
/*
* These are supported IE9+
* /
/*
* Initialization variables and functions
*/
var jsPresent = 'querySelector' in document && 'addEventListener' in window && "classList" in document.createElement("_") ? true : false;
Clone Scotch Box git@github.com:scotch-io/scotch-box.git
Clone project into public
ssh into server install
sudo apt-get install libpq-dev
go into psql
sudo -u postgres psql
create vagrant user
CREATE USER vagrant WITH SUPERUSER;
bind rails server to scotchbox ip
rails server -b 192.168.33.10
// LOGGING FUNCTION
if ( !function_exists('_log') ) {
function _log( $message ) {
if ( WP_DEBUG === true ){
if ( is_array( $message ) || is_object( $message ) ) {
error_log( print_r( $message, true ) );
} else {
error_log( $message );
}
<?php
/* ABSOLUTE PATH */
if ( !defined( 'ABSPATH' ) ) :
define('ABSPATH', dirname(__FILE__) . '/');
endif;
/* DB CREDS */
if ( file_exists( ABSPATH . 'wp-config.local.php' ) ) :
require_once( 'wp-config.local.php' );
AddDefaultCharset UTF-8
Options +FollowSymLinks
RewriteEngine On
# Add Font mime types
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
*~
.svn
.cvs
.git
.listing
*.bak
*.swp
*.log
*.sass-cache
plugins/wp-file-cache/cache
{
"private": true,
"devDependencies": {
"del": "^0.1.3",
"gulp": "^3.8.10",
"gulp-autoprefixer": "^2.0.0",
"gulp-concat": "^2.4.1",
"gulp-imagemin": "^2.0.0",
"gulp-livereload": "^2.1.1",
"gulp-load-plugins": "^0.7.1",
@joshuaadrian
joshuaadrian / Gulp File
Created November 19, 2014 19:16
My Gulp file
var
gulp = require('gulp'),
gutil = require('gulp-util'), // Errors with load plugins... Need to fix
pngquant = require('imagemin-pngquant'), // Errors with load plugins... Need to fix
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins({camelize: true})
;
gulp.task('default', ['watch', 'css', 'js', 'images']);
@joshuaadrian
joshuaadrian / Scroller JS Class
Last active August 29, 2015 14:09
JS function to track user scrolling
(function() {
var Scroller = {
init: function() {
this.scrollWindow = $(window);
this.scrollDocument = $(document);
this.scrollElements = $('body > div');
this.windowHeight = this.scrollWindow.height();