Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Dhaval Vyas dhavalwd

🎯
Focusing
Block or report user

Report or block dhavalwd

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
@dhavalwd
dhavalwd / .htaccess
Created Aug 15, 2019 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
View git-tag-delete-local-and-remote.sh
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@dhavalwd
dhavalwd / textWidth.js
Created Oct 24, 2017
textWidth function - calculate text width
View textWidth.js
// Copied from here: https://stackoverflow.com/a/2771544/1909380
// jQuery function to calculate text width
$.fn.textWidth = function(){
var html_org = $(this).html();
var html_calc = '<span>' + html_org + '</span>';
$(this).html(html_calc);
var width = $(this).find('span:first').width();
$(this).html(html_org);
return width;
@dhavalwd
dhavalwd / flexbox.scss
Created Sep 29, 2017 — forked from richardtorres314/flexbox.scss
CSS Flexbox - Sass Mixins
View flexbox.scss
// --------------------------------------------------
// Flexbox SASS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
@mixin flexbox() {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
View bootstrap-sass-mixin-cheatsheet.scss
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@dhavalwd
dhavalwd / scrollto.js
Last active Aug 29, 2017
Easy Scroll to functions. Scroll within Body or scroll within parent element.
View scrollto.js
// For more information on this use below link.
// https://stackoverflow.com/questions/2346011/how-do-i-scroll-to-an-element-within-an-overflowed-div
// With Animation
jQuery.fn.scrollTo = function(elem, speed) {
$(this).animate({
scrollTop: $(this).scrollTop() - $(this).offset().top + $(elem).offset().top
}, speed == undefined ? 1000 : speed);
return this;
@dhavalwd
dhavalwd / multiFilter.js
Created Aug 25, 2017 — forked from jherax/filterArray.js
Filters an array of objects with multiple criteria.
View multiFilter.js
/**
* Filters an array of objects with multiple criteria.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria as the property names
* @return {Array}
*/
function multiFilter(array, filters) {
const filterKeys = Object.keys(filters);
// filters all elements passing the criteria
You can’t perform that action at this time.