Skip to content

Instantly share code, notes, and snippets.

@amurrell
amurrell / magnific-popup-open
Last active December 16, 2022 12:35
MagnificPopup Open - not from a link
// If you do not want to open a popup from a user clicking a button,
// and your popup container is already on the page (footer?) hidden...
$.magnificPopup.open({
items: {
src: $('#modal-container')
},
type: 'inline',
mainClass: 'mfp-fade'
});
@amurrell
amurrell / mouse-position.js
Created August 26, 2015 21:27
Check Mouse Position on Element
// Alter the logic for bounds to detect :after or :before pseudo elements.
var checkMousePosition = function(element, e) {
var h = element.outerHeight(),
w = element.outerWidth(),
top = element.offset().top,
left = element.offset().left,
inY = e.pageY !== undefined && ( e.pageY >= top && e.pageY <= (top + h) ),
inX = e.pageX !== undefined && ( e.pageX >= left && e.pageY <= (left + w) );
if (inY && inX) {
@amurrell
amurrell / stateFaceSass
Last active August 29, 2015 14:22
StateFace SASS
/*
* SASS for http://propublica.github.io/stateface/ icon set.
* author: amurrell
*/
@font-face {
font-family: 'icons-usa';
src: url('../fonts/icons-usa.eot');
src: url('../fonts/icons-usa.eot?#iefix') format('embedded-opentype'),
url('../fonts/icons-usa.woff') format('woff'),
@amurrell
amurrell / YouTubeAPI-v3.inc.php
Created June 2, 2015 21:29
YouTubeAPI - V3 - Search by Keyword for Videos
<?php
// Make your key https://console.developers.google.com
define('YOUTUBE_API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXX');
class YouTubeAPI {
private $keyword="";
private $maxResults = 10;
private $order = "viewCount";
private $query = '';
private $data = '';
@amurrell
amurrell / Debug jQuery Events
Last active September 18, 2015 18:19
Used to debug jQuery events
// Use to debug - Find out events on a jQuery object. Might not work for 1.8+ jQuery.
// Run this in your console, for example, just alter the get_events call.
function get_events(selector) {
var element = $(selector);
if (element.length > 1)
return 'too many matched elements. make it unique';
if (element.length < 1)