Skip to content

Instantly share code, notes, and snippets.

View dviramontes's full-sized avatar
〰️
failing forward

David Viramontes dviramontes

〰️
failing forward
View GitHub Profile
@dviramontes
dviramontes / gist:6255656
Created August 17, 2013 07:00
Modernizr Detect support for media queries on IE 7, 8, old IE (die ie!, die)
Modernizr.mq("only all")
@dviramontes
dviramontes / gruntnpmload.js
Created August 18, 2013 00:37
Grunt Load Npm Task with one funtion
module.exports = function(grunt){
// instead of grunt.loadNpmTask one by one , use
require('matchdep').filterDev("grunt-*").forEach(grunt.loadNpmTask);
}
@dviramontes
dviramontes / click.js
Created August 22, 2013 17:28
makes anything with class .clickable, clickable
$(".clickable").click(function(event) {
event.preventDefault();
if ($(this).data().href) {
return window.open($(this).data().href, "_self");
}
});
$(document).ready(function () {
var iec = new IECompatibility();
alert('IsIE: ' + iec.IsIE + '\nVersion: ' + iec.Version + '\nCompatability On: ' + iec.IsOn);
});
function IECompatibility() {
var agentStr = navigator.userAgent;
this.IsIE = false;
this.IsOn = undefined; //defined only if IE
this.Version = undefined;
// for smallest jquery include ever...
function $(expr, cond){ return (con || document).querySelector(expr); }
@dviramontes
dviramontes / code.js
Last active December 26, 2015 04:09
email validation with jquery plugin
// validate email address
$("#ss-form").validate({
// validate rule
rules : {
email : {
required: true,
email: true
}
},
@dviramontes
dviramontes / gist:7683882
Created November 27, 2013 21:53
homepage.less
// @import "./utils/functions.less" ;
// @import "./utils/actionSection.less" ;
// @import "./utils/captions.less" ;
// @import "./utils/colors.less" ;
// TESTIMONIAL IMG
// ---------------
.testimonial img{
width: 100%;
body{
padding-top: 100px;
font-size:50px;
}
// register these two event listeners
window.player.on("play", function(){ console.log("played")});
window.player.on("pause", function(){ console.log("paused")});
@dviramontes
dviramontes / cors.js
Created June 19, 2013 22:13
cors.js Nicholas Zakas' helper method to help sort out the browser differences in CORS or Cross Origin Resource Sharing support.
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// Check if the XMLHttpRequest object has a "withCredentials" property.
// "withCredentials" only exists on XMLHTTPRequest2 objects.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {