Skip to content

Instantly share code, notes, and snippets.

View dhruvangg's full-sized avatar
🎯
Focusing

Dhruvang Gajjar dhruvangg

🎯
Focusing
View GitHub Profile
@dhruvangg
dhruvangg / settibgs.json
Created June 29, 2022 08:47
VS Code Settings
{
"terminal.integrated.profiles.windows": "C:\\Windows\\System32\\cmd.exe",
"git.ignoreMissingGitWarning": true,
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"explorer.confirmDelete": false,
"terminal.integrated.windowsEnableConpty": false,
"javascript.updateImportsOnFileMove.enabled": "always",
"blade.format.enable": true,
"files.associations": {
let a = [1,2,3],
b = [1,2,3,4],
c = [8,9];
let checkAny = (arr, target) => target.some(el => arr.includes(el));
console.log(checkEvery(b, a)) // true
console.log(checkEvery(c, a)) // false
let a = [1,2,3],
b = [1,2,3,4],
c = [1,2];
let checkEvery = (arr, target) => target.every(el => arr.includes(el));
console.log(checkEvery(b, a)) // true
console.log(checkEvery(c, a)) // false
@dhruvangg
dhruvangg / isOnScreen.js
Last active May 29, 2020 07:50
Check Element is in Viewport or not
$.fn.isOnScreen = function(){
var win = $(window);
var viewport = {
top : win.scrollTop(),
left : win.scrollLeft()
};
viewport.right = viewport.left + win.width();
viewport.bottom = viewport.top + win.height();
var bounds = this.offset();
bounds.right = bounds.left + this.outerWidth();
@dhruvangg
dhruvangg / analog_clock.html
Created June 2, 2018 09:07 — forked from janx/analog_clock.html
html5 svg analog clock
<!DOCTYPE HTML>
<html>
<head>
<title>Analog Clock</title>
<script>
function updateTime() { // Update the SVG clock
var now = new Date();
var sec = now.getSeconds();
var min = now.getMinutes();
var hour = (now.getHours() % 12) + min/60;
@dhruvangg
dhruvangg / citystategeo.js
Created February 23, 2018 08:29 — forked from danasilver/citystategeo.js
Get only city and state from Google Maps API Reverse Geocoder
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {