Skip to content

Instantly share code, notes, and snippets.

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

Vinay Kumar vinaymavi

🏠
Working from home
View GitHub Profile
@vinaymavi
vinaymavi / flexToBlock.js
Created February 6, 2017 05:36
Convert all display type flex to block
function flexToBlock(){
$('*').each(function(index,el){
if($(el).css("display") === "flex"){
console.log($(el).css("display"));
$(el).css("display","block");
}
});
}
@vinaymavi
vinaymavi / Insert-Text.yaml
Last active August 1, 2017 20:26
Insert Text in current side. - Shared with Script Lab
name: Insert Image
description: Inserts an image to the current slide.
author: vinaymavi
host: POWERPOINT
api_set: {}
script:
content: |+
$('#insert').click(run);
function run() {
@vinaymavi
vinaymavi / Get file meta.yaml
Created August 1, 2017 20:52
Get a file meta information. - Shared with Script Lab
name: Get file meta
description: Get a file meta information.
author: vinaymavi
host: POWERPOINT
api_set: {}
script:
content: |-
$("#get-slide-metadata").click(getSlideMetadata);
function getSlideMetadata() {
{
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
@vinaymavi
vinaymavi / app.test.js
Last active February 28, 2018 09:48
Jest + Enzyme mount a component that has query selector like `document.getElementById()`
import { mount} from 'enzyme';
beforeAll(()=>{
const div = document.createElement('div');
window.domNode = div;
document.body.appendChild(div);
})
test("Test component with mount + document query selector",()=>{
const wrapper = mount(<YourComponent/>,{ attachTo: window.domNode });
});
@vinaymavi
vinaymavi / .gitconfig
Last active March 9, 2018 15:36 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[push]
default = matching
@vinaymavi
vinaymavi / password-genrator.js
Created August 13, 2018 05:43
Create secure password by provided human pattern.
function my_password(password_string){
var new_string = [];
new_string.push(password_string.charCodeAt(0));
new_string.push(password_string.trim());
new_string.push(password_string.charCodeAt(password_string.length-1));
return btoa(new_string.join(''));
}
var password_string = '<your string>'
console.log(my_password(password_string));
@vinaymavi
vinaymavi / Gramin Bharat index.js
Last active October 8, 2018 10:28
Google Cloud function gitst
const functions = require("firebase-functions");
const puppeteer = require("puppeteer");
const Crawler = require("./crawler");
const Firestore = require("./firebasestore");
const constraint = require("./crawler/constraint");
const COLLECTION_NAME = 'rows1';
const rowsCol = new Firestore(COLLECTION_NAME);
// Error = "Possible EventEmitter memory leak detected. 11 SIGINT listeners added" solutions
process.setMaxListeners(Infinity);
exports.betaRowListener = functions.firestore
@vinaymavi
vinaymavi / base.config.js
Created October 15, 2018 11:08
Node.js config management example base.config.js file
const base_config = {
message: "Server started with base configuration",
base_path: "https://baseapi.com/",
end_points: {
user: "/user",
auth: "/auth",
token_refresh: "/token-refresh"
}
};
module.exports = base_config;
@vinaymavi
vinaymavi / development.config.js
Created October 15, 2018 11:10
Node.js configuration management example development.config.js file.
const base_config = require("./base.config");
const development_config = {
message: "Server started with development configuration",
base_path: "https://developmentapi.com/"
};
const updated_config = Object.assign(base_config,development_config);
module.exports = updated_config;