Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Vinny Fonseca VinnyFonseca

🏠
Working from home
View GitHub Profile
View rename-git-stash.sh
#!/bin/bash
git stash list
echo "Enter stash number to rename"
read stash_number
echo "Enter new name"
read new_name
stash_name="stash@{${stash_number}}"
echo "$stash_name"
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);
View pretty-log.txt
git log --pretty=format:"%h - %an, %ar : %s" --author="Vinny Fonseca"
@VinnyFonseca
VinnyFonseca / addeventlistener-multiple-events.js
Last active Jul 10, 2020
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);
});
@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 / 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 / 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 / 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" />
View truncate.css
.truncate {
display: inline-block;
vertical-align: top;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
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}');
}
You can’t perform that action at this time.