Skip to content

Instantly share code, notes, and snippets.

View tomhodgins's full-sized avatar
😍
Writing CSS

Tommy Hodgins tomhodgins

😍
Writing CSS
View GitHub Profile
@tomhodgins
tomhodgins / data-personas.php
Last active August 29, 2015 14:17
Adding data-personas support to WordPres
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')) {
@tomhodgins
tomhodgins / snippets.md
Last active August 8, 2022 14:27
Snippets.md is my most often used HTML, CSS and JavaScript snippets for front-end web development
@tomhodgins
tomhodgins / myWidget.js
Last active August 29, 2015 14:15
Self Executing JavaScript Widget (HTML + EQCSS): just place a link to this script in your HTML where you want the content to appear, like <script src="myWidget.js"></script>
(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 = '\
@tomhodgins
tomhodgins / myWidget.js
Last active August 29, 2015 14:15
Self Executing JavaScript Widget (HTML + CSS): just place a link to this script in your HTML where you want the content to appear, like <script src="myWidget.js"></script>
(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 = '\
@addyosmani
addyosmani / README.md
Last active May 10, 2025 11:24 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@cuth
cuth / debug-scroll.md
Last active October 18, 2024 08:22
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right &gt; w || b.left &lt; 0) {
@m1
m1 / ferengi-apache.txt
Last active September 24, 2024 14:45
How to throttle the FCC to dial up modem speeds on your website using Apache.
# How to throttle the FCC to dial up modem speeds on your website using Apache.
# Ported from https://gist.github.com/kyledrake/e6046644115f185f7af0
## The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
##
## Current known FCC address ranges:
## https://news.ycombinator.com/item?id=7716915
##
## Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
@tomhodgins
tomhodgins / placeholder-tooltips.js
Last active August 29, 2015 14:01
Display an input's placeholder="" text as a Bootstrap Tooltip on :focus of non-empty form inputs. See this in action at: http://jsfiddle.net/tomhodgins/LEz3Z/2
// Display placeholder="" text as tooltip for :focused, non-empty inputs
$('form input').blur(function() {
var inputVal = $(this).val(),
titleText = $(this).attr('placeholder');
if ( inputVal != '' ) {
$(this).tooltip({
title: titleText,
trigger: 'focus',
container: 'form'
});
@sseffa
sseffa / xss-owasp-cheatsheet
Created April 18, 2014 08:16
xss-owasp-cheatsheet
#
# https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
# based on the RSnake original http://ha.ckers.org/xss.html
# Retrieved on 2013-11-20
# Much of this wildly obsolete
#
# XSS Locator 2
'';!--"<XSS>=&{()}
@joyrexus
joyrexus / README.md
Last active May 16, 2025 01:54 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})