Skip to content

Instantly share code, notes, and snippets.

View nsisodiya's full-sized avatar

Narendra Sisodiya nsisodiya

View GitHub Profile
import { css } from 'lit';
var styles = css`
.bg-red {
background: red;
}
`;
const style = document.createElement('style');
style.textContent = styles.toString();
@nsisodiya
nsisodiya / delete.sh
Created December 17, 2020 10:48
Delete all remote git branch which are matching a given name
git branch -r | cat | grep sandesh | while read i
do
git push origin --delete $(echo $i | sed 's/\origin\///g')
done
@nsisodiya
nsisodiya / fix-version-lock.js
Last active September 30, 2020 06:33
./system/npm/fix-version-lock.js
const fs = require('fs');
const YAML = require('yamljs');
const replaceFirstLineOfFile = require('file-firstline-replace');
const pkgJson = require('../../package.json');
var filename = 'Dockerfile';
var newHeader = `FROM node:${pkgJson.nodeVersionLock} as builder\n`;
replaceFirstLineOfFile(filename, newHeader, function (error) {
if (error) {
throw error;
@nsisodiya
nsisodiya / preinstall.js
Created September 30, 2020 06:03
./system/npm/preinstall.js
const pkgJson = require('../../package.json');
const nodeVersion = process.versions.node;
let err = false;
if (pkgJson.nodeVersionLock !== nodeVersion) {
console.error(`Please use node ${pkgJson.nodeVersionLock}. Try
nvm install v${pkgJson.nodeVersionLock}
nvm reinstall-packages v${nodeVersion}
nvm uninstall v${nodeVersion}
@nsisodiya
nsisodiya / genBuildFileSize.js
Created September 23, 2020 06:33
genBuildFileSize.js
const fs = require('fs').promises;
const path = require('path');
const prettyBytes = require('pretty-bytes');
const buildDir = 'build';
const blackListedFiles = ['build/git-log.json'];
const blackListedDirs = ['build/report'];
const isArrayHas = (arr, str) => {
const outOfIndex = -1;
@nsisodiya
nsisodiya / main.js
Created July 27, 2020 09:51
Split String into multiple unique parts
/*
A string s contains only uppercase and lowercase letters.
Break this list into as many parts as possible
so that each letter appears in at most one parts.
Return the list of integers which represent the length of each part.
*/
function findPairs(str) {
var out = [];
type iAdd = (a: number, b: number) => number;
const add: iAdd = (a, b) => a + b;
add(3, 4);
@nsisodiya
nsisodiya / App.tsx
Last active April 25, 2020 08:10
React + Google Sheet demo - Step 1
import React, { useState } from "react";
import "./App.css";
const styles = {
InputBox: {
padding: 4,
},
Error: {
color: "red",
},
save-exact=true
save=true
@nsisodiya
nsisodiya / .gitlab-ci.yml
Last active November 30, 2019 15:46
.gitlab-ci.yml
image: node:9-alpine
stages:
- lint_test
- build
lint_test:
stage: lint_test
before_script:
- echo //registry.npmjs.org/:_authToken=$SYNGENTA_NPM_TOKEN >> ~/.npmrc