Skip to content

Instantly share code, notes, and snippets.

View vijjusri14's full-sized avatar
πŸ’­
🌠

Vijay Bhaskar vijjusri14

πŸ’­
🌠
View GitHub Profile
@vijjusri14
vijjusri14 / globalGWG.js
Last active May 19, 2022 06:42
Global List of current Games With Gold
/*
Visit https://www.xbox.com/en-US/live/gold/
and in browser's console run below code to get list currently available Games With Gold list.
This list may include additional games that are made available for free with gold in certain countries.
*/
var gameList = [];
$.each(globalContentNew.locales, function(index, value){
gameList.push(value.keyLinknowgame1, value.keyLinknowgame2, value.keyLinknowgame3, value.keyLinknowgame4, value.keyLinknowgame5, value.keyLinknowgame6, value.keyLinknowgame7, value.keyLinknowgame8)
})
@vijjusri14
vijjusri14 / filterById.js
Created September 9, 2021 15:03
Filter Objects by Id
function filteredById(m) {
return this.id === m.id;
}
var x = [
{ name: "Apple", id: 123 },
{ name: "Ball", id: 124 },
{ name: "Cat", id: 125 }
];
var y = { id: 123 };
var z = x.filter(filteredById, y);
@vijjusri14
vijjusri14 / findAllIndexes.js
Created February 20, 2020 06:08
Find all indexes of the object in object array by matching object key using Jquery
var x = [{'key':'a'},{'key':'b'},{'key':'a'}];
$.fn.findAllIndexes = function(key,value) {
var result = [];
$(this).each(function(index,item){
if(item[key]===value){
result.push(index);
}
});
return result;
@vijjusri14
vijjusri14 / filterObjectArrayById.js
Created February 20, 2020 06:06
Filter object array with object id in Javascript
function filteredById(m) {
return this.id === m.id;
}
var x = [
{ name: "Apple", id: 123 },
{ name: "Ball", id: 124 },
{ name: "Cat", id: 125 }
];
var y = { id: 123 };
var z = x.filter(filteredById, y);
@vijjusri14
vijjusri14 / cssSnippets.css
Created January 20, 2020 10:07
CSS snippets
section.blue {
min-height: 30px;
background-color: #44d62c;
background-image: -moz-linear-gradient(45deg, #9C27B0 0%, #44d62c 100%);
background-image: -webkit-linear-gradient(45deg, #008aff 0%, #82e26f 100%);
background-image: -ms-linear-gradient(45deg, #9C27B0 0%, #44d62c 100%);
color: #fff;
}
section.wshadow {
@vijjusri14
vijjusri14 / camelCase.js
Created January 20, 2020 09:57
Convert to camel case
CamelCase(str) {
return str.replace(/(?:^|\s)\w/g, match => match.toUpperCase());
}
@vijjusri14
vijjusri14 / sortObjectByKey.js
Created August 27, 2019 07:21
Sort js object by key
var cities = [{code:'HYD',city:'Hyderabad'},
{code:'MUM',city:'Mumbai'},
{code:'BLR',city:'Bengaluru'},
{code:'PNQ',city:'Pune'},
{code:'MAA',city:'Chennai'}];
//Sort descending:
cities.sort((a, b) => (a.city > b.city ? -1 : 1));
console.log(cities)
@vijjusri14
vijjusri14 / text2pass.html
Created March 11, 2019 06:07
Set input field type as password on focus out using Jquery
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<h2>Jquery Text2Pass</h2>
<input type="text" id="text2Pass" />
@vijjusri14
vijjusri14 / JS_Date_Example.js
Last active August 30, 2021 07:59
JS Date adventures
var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var startIST = new Date ('Jan 12 2017 10:00');
var endIST = new Date ('Jan 13 2018 10:30');
var startLocal = new Date(new Date(startIST).setMinutes(startIST.getMinutes() + ((new Date().getTimezoneOffset()) * -1) - 330));
@vijjusri14
vijjusri14 / Pinger.bat
Created May 19, 2018 03:35
Ping a host indefinitely
@echo off
cls
title Pinger
color a
:start
@echo off
cls
@echo on
::Replace 192.168.0.1 with the host IP/name you want to ping to
ping 192.168.0.1