Skip to content

Instantly share code, notes, and snippets.

@wizard04wsu
wizard04wsu / Loader.css
Created March 13, 2014 17:46
CSS3 Loading Icon/Spinner
.load {
height:100px;
width:100px;
margin:0 auto;
position:relative;
-webkit-animation: rotation 1s infinite linear;
-moz-animation: rotation .6s infinite linear;
-o-animation: rotation .6s infinite linear;
animation: rotation .6s infinite linear;
border:6px solid rgba(236,30,39,.25);
#!/bin/bash
# 1
wget -qO root.zone http://www.internic.net/domain/root.zone
# 2
cat root.zone | grep "IN\sNS" | awk '{print $1}' | uniq | sort | sed -r 's/\.//g' | sed '/^$/d' > zone.list 2> /dev/null
# 3
@wizard04wsu
wizard04wsu / require.js
Last active August 29, 2015 13:56
Execute a callback once required scripts have been loaded.
//require(scriptList, onSuccess[, onFailure])
//usage:
//require(["a.js", "b.js"], function (){ /*scripts have loaded; do stuff*/ }, function (){ /*one or more scripts didn't load; handle error*/ });
//
//scriptList can just be a string if there's only one script
var require = (function (){
var head = document.getElementsByTagName("head")[0];
@wizard04wsu
wizard04wsu / _IE 6 PNG fix
Created February 19, 2014 15:03
IE 6 PNG fix
This fixes the transparency of PNG images in IE 6, for both image elements and background image styles.
This also requires a 1-pixel transparent GIF "blank.gif" in the same directory as "iepngfix.htc".
Put the HTML below into <head>, make sure the path to "iepngfix.htc" is correct, and apply it to specific elements instead of everything.
<!--[if lte IE 6]>
<style type="text/css" media="all">
* { behavior:url(/css/iepngfix.htc); } /*IE 6 PNG fix*/
</style>
@wizard04wsu
wizard04wsu / _master stylesheet
Last active August 29, 2015 13:56
Master stylesheet
This is a complete stylesheet for everything in HTML 4.01, including some useful classes -- not really for use on a website, but a good reference.
<!--master styles-->
<link rel="stylesheet" type="text/css" media="all" href="css/master_main.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/master_classes.css" />
<!--[if IE]><link rel="stylesheet" type="text/css" media="all" href="css/master_IE.css" /><![endif]-->
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="all" href="css/master_IE6.css" /><![endif]-->
@wizard04wsu
wizard04wsu / log.htm
Last active August 29, 2015 13:56
Template for an on-page JavaScript log
<html>
<head>
<title>Log</title>
<style type="text/css" media="all">
#log {
padding:0.5em;
overflow:auto;
font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace;
@wizard04wsu
wizard04wsu / notifications.js
Created February 12, 2014 19:49
Cross-browser desktop notifications (for supporting browsers)
//http://www.w3.org/TR/notifications/
//https://developer.mozilla.org/en-US/docs/Web/API/notification
//Notifier.isSupported
//
//Notifier.permission //"granted", "denied", or "default"
//
//Notifier.requestPermission([callback]) //first argument of callback is the current permission
//
//Notifier.notify(title[, options])
@wizard04wsu
wizard04wsu / dimensions.js
Created February 7, 2014 21:02
JavaScript functions to get dimensions of objects and to set scroll positions
//getDimensions([elem])
//setScrollPosition(elem, top, left)
(function (){
"use strict";
//**********************//
//***** Dimensions *****//
//**********************//
@wizard04wsu
wizard04wsu / nthRoot.js
Last active August 29, 2015 13:56
Get the nth root of a number, where n is the degree of the root. For example, get the cube root of 27 using Math.root(27, 3).
if(!Math.root){
Math.root = function root(num, degree){
return Math.pow(num, (1/degree));
};
}
@wizard04wsu
wizard04wsu / cookies.js
Last active May 12, 2021 09:32
Methods for working with cookies
//If cookies are not supported by the browser, `Cookies` will be undefined
//Cookies.set(name, value[, options])
// creates, modifies, or removes a cookie
// `options` may be an object including `expires`, `path`, `domain`, and/or `secure`
// `options.expires` can be either a Date object or the number of seconds until it should expire
// (0 or undefined indicates end of session, <0 removes the cookie, Infinity sets it to 50 years)
//
//Cookies.get(name)
// returns the value of the first cookie with that name