Skip to content

Instantly share code, notes, and snippets.

View craigerskine's full-sized avatar
🎮
UX Designer/Developer

Craig @qrayg craigerskine

🎮
UX Designer/Developer
View GitHub Profile
@craigerskine
craigerskine / event-tracking.js
Created August 16, 2010 20:01
JS Analytics Event Tracking for Downloads/Files
document.onclick = function(event) {
event = event || window.event;
var target = event.target || event.srcElement,
targetElement = target.tagName.toLowerCase();
if (targetElement == "a") {
var href = target.getAttribute("href"),
urlHost = document.domain.replace(/^www\./i,"");
var urlPattern = "^(?:https?:)?\/\/(?:(?:www)\.)?" + urlHost + "\/?";
eventCheck(href,urlPattern);
.cf:before,.cf:after { content: " "; display: table; }
.cf:after { clear: both; }
.cf { zoom: 1; }
/* tablet landscape */
@media only screen and (max-width: 979px){
}
/* tablet portrait / mobile landscape */
@media only screen and (max-width: 767px){
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>CSS: Vertical Centering</title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600" rel="stylesheet" />
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" />
<style>
@craigerskine
craigerskine / REGEX.md
Last active December 2, 2016 21:09
Simple email REGEX

^(/|http://|https://)
Start with / or http

^(http|https):\/\/((?!domain.com).)*$
This is for redirecting to EXTERNAL websites ONLY!!! Do not use this to redirect to pages or files within your own site. This field must start with http(s):// and NOT contain domain.com

^[\s\S]{0,200}$
MAX = 200 characters

^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$

$(function(){
// table
var table_data = [
{
name: '<a href="#">Some name</a>',
id: '1'
}
]
$('#table-bootstrap').bootstrapTable({
data: table_data,
@craigerskine
craigerskine / beat-time.html
Last active May 11, 2023 12:32
Beat Time / Swatch Internet Time Using Vanilla JS
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Beat Time</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
@craigerskine
craigerskine / ie-target-hacks.css
Created September 18, 2018 18:50
IE CSS Target Hacks
/* 6 */
* html .blah { property: value; }
.blah { _property: value; }
/* 7 */
*+html .blah { property: value; }
*:first-child+html .blah { property: value; }
/* 6 & 7 */
@media screen\9 { .blah { property: value; } }