Skip to content

Instantly share code, notes, and snippets.

View grayghostvisuals's full-sized avatar
🐢
I may be slow to respond.

GRAY GHOST grayghostvisuals

🐢
I may be slow to respond.
View GitHub Profile
@grayghostvisuals
grayghostvisuals / disable-scroll.js
Created November 27, 2013 01:40
Disable hover on scroll to improve performance and avoid costly paints.
// Disable Hover on Scroll Class
// Add these helpers to your utlity.css
// http://www.thecssninja.com/javascript/pointer-events-60fps
.disable-hover,
.disable-hover * {
pointer-events: none !important;
}
// ----------------------------------------------------------------------
@grayghostvisuals
grayghostvisuals / .htaccess
Created January 6, 2013 05:55
Prevent Hotlinking of Web Fonts
#http://www.fontshop.com/blog/newsletters/pdf/webfontfontuserguide.pdf
RewriteEngine On
RewriteCond %{HTTP:Origin} !^$|http(s)?://(www\.)?example\.com$ [NC]
RewriteRule \.(woff|eot)$ - [NC,L]
RewriteCond %{HTTP_REFERER} !.
RewriteRule \.(woff|eot)$ - [F,NC,L]
Options -Indexes
@grayghostvisuals
grayghostvisuals / validator.addMethod.passMatch.js
Created October 15, 2013 00:12
A simplistic way to make sure two password fields match using jQueryValidation (http://jqueryvalidation.org/validate) Using minlength, and a custom message.
jQuery.validator.addMethod( 'passwordMatch', function(value, element) {
// The two password inputs
var password = $("#register-password").val();
var confirmPassword = $("#register-pass-confirm").val();
// Check for equality with the password inputs
if (password != confirmPassword ) {
return false;
} else {
@grayghostvisuals
grayghostvisuals / bind-call-args.js
Created June 5, 2014 16:00
Passing Arguments to Event Functions
/**
* @about
* Binding arguments to a function passed through
* an event listener as a named function.
*
* @reference
* http://jsfiddle.net/toddmotto/D3tgu
*/
@grayghostvisuals
grayghostvisuals / Compass Vertical Rhythm Toolbox
Last active October 12, 2017 22:11
Compass Vertical Rhythm and Typography Playground
@import "compass/typography";
// global vars
$base-font-size: 18px;
$base-line-height: 24px;
// establishes base grid
@include establish-baseline;
//@rhythm-borders(px, x, x)
@grayghostvisuals
grayghostvisuals / scrollmation
Last active July 12, 2016 14:28
Anchor Scroll w/Vanilla JS (also displays hash value)
var scrollmation_parent = document.getElementById(parent_el).nextElementSibling;
var easing = {
linear: function (t) { return t; },
easeInQuad: function (t) { return t*t; },
easeOutQuad: function (t) { return t*(2-t); },
easeInOutQuad: function (t) { return t < 0.5 ? 2*t*t : -1+(4-2*t)*t; },
easeInCubic: function (t) { return t*t*t; },
easeOutCubic: function (t) { return (--t)*t*t+1; },
easeInOutCubic: function (t) { return t < 0.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1; },
@grayghostvisuals
grayghostvisuals / grunt-contrib-compass.js
Created January 23, 2014 19:06
Example setup for the grunt-contrib-compass plugin and settings.
// https://github.com/gruntjs/grunt-contrib-compass
compass: {
dist: {
options: {
httpPath: '/',
httpImagesPath: 'httpPath + "/" + imagesDir',
cssDir: 'app/webroot/css',
sassDir: 'app/webroot/scss',
javascriptsDir: 'app/webroot/js',
imagesDir: 'app/webroot/img',
@grayghostvisuals
grayghostvisuals / fancy-box.js
Created December 3, 2013 14:31
Example of Fancybox API Setup
// ----------------------------------------------------------------------
// =Fancybox
// ----------------------------------------------------------------------
$('.fancybox').fancybox({
// Options
padding : 6,
openEffect : 'elastic', // elastic, fade
closeEffect : 'elastic', // elastic, fade
openSpeed : 325, // default 250

Debug iOS 6+7 Mobile Safari using the Chrome DevTools

$ brew install ios-webkit-debug-proxy
SIM_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
"$SIM_DIR/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator" \
-SimulateApplication \
@grayghostvisuals
grayghostvisuals / grunt-use-min.js
Created September 12, 2013 23:31
This is an example of a Grunt build task from https://github.com/yeoman/grunt-usemin/issues/176#issuecomment-24361368 that copies over a file with replaced references and stashes them into a build directory for production.
module.exports = function (grunt) {
grunt.initConfig({
clean: ['build'],
copy: {
html: { // in preparation for usemin
files: [
{src: 'index.html', dest: 'build/'}
]
}
},