This is a collection of my most often used lines of code, as well as a few other examples I want to have ready at a moment's notice. These snippets focus on building HTML from scratch, linking in good web fonts, and setting up responsive styles for your pages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, minimal-ui"> | |
<style type="text/css"> | |
html { -webkit-text-size-adjust: 100%; opacity: 0; } | |
body { margin: 0; } | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var myWidget = document.createElement('section'), | |
widgetStyles = document.createElement('style'), | |
tag = document.querySelectorAll('[src*="myWidget"]')[0]; | |
myWidget.innerHTML = '\ | |
<!-- Add your HTML here, with line-breaks escaped by a "\" backslash character. -->\ | |
<!-- (Don\'t forget: you can escape any character, like quotes, as well -->\ | |
Hello\ | |
'; | |
widgetStyles.innerHTML = '\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
if (typeof EQCSS === 'undefined') { | |
var eq = document.createElement('script'); | |
eq.src = 'http://elementqueries.com/EQCSS.js'; | |
document.body.appendChild(eq); | |
}; | |
var myWidget = document.createElement('section'), | |
widgetStyles = document.createElement('script'), | |
tag = document.querySelectorAll('[src*=\'myWidget\']')[0]; | |
myWidget.innerHTML = '\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>SpeedTester</title> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, minimal-ui"> | |
<style type="text/css"> | |
* { | |
box-sizing: border-box; | |
-moz-box-sizing: border-box; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php header('X-Frame-Options: GOFORIT'); ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>SpeedTester</title> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, minimal-ui"> | |
<style type="text/css"> | |
* { box-sizing: border-box; -moz-box-sizing: border-box; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-kerning: auto; font-family: 'Source Sans Pro', 'Open Sans', Roboto, 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Myriad Pro', 'Segoe UI', Myriad, Helvetica, 'Lucida Grande', 'DejaVu Sans Condensed', 'Liberation Sans', 'Nimbus Sans L', Tahoma, Geneva, Arial, sans-serif; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; cursor: default; } | |
html { font-size: 10pt; background: #ccc; -webkit-text-size-adjust: 100%; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title id="site_title"></title> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, minimal-ui"> | |
<link href="style.css" rel="stylesheet" type="text/css"> | |
<link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css"> | |
<link href="//fonts.googleapis.com/css?family=PT+Serif:400,700,400italic,700italic" rel="stylesheet" type="text/css"> | |
<link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data-personas | |
data-default="<?php $dd = get_field_escaped($field); echo $dd; ?>" | |
<?php | |
$field = 'YourTagGoesHere'; | |
if(get_field($field . '_mm')) { | |
$mm = get_field_escaped($field . '_mm'); echo 'data-persona-marketing-maggie="' . $mm . '" '; | |
} else { | |
$mm = get_field_escaped($field); echo 'data-persona-marketing-maggie="' . $mm . '" '; | |
} | |
if(get_field($field . '_tt')) { |