Skip to content

Instantly share code, notes, and snippets.

View VarunBatraIT's full-sized avatar
🎯
Focusing

Varun Batra VarunBatraIT

🎯
Focusing
View GitHub Profile
Array.from(document.querySelectorAll('*'))
.reduce(function(pre, dom){
var evtObj = getEventListeners(dom)
Object.keys(evtObj).forEach(function (evt) {
if (typeof pre[evt] === 'undefined') {
pre[evt] = 0
}
pre[evt] += evtObj[evt].length
})
return pre
@VarunBatraIT
VarunBatraIT / php7_pthreads_en.sh
Last active July 28, 2018 11:07
PHP7 with Thread
#!/bin/bash
apt-get update
apt-get install -y \
bison \
autoconf \
build-essential \
pkg-config \
git-core \
@VarunBatraIT
VarunBatraIT / Assignment.md
Last active October 24, 2018 14:50
Basic Assignment

1

  • Use php to create 100 divs such that all the values inside divs must be a prime number in descending order starting from 99991.
  • Write a jQuery function which will hide the div is a user clicks on any of the prime number.

2

  • Create a PhysicalProduct class with all the necessary functionality.
  • Create a DigitalProduct class with all the necessary functionality.
  • Create a Cart class with all the necessary functionality which supports multiple carts - can add PhysicalProduct and DigitalProduct.
version: '2'
services:
mysql:
image: bitnami/mysql:latest
container_name: MySQL
user: "0:0"
restart: always
environment:
MYSQL_ROOT_PASSWORD: "mbstf"
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
@VarunBatraIT
VarunBatraIT / spicegems.md
Last active December 27, 2021 11:40
PHP Assignment SpiceGems

Collect all the under roots (Square Root: For instance 4 under root is 2) of all the positive integers between 1 to 100000 which are prime numbers in an array. Randomize the order of an array such that only ONE random triplet is in original order with exact same indices.

For instance, if input would have been 50, under root array would have been as following in ascending order:

$input = 50;
$ordered_output = [1, 2, 3, 5, 7];

and after randomize output would have been any one of the following but random everytime:

@VarunBatraIT
VarunBatraIT / annoying.js
Created September 13, 2012 17:56 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
<?php
/**
* This is the model class for table "vb_products".
*
* The followings are the available columns in table 'vb_products':
* @property integer $products_id
* @property integer $products_type
* @property integer $products_quantity
* @property integer $products_moq