Skip to content

Instantly share code, notes, and snippets.

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

Aniket A. Suryavanshi anikets

🏠
Working from home
View GitHub Profile
@anikets
anikets / traverseObjectProperties.js
Created September 7, 2018 06:52
Iterate through all object properties recursively in JavaScript
// Traverse through all properties, including nested, in an object.
var obj = {
one: 1,
two: 'two',
three: [1,2,3],
four: {
four1: 1,
four2: true,
four3: {
@anikets
anikets / equalizeHeightsWithResize.js
Created November 21, 2015 10:51
Class for equalizing heights of elements. Works on window resize.
// Class for equalizing heights of elements. Works on window resize.
// Example usage:
// var instanceObject = Object.create(equalizeHeightsWithResize);
// instanceObject.selector = '.srp-prod h3';
// instanceObject.eq();
var equalizeHeightsWithResize = {
max: 0,
rt: null,
selector: '',
eq: function() {
@anikets
anikets / behavior.js
Last active November 17, 2015 09:44
Welcome Modal
/*\
|*|
|*| :: cookies.js ::
|*|
|*| A complete cookies reader/writer framework with full unicode support.
|*|
|*| Revision #1 - September 4, 2014
|*|
|*| https://developer.mozilla.org/en-US/docs/Web/API/document.cookie
@anikets
anikets / equalizeHeights.js
Created April 2, 2015 21:07
A function to equalize heights of all elements matching the selector.
// A function to equalize heights of all elements matching the selector.
// Example Usage:
// equalizeHeights( '.allTestimonialTextBlocks' );
function equalizeHeights( selector ) {
var max = 0;
var current;
$( selector ).css( 'min-height', 'inherit' );
$( selector ).each( function( i, v ) {
current = parseInt( $( v ).css( 'height' ));
current > max ? max = current : max = max;
@anikets
anikets / jquery.scrollHere.js
Last active August 29, 2015 14:04
A handy jQuery plugin to scroll an element to top of screen.
/*
Author: Aniket A. Suryavanshi | @44Sur
Gist URL: https://gist.github.com/anikets/b8dd21a374aebc1f1f37
A handy jQuery plugin to scroll an element to top of screen.
Example usage:
$( '#selector' ).scrollHere();
$( '#selector' ).scrollHere( 45 );
$( '#selector' ).scrollHere( $( '.header' ).height());
@anikets
anikets / css3-scss-mixins.scss
Last active January 25, 2017 22:46
Scss mixins for CSS3
/*
* Author: Aniket A. Suryavanshi | @44Sur
* Gist URL: https://gist.github.com/anikets/2da2fb7ac318c2f507a7
*
* Some mixins for quickly writing less bloated cross-browser CSS.
*
* Setup instructions:
* Save this file with a .scss extension. Import this file in the .scss file
* in which you wish to use these mixins by adding this directive at the top:
* @import 'css3-scss-mixins';
@anikets
anikets / sass-css3-mixins.sass
Last active July 5, 2022 08:27
Sass Mixins for cross-browser CSS3
/*
* Author: Aniket A. Suryavanshi | @44Sur
* Gist URL: https://gist.github.com/anikets/2da2fb7ac318c2f507a7
*
* Some mixins for quickly writing less bloated cross-browser CSS.
*
* Setup instructions:
* Save this file with a .scss extension. Import this file in the .scss file
* in which you wish to use these mixins by adding this directive at the top:
* @import 'css3-scss-mixins';
@anikets
anikets / gist:8b8ce40fbcb4ab5d138f
Last active August 29, 2015 14:03
Behaviour for Jalousie Window
var xc, yc; // X and Y coordinates of the mouse pointer.
// Change perspective origin as the mouse pointer moves.
document.body.addEventListener( 'mousemove', function( event ) {
// Chrome returns event.x and event.y whereas Firefox returns
// eventclientX and eventClientY.
'x' in event ? xc = event.x : xc = event.clientX;
'y' in event ? yc = event.y : yc = event.clientY;
document.body.setAttribute('style', 'perspective-origin:' + xc + 'px ' + yc + 'px;' + '-webkit-perspective-origin-x:' + xc + 'px; -webkit-perspective-origin-y:' + yc + 'px' );
});
@anikets
anikets / gist:6b6347a4b9338e8bd630
Last active August 29, 2015 14:03
Styling for Jalousie Window
body {
perspective: 1000px;
-webkit-perspective: 1000px;
}
.window {
background-image: url( 'images/waterscape.JPG' );
background-position: center center;
background-size: cover;
border: solid 50px brown;
border-image: url('images/dark_wood.png') 25% repeat;
@anikets
anikets / gist:b7590450f3f4ac91a980
Last active August 29, 2015 14:03
Markup for Jalousie Window
<div class='window'>
<div class='pane'>Pane 1</div class='pane'>
<div class='pane'>Pane 2</div class='pane'>
<div class='pane'>Pane 3</div class='pane'>
<div class='pane'>Pane 4</div class='pane'>
<div class='pane'>Pane 5</div class='pane'>
</div>