Skip to content

Instantly share code, notes, and snippets.

@shohagbhuiyan
shohagbhuiyan / svg.js
Last active July 27, 2017 05:05 — forked from schmidt1024/svg.js
Replace all SVG images with inline SVG using jQuery
/*
* Replace all SVG images with inline SVG
*/
//if img has svg, change it!
jQuery('img').filter(function() {
return this.src.match(/.*\.svg$/);
}).each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
@shohagbhuiyan
shohagbhuiyan / tmpClass.js
Created August 3, 2017 00:50
Add temporary class to HTML element
$(document).ready(function () {
$.fn.extend({
tmpClass: function (className, duration) {
var elements = this;
setTimeout(function () {
elements.removeClass(className);
}, duration);
return this.each(function () {
@shohagbhuiyan
shohagbhuiyan / SocialMediaTag.html
Created October 6, 2017 05:13
Product Social Media Tag Template
Product Social Media Tag Template
<!-- Update your html tag to include the itemscope and itemtype attributes. -->
<html itemscope itemtype="http://schema.org/Product">
<!-- Place this data between the <head> tags of your website -->
<title>Page Title. Maximum length 60-70 characters</title>
<meta name="description" content="Page description. No longer than 155 characters." />
<!-- Schema.org markup for Google+ -->
//It will work for the element that has position: relative
function postionMiddle(e) {
var capHeightHalf = $(e).innerHeight() / 2,
capParentHeightHalf = $(e).parent().innerHeight() / 2,
capPosition = capParentHeightHalf - capHeightHalf;
$(e).css("top", capPosition );
}
postionMiddle(".caption"); // place your element instead .caption
@shohagbhuiyan
shohagbhuiyan / tab.js
Created November 12, 2017 23:37
jQuery Tabs using CSS
/*Note: add class "tabSet1" or "tabSet2" after ul.tabs and tab-content */
function tab(x) {
var a = $('ul.tabs.' + x + ' ' + 'li');
a.click(function () {
var tab_id = $(this).attr('data-tab');
a.removeClass('active');
$('.tab-content.' + x).removeClass('active');
$(this).addClass('active');
@shohagbhuiyan
shohagbhuiyan / .gitignore
Created December 8, 2017 00:49 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@shohagbhuiyan
shohagbhuiyan / abnvalidate.js
Last active March 7, 2018 04:35
Australian Business Number (ABN) format validation for 'jQuery validation'
function abnValidate(value, element){
if (value.length != 11 || isNaN(parseInt(value)))
return false;
var weighting =[10,1,3,5,7,9,11,13,15,17,19];
var tally = (parseInt(value[0]) - 1) * weighting[0];
for (var i = 1; i < value.length; i++){
tally += (parseInt(value[i]) * weighting[i]);
}
return (tally % 89) == 0;
}
@shohagbhuiyan
shohagbhuiyan / CSS3 Media Queries Template
Created April 23, 2018 01:21
CSS3 Media Queries template
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@shohagbhuiyan
shohagbhuiyan / readme.txt
Last active July 12, 2018 05:35
Play image sequence
//HTML
/*=====================
<div class="root">
<div class="imageplayer">
</div>
</div>
=======================*/

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);