Skip to content

Instantly share code, notes, and snippets.

View reginpv's full-sized avatar
🏠
Working from home

Gin reginpv

🏠
Working from home
  • Bulacan, Philippines
View GitHub Profile
@reginpv
reginpv / file.txt
Created January 11, 2018 20:24
Magento 2 - Command line
/**
* Clearing cache
* Inside the bin dir run command
*/
php magento cache:flush
@reginpv
reginpv / file.txt
Created January 11, 2018 20:24
Magento 2 - Command line
/**
* Clearing cache
* Inside the bin dir run command
*/
php magento cache:flush
@reginpv
reginpv / main.css
Created December 11, 2017 17:47
Disable user copy paste on a specific element
/*
* A CSS class to protect content from user copy and user selection
*/
.nocopy {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@reginpv
reginpv / file.txt
Created August 19, 2017 04:47
Steps on GIT
# Initialize git
git init
# Add remote repo
git remote add origin [ADDRESS OF REPO]
# Verify remote repo
git remote -v
@reginpv
reginpv / viewportChecker.js
Last active August 14, 2017 15:20
Check is element is in Viewport via JQuery function
/*
* Detect element if in viewport
* returns bolean
*/
$.fn.isInViewport = function() {
var elementTop = $(this).offset().top
var elementBottom = elementTop + $(this).outerHeight()
var viewportTop = $(window).scrollTop()
var viewportBottom = viewportTop + $(window).height()
@reginpv
reginpv / main.js
Last active November 6, 2018 17:01
Detect vertical scroll direction via Javascript
/*
* Detect scroll direction
*/
// Scrolling logic
window.addEventListener(`scroll`, (e)=>{
// print "false" if direction is down and "true" if up
console.log(window.oldScroll > window.scrollY);
window.oldScroll = window.scrollY;
});
@reginpv
reginpv / main.js
Created August 14, 2017 06:16
Cheking if the bottom of the web page is reached via Javascript and JQuery
/*
* Checking dynamically if bottom if reach via scrolling
*/
$(window).scroll(()=>{
// Bottom reach
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
console.log("Bottom reached")
}
})
@reginpv
reginpv / index.html
Created July 13, 2017 01:24
Disable zooming on mobile browsers
<!--
- Just add "user-scalable=no" inside your viewport content meta
-->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
@reginpv
reginpv / style.css
Last active November 4, 2018 10:01
Removing "outline" color on Bootstrap 4 input elements
/*
* Using Bootstrap 4 Alpha
* Issue: wanted to remove the on :focus blue outline color
* Solution: It looks like it is not css outline but border color on class .form-control, copying default border color on inputs-
* (rgba(0,0,0,.15))
*/
/* removing outline on form inputs */
.form-control:focus {
border-color: rgba(0, 0, 0, .15);
@reginpv
reginpv / remoteImg2base64.js
Last active June 22, 2017 08:57
Get remote image via URL and return value sa base64encode
/*
* USAGE:
* convertImgToBase64URL(IMAGE_URL, base64Img => {
* console.log("Converted image: ", base64Img)
* })
*/
convertImgToBase64URL(url, callback, outputFormat){
var img = new Image();