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 / 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 / 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 / chrome.bat
Created March 29, 2019 06:07
Disable same origin policy in Chrome
Run below command by pressing (Windows key + R key)
chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security
Reference: https://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome
<span class="screw"></span>
.screw {
position: absolute;
left: 50%;
width: 20px;
height: 20px;
background: #333 none repeat scroll 0% 0%;
border-radius: 50%;
border: 1px solid #ccc;
text-align: center;
@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 {