Skip to content

Instantly share code, notes, and snippets.

View kamlekar's full-sized avatar
💭
Self refactoring

Venkateshwar kamlekar

💭
Self refactoring
View GitHub Profile
@kamlekar
kamlekar / updating-ubuntu-wsl.md
Last active March 31, 2022 18:41
Steps to do to avoid any issues while updating Ubuntu distro on WSL, windows 10

Sometimes Ubuntu fails to install some services which probably can be fixed by updating the Ubuntu distro, which was my case.

My case was aws-vault was throwing strange errors. Updating Ubuntu fixed it.

Here are the steps I did to make the Ubuntu update go smooth.

Note: Make sure you are running it as a non-root user

Note: $PATH resets when the terminal is reopened. To avoid this, register the $PATH changes in ~/.bashrc file. As mentioned here: stackoverflow. Example: echo 'export PATH=$PATH: /path/to/bin' >> ~/.bashrc or add export PATH=$PATH: /path/to/bin at the end of the .bashrc by opening it in a editor, sudo vi ~/.bashrc.

@kamlekar
kamlekar / form-submit.js
Last active February 1, 2024 15:16
Form submit - Hubspot edition
function callAjax(payload){
//- formSelector
//- portalId
//- formGUID
//- hideMessageTime
//- callback
//
var $form = $(payload.formSelector);
var form = $form[0];
var url = "https://api.hsforms.com/submissions/v3/integration/submit/" + payload.portalId + "/" + payload.formGUID
@kamlekar
kamlekar / throttleDebounce,js
Created May 22, 2019 11:58 — forked from pavan-idapalapati/throttleDebounce,js
Debounce and throttle functions
function throttle(callback, limit) {
var tick = false;
return function () {
if (!tick) {
callback.call();
tick = true;
setTimeout(function () {
tick = false;
}, limit);
}
@kamlekar
kamlekar / sw-ang.md
Last active May 23, 2018 11:33
Adding Service worker to Angular 6 project
  • In package.json:

      dependencies: {
          ...
          "@angular/service-worker": "6.0.3",
          ...
      }
    
"use strict";
const gulp = require('gulp');
const sass = require('gulp-ruby-sass');
const prefix = require('gulp-autoprefixer');
const minifycss = require('gulp-minify-css');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const connect = require('gulp-connect');
const uglify = require('gulp-uglify');
@kamlekar
kamlekar / Android-setup.md
Last active December 30, 2017 04:25
Nativescript setup

Android SDK Path:

  • Open Android Studio
  • File -> Settings... -> Appearance & Behavior -> System Settings -> Android SDK
  • You should be able to see a field "Android SDK Location"

Environment variables to set:

set ANDROID_HOME= {location taken from top Android SDK path}

@kamlekar
kamlekar / npm-python-issue-fix.md
Last active August 7, 2018 08:51
To upgrade npm installs from outdated node version to latest node version

open up a new cmd as administrator and run this command:

npm install --global --production windows-build-tools

then (this seems optional)

npm config set msvs_version 2015 --global

##Setting Up Meta Data Fields##

  • Install/Activate Custom Fields Suite WordPress Plug-In, Docs
  • Create new Field Group called Gallery Meta Data
  • Add a Field called Gallery Images and set the type as Loop, fill out the rest of the required fields, for placement rules attach this custom meta data to WordPress type of Page or whatever your requirements are. Hit Publish Figure 1
  • Next, Add additional field called Image. Hit Update Figure 2
  • Next, drag Image, field we just created, under the Gallery Images it needs to be a child of the Loop, Hit Update Figure 3

##Adding Meta Data to Pages##

@kamlekar
kamlekar / dummy.css
Last active May 8, 2019 07:47
Responsive cards
body,html{
height: 100%;
padding: 0;
margin: 0;
}
.parent{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
@kamlekar
kamlekar / load-files.js
Last active March 17, 2017 08:05
Used to load files synchronously. (useful to show progress of loading files)
function loadFiles(files, fn) {
var head = document.head || document.getElementsByTagName('head')[0];
var counter = files.length;
callback(); // To cover case when there are no files available
files.forEach(loadFile);
function loadFile(file) {
var fileref = document.createElement('script');
fileref.setAttribute('type', 'text/javascript');
fileref.setAttribute('src', file);