Skip to content

Instantly share code, notes, and snippets.

View stormwarning's full-sized avatar
👀

Jeff stormwarning

👀
View GitHub Profile
@stormwarning
stormwarning / __constructs.html
Last active January 2, 2016 04:09
Semantic content constructs
<!--
Clean, efficient, complex content elements.
-->
@stormwarning
stormwarning / mixin--opacity.scss
Created January 17, 2014 23:36
Easy cross-browser opacity.
/**
* Cross-browser opacity.
*
* 1. Even IE8
*
* Usage:
*
@include opacity(0.8);
*
*/
<?php
function _s_theme_options_init() {
register_setting(
'_s_options', // Options group, see settings_fields() call in _s_theme_options_render_page()
'_s_theme_options', // Database option, see _s_get_theme_options()
'_s_theme_options_validate' // The sanitization callback, see _s_theme_options_validate()
);
// Register our settings field group
add_settings_section(
@stormwarning
stormwarning / fb-numbers.php
Last active August 29, 2015 13:55
Return a count of Facebook Likes, Shares, Comments from Fan Pages.
<?php
/**
* Return the number of Likes, Shares, or Comments of a given Fan Page.
*/
function facebook_numbers( $url ) {
$fql = 'SELECT url, normalized_url, share_count, like_count, comment_count, ';
$fql .= 'total_count, commentsbox_count, comments_fbid, click_count FROM ';
$fql .= 'link_stat WHERE url = "' . $url . '"';
/**
* Cross-browser image desaturation filter
*
* 1. Chrome 19+, Safari 6+, Safari 6+ iOS
* 2. Firefox 10+, Firefox on Android
* 3. IE6-9
*/
%greyscale {
-webkit-filter: grayscale(100%); /* [1] */
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* [2] */
@stormwarning
stormwarning / is-visible.js
Last active June 6, 2020 22:10
Change an element's class when it comes into view.
/**
* Change class when element is in view
*/
var elementTop = $(".container").offset().top;
$(window).on("scroll", function updateClassWhenInView() {
if ($(window).scrollTop() > elementTop - window.innerHeight * 0.9) {
$(window).off("scroll", updateClassWhenInView);
$(".element").removeClass("is-hidden").addClass("is-visible");
}
/**
* Vertically center an element's children.
*/
%vertical-center {
display: table;
> * {
display: table-cell;
vertical-align: middle;
}
/**
*
*
* @link http://demosthenes.info/blog/832/Easy-Parallax-Effects-With-Em
*/
div#parallax {
background-image: url(blurred-background-small.jpg);
background-size: cover; padding-top: 62.5%;
overflow: hidden; position: relative;
font-size: .1em; }
@stormwarning
stormwarning / browserSniff.js
Last active August 29, 2015 13:57
Quick & dirty browser sniff to detect mobile devices.
/**
* Quick & dirty browser sniff to detect mobile devices.
*/
var isMobile = false;
if( navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/iPad/i) ||
@stormwarning
stormwarning / gist:9697213
Last active August 29, 2015 13:57
Sublime Text / Atom editor tweaks
/**
* @link http://webdesign.tutsplus.com/articles/simple-visual-enhancements-for-better-coding-in-sublime-text--webdesign-18052
* @link http://daleanthony.com/sublime-for-designers/
*/
"font_face": "Inconsolata";
"font_size": 18;
"line_padding_bottom": 1,
"line_padding_top": 1,
// highlight_line