Skip to content

Instantly share code, notes, and snippets.

View ArunHub's full-sized avatar

Arun M ArunHub

View GitHub Profile
@ArunHub
ArunHub / utils.js
Created July 22, 2022 12:24
javascript utils
function isObjEmpty(obj) {
for (const key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {
return false
}
}
return true
}
class Dog {
constructor() {
this.name = "woof";
}
bark() {
console.log(this.name)
}
}
var dd = new Dog()
Math.gcd = function () {
var d = Math.min.apply(Math, arguments);
for (let n = arguments.length, i = 0; d > 1 && n > i; arguments[i] % d === 0 ? i++ : (d--, i = 0));
return d;
}
console.log(Math.gcd(20, 30, 15, 70, 40));
function solution(s) {
let isPrime = (r)=>{
for (var i = 2; i <= Math.floor(Math.sqrt(r)); i++) {
if (r % i === 0) return false;
return true;
}
}
// for(var u=0; u<5;u++){console.log('uu',u);if(u==2) {return true}}
function distinct(arr, t) {
let count = 0;
let n = arr.length;
if(arr[n-1]<arr[n-2]){
let s = arr[n-1];
arr[n-1] = arr[n-2];
arr[n-2] = s;
}
for(var i=0;i<n-1;i++){
for(var j=i+1;j<=n;j++){
@ArunHub
ArunHub / array-rotate.js
Last active April 10, 2019 20:09
rvp is for practise instant code in desktop
let ia=0, ib=0, an=a.length, bn=b.length;
let r=[];
while(ia<an && ib<bn) {
let iia = ia;
let iib = ib;
let bb = b.charAt(ib);
while(a.charAt(iia)<=bb) iia++;
r.push(a.substring(ia,iia));
ia=iia;
let aa = a.charAt(ia);
@ArunHub
ArunHub / productive.txt
Created March 29, 2019 12:31
productive
http://www.inc.com/bill-murphy-jr/19-things-really-productive-people-refuse-to-do-according-to-tim-ferriss-and-his.html?cid=sf01001&sr_share=twitter
https://www.inc.com/business-insider/google-hardest-interview-questions.html
https://www.inc.com/zoe-henry/trump-changes-to-h-1b-impact-entrepreneurs-2018.html
https://www.inc.com/minda-zetlin/google-resume-mistakes-laszlo-bock-job-hiring-employment.html
https://www.inc.com/larry-kim/9-signs-you-might-secretly-be-an-ambivert.html
5 ted talks that are instant confidence boost
@ArunHub
ArunHub / navbarTabletMenuCollapse.css
Last active March 29, 2019 07:35
bootstrap navbar header collapse for Tablet >768 < 991 and bootstrap 3 tricks
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
@ArunHub
ArunHub / opencart.md
Created March 29, 2019 06:54
opencart tips
  1. no wrap row column for breadcrumb
  2. content body has id=content and all contents of body exluding breadcrumbs
  3. account pages buttons class which pull right.. have to change that
  4. do account pages sidebar with anchor link only not list type
@ArunHub
ArunHub / BoxWithBackgroundImageAndHeadingbottomtopleftright.txt
Last active March 29, 2019 06:53
sprite in center in top and heading in bottom
<a href="javascript:void" class="tpa">
<figure>
<img src="images/technical.jpg" class="img-responsive">
</figure>
<div>
<h3>Technical Information</h3>
</div>
</a>
.tpa {