Skip to content

Instantly share code, notes, and snippets.

View harpreetkhalsagtbit's full-sized avatar

Harpreet Singh harpreetkhalsagtbit

View GitHub Profile
@harpreetkhalsagtbit
harpreetkhalsagtbit / vite-config-with-separate-json-bundle.js
Created August 19, 2023 17:02
vite-config-with-separate-json-bundle.js
import { resolve } from 'node:path'
import libAssetsPlugin from '@laynezh/vite-plugin-lib-assets'
import { terser } from 'rollup-plugin-terser';
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(() => ({
plugins: [
@harpreetkhalsagtbit
harpreetkhalsagtbit / package.json
Created May 3, 2023 18:29
design-system-react
{
"name": "design-system-react",
"version": "1.0.5",
"description": "",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "",
@harpreetkhalsagtbit
harpreetkhalsagtbit / package.json
Last active April 29, 2023 16:31
create-react-lib-using-microbundle
{
"name": "design-system-react",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "microbundle --jsx React.createElement --jsxFragment React.Fragment --no-compress",
// Run using quokka - vscode
// Arrays
var init = [1,2,3,4,5]
var [a,b,c] = init
// for a, b, c map one to one and skip rest
a
b
c
@harpreetkhalsagtbit
harpreetkhalsagtbit / logicbuilder.ts
Last active May 12, 2018 12:59
parent child relation json operation with MoveUp, MoveDown in sibling array and Move one level up and down in the Heirarchy
// typescript version
import { Component } from '@angular/core';
import { ButtonViewComponent } from './button-view/button-view.component';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
@harpreetkhalsagtbit
harpreetkhalsagtbit / Component.js
Last active September 26, 2017 13:13
Stateless Component - Interaction with parent's state
import React from 'react';
import TextInput from '../../common/TextInput';
import PropTypes from 'prop-types'; // ES6
import './Add.css';
const AddUrl = ({urlShortForm, saveURLHandler, triggerPreviewURL}) => {
var _changeInterval = null;
let onKeyUpAddShortUrlTextInput = function(event) {
@harpreetkhalsagtbit
harpreetkhalsagtbit / charfreq.js
Created September 30, 2016 16:33
count consecutive char freq
var k = "aaahhrrrvfuuhh".split("")
var ref = k[0]
var newStr = ''
while(k.length) {
for(var i=0;i<k.length;i++) {
if(k[i] != ref) {
console.log(k[i] , ref, i)
k = k.splice(i,k.length - 1)
if(i > 1) {
@harpreetkhalsagtbit
harpreetkhalsagtbit / My Research on ELM.md
Last active September 26, 2016 10:53
My Research on ELM - 3/10 Marks to 8/10 Marks

My Research on ELM - Mail to my Boss - 9 June 2016

I have gone through so many articles related to elm from past few days. My affinity for using elm, had many ups and down as I gone through different articles.

The very first opinion, after reading One or Two articles related to Elm was:

  1. We need to learn a Totally New and Different syntax.
  2. People are comparing Elm with React --- How? Some are even saying it better that React - How?
  3. How to train other developers, how to convince other for using Elm(even I am not convinced yet). People are comfortable using HTML/CSS directly. Its not easy for everyone for a transition like this.
@harpreetkhalsagtbit
harpreetkhalsagtbit / Automate Testing of Meteor application with TheIntern.md
Last active January 25, 2016 14:12
Automate Testing of a Meteor Application using TheIntern.io

Testing Meteor Application with TheIntern.io

Problem

  1. Where to place tests folder and npm packages in Meteor folder structure so that they won't run with meteor command.

  2. How to access Meteor global variable and Meteor Collections.

  3. How to run tests?

@harpreetkhalsagtbit
harpreetkhalsagtbit / Selenium - TheIntern.md
Last active November 23, 2015 06:14
Automate Testing - TheIntern.io Selenium Functional Testing Example including Seting Up Environment

Automate Testing using - TheIntern.io and Selenium locally

Note: This tutorial focus on Automate Functional Testing on Ubuntu.

Environment Setup:

  • Install : JDK - Java .
  • Download: Selenium server - a *.jar file from this Link.