Skip to content

Instantly share code, notes, and snippets.

View chrisblackwell's full-sized avatar

Chris Blackwell chrisblackwell

View GitHub Profile
@chrisblackwell
chrisblackwell / Visually Hidden CSS
Created January 25, 2014 02:28
Visually Hidden CSS
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
@chrisblackwell
chrisblackwell / javascript_loading.js
Created January 25, 2014 14:24
JavaScript defer loading
function downloadJSAtOnload() {
var element = document.createElement("script");
element.src = "defer.js";
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
@chrisblackwell
chrisblackwell / css-breakpoints.css
Last active August 29, 2015 13:57
Responsive Breakpoints
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
@chrisblackwell
chrisblackwell / gist:9729571
Created March 23, 2014 20:46
jQuery Dropdown Menu
// Menu Hover
$(".menu li").on('mouseenter', function () {
$(this).children(".sub-menu").slideDown(function() {
$(this).stop(true,true);
})
});
$(".menu li").on('mouseleave', function () {
$(this).children(".sub-menu").slideUp(function() {
$(this).stop(true,true);
@chrisblackwell
chrisblackwell / apache-vhost.conf
Created May 6, 2014 15:25
Apache vhost configuration
<VirtualHost *:80>
ServerName domainname.dev
DocumentRoot "/Users/{username}/Sites/domain.tld/public"
ServerAdmin [email protected]
ErrorLog "/Users/{username}/Sites/domain.tld/logs/error.log"
SetEnv APP_ENV development
<Directory "/Users/{username}/Sites/domain.tld/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
@chrisblackwell
chrisblackwell / .htaccess
Created May 6, 2014 15:28
htaccess configuration for optimal caching
# Block Access to Hidden Files and Directories
<IfModule mod_rewrite.c>
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]
</IfModule>
# Compress Served Files by MIME Type
<IfModule mod_deflate.c>
/**
* Saves the meta box field data
*
* @param int $post_id Post ID
*/
function save_meta_boxes( $post_id ) {
// Check if our nonce is set.
if ( ! isset( $_POST['{name}_nonce'] ) ) {
return $post_id;
@chrisblackwell
chrisblackwell / post-receive-for-laravel.sh
Last active May 5, 2022 22:40
Git Post receive hook for Laravel deployment
#!/bin/sh
WEBROOT=/srv/www/apps.legendboats.com
GIT_WORK_TREE=$WEBROOT git checkout -f
cd $WEBROOT
# Check if a composer.json file is present
if [ -f composer.json ]; then
# Install or update packages specified in the lock file
composer install
@chrisblackwell
chrisblackwell / wordpress-nginx.conf
Created April 22, 2015 12:02
WordPress nginx confuration
server {
listen 80 default_server;
server_name domain.tld;
access_log /srv/www/domain.tld/logs/access.log;
error_log /srv/www/domain.tld/logs/error.log;
root /srv/www/domain.tld/public;
index index.php index.html index.htm;
client_max_body_size 20M;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.092175714671611786</real>
<key>Green Component</key>
<real>0.078538775444030762</real>