Skip to content

Instantly share code, notes, and snippets.

View vithalreddy's full-sized avatar
🔥

Vithal Reddy vithalreddy

🔥
View GitHub Profile
<b:if cond='data:blog.metaDescription != &quot;&quot;'>
<meta expr:content='data:blog.metaDescription' property='og:description'/>
<meta expr:content='data:blog.metaDescription' name='twitter:description'/>
<meta expr:content='data:blog.metaDescription' itemprop='description'/>
</b:if>
<b:if cond='data:blog.postImageUrl'>
<meta expr:content='data:blog.postImageUrl' property='og:image'/>
<meta expr:content='data:blog.postImageUrl' name='twitter:image'/>
<meta expr:content='data:blog.postImageUrl' itemprop='image'/>
<b:else/> <b:if cond='data:blog.postImageThumbnailUrl'>
function filterpagesinsearch($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts', 'filterpagesinsearch');
@vithalreddy
vithalreddy / directives.js
Created October 29, 2017 13:34 — forked from elizabeth-young/directives.js
Some Angular validation directives
'use strict';
var directives = angular.module('app', []);
// override the default input to update on blur
directives.directive('input', function () {
return {
restrict: 'E',
require: 'ngModel',
link: function (scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
@vithalreddy
vithalreddy / win10ShortcutKeys.json
Created November 19, 2017 16:44
Windows 10 PC Ultimates Shortcut keys List
[
["Windows key","Open or close Start Menu." ],
["Windows key + A","Open Action center." ],
["Windows key + C","Open Cortana in listening mode." ],
["Windows key + D","Display and hide the desktop." ],
["Windows key + E","Open File Explorer." ],
["Windows key + G","Open Game bar when a game is open." ],
["Windows key + H","Open the Share charm." ],
["Windows key + I","Open Settings." ],
["Windows key + K","Open the Connect quick action." ],
@vithalreddy
vithalreddy / roles_invesitgation.md
Created February 23, 2018 06:23 — forked from facultymatt/roles_invesitgation.md
Roles and permissions system for Nodejs
@vithalreddy
vithalreddy / mongo_db_recover_delete_record.py
Created May 7, 2018 09:13 — forked from egguy/mongo_db_recover_delete_record.py
Recover deleted data from mongo DB database
"""A little script to recover deleted recording of a mongoDB db file
There's no optimization but it work and has saved me
"""
import struct
import bson
import pymongo
import sys
@vithalreddy
vithalreddy / gd-drive-file-download.sh
Last active September 17, 2019 08:20
Shell Script To Download Google Drive Files from terminal
#!/bin/bash
read -p "Enter File Id: " fileid
read -e -p "Enter File Dir: " "path_to_download_dir" dir #replce with your download dir path ~/Downloads
cd ~/$dir
echo "File will be downloaded in dir: ~/{$dir}"
curl -c ./$fileid -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
@vithalreddy
vithalreddy / TaylorSeries.js
Created November 13, 2019 06:23
Taylor Series using Horner's Rule in Javascript
function ex(x, n, s = 1) {
if (n === 0) return s;
s = 1 + (x * s) / n;
return ex(x, n - 1, s);
}
console.log(ex(1, 10)); // 2.7182818011463845
console.log(ex(5, 10)); // 146.38060102513225
@vithalreddy
vithalreddy / Javascript settimeout in promise chain.js
Last active January 6, 2020 07:58
Javascript settimeout in promise chain
// example code for blog post
// https://stackfame.com/javascript-settimeout-promise-chain
makeHttpCall("https://api.stackfame.com/1")
.then(function(data) {
return makeHttpCall("https://api.stackfame.com/2");
})
.then(function(data) {
return loadScript("https://api.stackfame.com/3");
})
.then(function(data) {
@vithalreddy
vithalreddy / verifyPasswordStrength.js
Created May 7, 2020 09:49
Password Strength Validation function for Javascript/Typescript with configurable options
const passwordConfig = Object.freeze({
minLength: 8,
atleaseOneLowercaseChar: true,
atleaseOneUppercaseChar: true,
atleaseOneDigit: true,
atleaseOneSpecialChar: true,
});
function verifyPasswordStrength(password) {
if (