Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Vinny Fonseca VinnyFonseca

🏠
Working from home
Block or report user

Report or block VinnyFonseca

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View randomize.js
const rand = (min, max) => Math.floor(Math.random() * (max - min)) + min;
View mixin-gradietn.sass
@mixin linear-gradient($fromColor, $toColor) {
background-color: $toColor; /* Fallback Color */
background-image: linear-gradient(top, $fromColor, $toColor); /* Chrome 10+, Saf5.1+, iOS 5+ */
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#{$fromColor}', EndColorStr='#{$toColor}');
}
View truncate.css
.truncate {
display: inline-block;
vertical-align: top;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@VinnyFonseca
VinnyFonseca / meat-viewport.html
Last active Dec 7, 2017
Meta: Viewport No Zoom
View meat-viewport.html
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
@VinnyFonseca
VinnyFonseca / email-hide-images.css
Last active Dec 28, 2019
Email: Hide images in all desktop clients
View email-hide-images.css
table[class="mob-show"],
tr[class="mob-show"],
td[class="mob-show"],
span[class="mob-show"],
a[class="mob-show"],
img[class="mob-show"] {
display: none !important;
font-size: 0 !important;
width: 0 !important;
height: 0 !important;
@VinnyFonseca
VinnyFonseca / fb-canvas-click-scroll.js
Last active Dec 7, 2017
FB Page Tab anchor click smooth scroll
View fb-canvas-click-scroll.js
function scrollFBTo(y){
FB.Canvas.getPageInfo(function(pageInfo) {
$({y: pageInfo.scrollTop}).animate({
y: y
}, {
duration: 500,
step: function(offset) {
FB.Canvas.scrollTo(0, offset);
}
});
@VinnyFonseca
VinnyFonseca / popup.js
Last active Dec 6, 2017
New Popup Window
View popup.js
const popup = function (url, title, w = 640, h = 320) {
let l = (screen.width / 2) - (w / 2);
let t = (screen.height / 2) - (h / 2);
return window.open(url, title, `toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${w}, height=${h}, top=${t}, left=${l}`);
}
@VinnyFonseca
VinnyFonseca / addeventlistener-multiple-events.js
Last active Jun 17, 2019
addEventListener multiple events
View addeventlistener-multiple-events.js
["change", "keyup", "paste", "input", "propertychange", "..."].forEach(function(event) {
document.querySelectorAll('.element').addEventListener(event, function() {
// Your callback here
}, false);
});
View pretty-log.txt
git log --pretty=format:"%h - %an, %ar : %s" --author="Vinny Fonseca"
View active-touch-detection.js
const wasTouched = () => {
myFrameworkOfChoice.dispatchEvent('USER_HAS_TOUCHED', true);
window.removeEventListener('touchstart', wasTouched, false);
window.addEventListener('mousedown', wasClicked, false);
};
const wasClicked = () => {
myFrameworkOfChoice.dispatchEvent('USER_HAS_TOUCHED', false);
window.removeEventListener('mousedown', wasClicked, false);
window.addEventListener('touchstart', wasTouched, false);
You can’t perform that action at this time.