Skip to content

Instantly share code, notes, and snippets.

@alkrauss48
alkrauss48 / webgl_support.js
Created May 24, 2014 15:21
Full Test for WebGL Support
function webgl_support() {
try{
var canvas = document.createElement( 'canvas' );
return !! window.WebGLRenderingContext && (
canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) );
}catch( e ) { return false; }
};
@alkrauss48
alkrauss48 / form_fillers.jquery.js
Last active August 29, 2015 14:01
jQuery Form Fillers for instant (basic) form-filling action. Run through the browser console.
// Set text fields
$('input[type=text]').val('test');
// Set email fields
$('input[type=email]').val('test@test.com');
// Set combo boxes to 2nd index (in case first is blank)
$('select').prop('selectedIndex', 1);
// Set all checkboxes to checked
@alkrauss48
alkrauss48 / cookies.js
Created June 11, 2014 16:38
Setting and Retrieving Cookies with JS
function getCookie(c_name) {
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name){
return unescape(y);
}
@alkrauss48
alkrauss48 / video_embed.html
Created June 11, 2014 20:25
Responsive Iframe Video Embeds
<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>
@alkrauss48
alkrauss48 / .htaccess
Created June 13, 2014 20:13
Good .htaccess Settings
# prevent directory browsing
Options All -Indexes
# prevent folder listing
IndexIgnore *
@alkrauss48
alkrauss48 / jquery.placeholder_support.js
Created June 16, 2014 21:26
Gives your form fields placeholder support for IE8
/* Fake placeholder support in browsers that do not support the HTML input placeholder attribute. Ideally this would be paired with a javascript function that prevents form submit if the a given input's value is equivalent to the placeholder attribute. */
/* Requires both jQuery and Modernizr */
function initPlaceholderSupport() {
if( ! Modernizr.input.placeholder ) {
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
@alkrauss48
alkrauss48 / wordpress_plugins.md
Last active August 29, 2015 14:03
Base Set of Wordpress Plugins

The following is my base list of Wordpress plugins that I think a developer should always make use of for a new WP site:

@alkrauss48
alkrauss48 / jquery.text_highlight.js
Last active August 29, 2015 14:03
Highlighting Text Around Each Character
// This entire file is optional. May be useful if using with a CMS where your users are
// entering in paragraphs, and you always want to highlight their paragraph text by default
$('p').wrapInner('<span class="highlight"></span>');
@alkrauss48
alkrauss48 / accessibility_skipmenu.html
Last active August 29, 2015 14:03
Accessibility Jump Menu for Keyboard Users- Use this for every site if you want max accessibility
<body>
<div id="skipmenu">
<a href="#menuArea" class="skippy">Skip directly to menu</a>
<a href="#contentArea" class="skippy">Skip directly to site content</a>
<a href="#footerArea" class="skippy">Skip directly to site footer</a>
</div>
.
.
.
<!-- Use a link like the following to skip to this point -->

How domain names turn into valid IPs

It's more than you probably think

  1. A user types the URL http://www.example.com into a browser.

  2. The browser sends a request for the IP address of www.example.com to its local resolver (stub-resolver).

  3. The stub-resolver queries the locally configured DNS Resolver for the IP address of www.example.com.