Skip to content

Instantly share code, notes, and snippets.

View manfromanotherland's full-sized avatar
🤏

Edmundo Santos manfromanotherland

🤏
View GitHub Profile
@manfromanotherland
manfromanotherland / clearfix.css
Last active October 2, 2015 10:28
CSS: Clearfix #snippet
/* Clearfix */
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
@manfromanotherland
manfromanotherland / gist:2228169
Last active October 2, 2015 10:28 — forked from hagenburger/jQuery HTML5 placeholder fix.js
jQuery: Placeholder Fix for IE #snippet
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
@manfromanotherland
manfromanotherland / sticky-header-ie8.js
Last active August 29, 2015 13:55
JS, jQuery: Sticky element on top. #snippet
// Sticky Element on scroll
var sticky = $('.selector');
var top = sticky.offset().top - parseFloat(sticky.css('margin-top').replace(/auto/, 0));
$(window).scroll(function (event) {
var y = $(this).scrollTop();
y >= top ? sticky.addClass('fixed') : sticky.removeClass('fixed');
});
@manfromanotherland
manfromanotherland / isMobile.js
Created February 21, 2014 19:00
JS: Detecting mobile devices with JavaScript #snippet
// Detect Mobile Devices
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
@manfromanotherland
manfromanotherland / chmod-directories.sh
Created March 31, 2014 14:28
SHELL: CHMOD recursively on directories using find
find -name '*' -type d -exec chmod 0755 {} \;
@manfromanotherland
manfromanotherland / chmod-files.sh
Created March 31, 2014 14:29
SHELL: CHMOD recursively on files using find
find . -type f -exec chmod 0644 {} \;
@manfromanotherland
manfromanotherland / .gitignore_global
Last active August 29, 2015 14:00
GIT: .gitignore_global #snippet
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@manfromanotherland
manfromanotherland / mfp-fade.css
Created April 30, 2014 19:30
CSS: Magnific Popup fade in/out effect #snippet
.mfp-fade.mfp-bg {
opacity: 0;
background: #00;
transition: all .3s;
}
.mfp-fade.mfp-bg.mfp-ready { opacity: .9; }
.mfp-fade.mfp-bg.mfp-removing { opacity: 0; }
.mfp-fade.mfp-wrap .mfp-content {
@manfromanotherland
manfromanotherland / anonymousClosure.js
Last active July 15, 2016 14:38
JS: anonymous closure #snippet
(function() {
})();
@manfromanotherland
manfromanotherland / viewport-size.js
Last active August 29, 2015 14:02
JS: Show viewport size for easy responsive development (no need to have the dev tools open).
// Show viewport size
document.addEventListener('DOMContentLoaded', function() {
document.body.insertAdjacentHTML('afterend', '<div id="viewport-size" style="position:fixed; top:0; right:0; z-index: 9999; padding:0 .5em; color:#333; background:rgba(255,255,255,.75); font: 14px/1.8em Monaco, Inconsolata, Ubuntu Mono, Courier New, monospaced;"></div>');
showViewportSize();
});
window.onresize = function() { showViewportSize(); }
function showViewportSize() {
var body = document.body,