Skip to content

Instantly share code, notes, and snippets.

View mrmartineau's full-sized avatar
👋
Aho Young Warrior

Zander Martineau mrmartineau

👋
Aho Young Warrior
View GitHub Profile
//http://miketaylr.com/code/html5-forms-ui-support.html
testSupport: function(){
var frowny = ":("; //no support frowny!
var inputs = $('input');
inputs.each(function(){
var $this = $(this);
$this.val(frowny)
.closest('td').next().text(
/*
* mediaquery function - test whether a CSS media type or query applies
* author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* Developed as a feature of the EnhanceJS Framework (enhancejs.googlecode.com)
* thx to:
- phpied.com/dynamic-script-and-style-elements-in-ie for inner css text trick
- @paul_irish for fakeBody trick
*/
/*
* media.matchMedium()- test whether a CSS media type or media query applies
* primary author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* adapted by Paul Irish to use the matchMedium API
* http://www.w3.org/TR/cssom-view/#media
* Doesn't implement media.type as there's no way for crossbrowser property
* getters. instead of media.type == 'tv' just use media.matchMedium('tv')
@ralphholzmann
ralphholzmann / iframe-facebook.js
Created November 13, 2010 19:44
Modernizr tests to detect if you're in an iframe or facebook iframe
Modernizr
.addTest('iframe', function() {
return window.top.location != window.location;
})
.addTest('facebook', function() {
return !! ~ location.href.indexOf( 'fb_sig_in_iframe=1' );
});
@redoPop
redoPop / jquery.loadshiv.js
Created December 10, 2010 05:35
Replacement jQuery.load() for use with innerShiv
// jQuery plugin based on .load() for use with innerShiv
// http://jdbartlett.github.com/innershiv for more info
// $('selector').loadShiv('example.html selector');
jQuery.fn.loadShiv = function (url, params, callback) {
var off, selector, self, type;
if (!this.length || typeof url !== 'string') {
return this;
}
@padolsey
padolsey / cat.js
Created December 4, 2011 19:00
Improving Jeremy Keith's CAT news example from http://24ways.org/2011/conditional-loading-for-responsive-designs
var cat = {};
/**
* cat.NewsBox
* Retrieves news from Google
*/
cat.NewsBox = (function(){
function NewsBox(searchTerm, injectFn) {
this.searchTerm = searchTerm;
sudo npm install -g coffee-script
@Kalyse
Kalyse / arrowgasm.less
Created May 9, 2012 13:55
LessCSS Mixing for Providing Arrows
.arrowgasm(@position: top, @size : "4px", @background-color : #88b7d5, @border-width: "2px", @border-color : #c2e1f5, @arrowClass : "arrow_box"){
(~".@{arrowClass}") {
position: relative;
background: @background-color;
border: @size solid @border-color;
}
(~".@{arrowClass}:after"), (~".@{arrowClass}:before") {
bottom: 100%;
border: solid transparent;
@lean8086
lean8086 / tap-highlight.css
Created December 3, 2012 22:54
Hide the translucent highlight when elements with hyperlinks are tapped
a {
/* iOS: Actions without the gray overlay */
-webkit-tap-highlight-color: rgba(0,0,0,0);
/* iOS: Remove the actions panel */
-webkit-touch-callout: none;
}

Problem

Some tasks utilize the watch to trigger an event, ie: live reload. With Grunt v0.3, those tasks on first run would create a variable, ie servers. Then subsequently ran by the watch task would check if the variable exists and then use it. Since the new watch spawns tasks, this is no longer possible.

Solutions Proposed

A) Have watch trigger a grunt.event