Skip to content

Instantly share code, notes, and snippets.

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

Sandesh Damkondwar sandeshdamkondwar

🏠
Working from home
View GitHub Profile
@sandeshdamkondwar
sandeshdamkondwar / use-scroll.js
Created June 17, 2020 19:15 — forked from viclafouch/use-scroll.js
A custom React Hook to handle the scroll of a DOM element.
// hooks/use-scroll.js
import { useEffect, useRef, useCallback, useState } from 'react'
function useScroll({ threshold = 450, isWindow = false, smooth = true } = {}) {
const [isAtBottom, setIsAtBottom] = useState(false)
const ref = useRef(isWindow ? window : null)
const goTop = useCallback(() => {
const element = ref.current
element.scrollTo({
@sandeshdamkondwar
sandeshdamkondwar / tblcitylist.sql
Created January 20, 2017 06:53 — forked from sivaprabug/tblcitylist.sql
MySQL database of Indian Cities and states,latitude and longitude..
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 08, 2013 at 02:48 PM
-- Server version: 5.5.27
-- PHP Version: 5.4.7
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@sandeshdamkondwar
sandeshdamkondwar / wifiDance.sh
Created December 14, 2015 10:17 — forked from anuragpeshne/wifiDance.sh
bash script to
#!/bin/sh
let sleepTime="15*60";
while [ 1 ]
do
if [ $(( $RANDOM % 2)) == 0 ]
then
echo "switching to NTWRK1";
networksetup -setairportnetwork en1 {NTWRK_NAME} {NTWRK_PSWD}
else
@sandeshdamkondwar
sandeshdamkondwar / ES6 classes.js
Last active September 11, 2015 17:57
Future of javascript
class Coupon {
constructor(options) {
this.title = options.title;
this.desc = options.desc;
this.code = options.code;
this.link = options.link;
this.expiry = options.expiry;
}
}
@sandeshdamkondwar
sandeshdamkondwar / Interview Q's.txt
Created May 11, 2015 05:26
Interview Questions
General Questions
=========================================================================================
Personal Workflow
1. What is a recent challenges you experienced and how did you solved those?
2. What tools you use in regular workflow?
3. If you jumped on a project and they used tabs and you used spaces, what would you do?
_________________________________________________________________________________________
Performance
@sandeshdamkondwar
sandeshdamkondwar / object.create.js
Created May 10, 2015 20:44
Object.create Polyfill
if (typeof Object.create != 'function') {
Object.create = (function() {
var Temp = function() {};
return function (prototype) {
if (arguments.length > 1) {
throw Error('2nd argument is not supported');
}
if (typeof prototype != 'object') {
throw TypeError('argument should be object');
array1 = [0,1,2,3,4,5,6]
[0, 1, 2, 3, 4, 5, 6]
array1.splice(2) -> default first argument is 0
[2, 3, 4, 5, 6]
array1
[0, 1]
----------------------------------------------------------------------------------------
@sandeshdamkondwar
sandeshdamkondwar / sublime tips.md
Last active July 22, 2016 19:49
Sublime text tips

Edit opening and closing HTML tags simultaneously:

Cmd+Shift+K (on OS X) or Ctrl+Shift+’ (Windows and Linux) selects both tags for editing.

Ctrl + Shift + w

Wrap selection in

@sandeshdamkondwar
sandeshdamkondwar / tricks.js
Last active August 29, 2015 14:17
JavaScript tricks
// Get a random number in a specific range
function randomInRange(max, min) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Get a random item from an array
function randomFromArray(items) {
return items[Math.floor(Math.random() * items.length)];
}
@sandeshdamkondwar
sandeshdamkondwar / custom.css
Last active August 29, 2015 14:10
Custom CSS for google.com (You can use stylebot extension like tool to apply this css rules, here goes a link for chrome extension https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha)
.gbqfif, .gbqfsf,li.g, body, html, .std, h1 {
font-family: "Open Sans";
}
.sbib_b {
padding: 3px 7px 0;
}
#rhs ._za.vk_pl {
padding-left: 0;