Skip to content

Instantly share code, notes, and snippets.

View pankajpatel's full-sized avatar
🎯
Focusing

Pankaj Patel pankajpatel

🎯
Focusing
View GitHub Profile
@pankajpatel
pankajpatel / Gruntfile.js
Created December 5, 2015 11:28
Sample Gruntfile.js for MusicStore
module.exports = function(grunt) {
require('jit-grunt')(grunt);
grunt.initConfig({
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
watch: {
styles: {
files: ['src/**/*.*'], // which files to watch
tasks: ['less', 'copy:main', 'concat:dist', 'concat:libJs', 'concat:js', 'uglify', 'copy:app'],
options: {
nospawn: true
}
}
}
@pankajpatel
pankajpatel / countCSSRules.js
Last active September 15, 2017 13:36 — forked from krisbulman/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@pankajpatel
pankajpatel / content.html
Created January 10, 2016 17:07
Iframe Resizer content window snippet; reset of snippet taken from Bootstrap getting started page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--[if lte IE 8]>
<script type="text/javascript" src="js/ie8.polyfils.min.js"></script>
<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<!DOCTYPE html>
<html>
<head>
<title>Iframe Resizer</title>
<style>iframe{width:100%}</style>
</head>
<body>
<iframe src="http://anotherdomain.com/iframedPage.html" scrolling="no"></iframe>
<script>iFrameResize({log:true})</script>
<!--put log:false to turn off the logging-->
$(document).ready(function(event) {
function handleMenu(){
$('.page-container').toggleClass('open');
}
$('#toggle').on('click', function(e){
e.preventDefault();
handleMenu();
return false;
})
$('body').on('click', function(e){
@pankajpatel
pankajpatel / offcanvas.html
Last active January 25, 2016 23:33
off canvas html
<!DOCTYPE html>
<html>
<head>
<title>Demo : Guide to create off canvas navigation menu | Time to Hack</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="offcanvas.style.css">
</head>
<body>
<div class="page-container left">
@pankajpatel
pankajpatel / offcanvas.style.css
Last active January 25, 2016 23:31
Offcanvas CSS
body{
padding: 0;
margin: 0;
font-family: 'Source Sans Pro', 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
font-size: 18px;
}
.animated{
transition: all ease-out 0.4s;
}
.clearfix{
@pankajpatel
pankajpatel / code-1.htm
Created February 21, 2016 12:14 — forked from bennadel/code-1.htm
Decoding Morse Code With JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Decoding Morse Code With JavaScript</title>
<style type="text/css">
div.output {}
div.output p.message {
@pankajpatel
pankajpatel / getOverlap.js
Last active January 15, 2021 12:36
Function to get the overlap between two elements
/**
* Provides the overlapping status between two elements
* based on the passed in Element objects
*
* @param {Element, Element} Element object of DOM
* @return {Boolean} overlap status or null if native object not received
*/
const isOverlapping = (e1, e2) => {
if (e1.length && e1.length > 1) {
e1 = e1[0];