Skip to content

Instantly share code, notes, and snippets.

View mojaray2k's full-sized avatar

Amen Moja Ra mojaray2k

  • Miami, Fl
View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
@mojaray2k
mojaray2k / Responsive-CSS-Modal.markdown
Created February 28, 2014 19:46
Responsive CSS Modal A Pen by Amen Moja Ra.
@mojaray2k
mojaray2k / Non-JS-Modal.markdown
Created February 28, 2014 18:47
Non JS Modal A Pen by Amen Moja Ra.
@mojaray2k
mojaray2k / jsbin.hasip.css
Created April 24, 2014 17:08
Get Mouse Coordinates in JavaScript. You can get the user's mouse coordinates in three distinct ways in JavaScript: Relative to the browser window, relative to the page, and relative to the entire screen. Let's see how we can do this in each case.
body {
font-family: Arial, sans-serif;
text-align: center;
padding-top: 20px;
color: #555;
height: 3000px;
}
h1 {
font-size: 1.5em;
@mojaray2k
mojaray2k / every.js
Created May 1, 2014 18:10
In ES5 there were added a number of new Array methods, including Array.prototype.every(). With this method you can check all the items inside an array for a condition that's defined in a callback function. The method will return true if all items meet the conditions, but will return false as soon as it finds one item in the array that doesn't me…
var set1 = [2, 4, 6, 8, 10];
var set2 = [2, 4, 5, 8, 10];
console.log(set1.every(function (a) {
return a % 2 === 0;
})); // true
console.log(set2.every(function (a) {
return a % 2 === 0;
})); // false
@mojaray2k
mojaray2k / pattial-apply.js
Created May 23, 2014 15:55
To use partial application, you need to first bind the function to a context. After that, passing in additional parameters to the .bind() call withholds those parameters and applies them when the bound function is called.
function add(a, b){
return a + b;
}
var addOne = add.bind(null, 1);
var result = addOne(2);
console.log(result); //=> 3
@mojaray2k
mojaray2k / fallback-animations.js
Created May 23, 2014 05:33
Fallback to jQuery animation For supported properties
//Delegate .transition() call to .animate() if the browser can't do css transitions.
//Only works for properties that jQuery can handle; x/y won't work
if(!$.support.transition){
$.fn.transition = $.fn.animate;
}
@mojaray2k
mojaray2k / jsbin.hoqan.css
Created August 2, 2014 21:30
CSS-Only Animated 'Reminder' Placeholders
* {
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0;
box-shadow: none;
outline: none;
}
html, body { height: 100%; }
@mojaray2k
mojaray2k / array.prototype.some.js
Created August 2, 2014 16:08
Array.prototype.some() is supported in IE9+, and there is a polyfill shown on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some
var a = [1, 3, 5, 7, 9],
b = [1, 3, 4, 8, 9];
console.log(a.some(function (c) {
return c % 2 === 0; // false
}));
console.log(b.some(function (c) {
return c % 2 === 0; // true
}));
@mojaray2k
mojaray2k / Get_Page_by_Title.markdown
Created August 14, 2014 06:14
Get the data from a wordpress individual page by the title

Get the data from a wordpress individual page by the title