Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Varun Batra VarunBatraIT

🏠
Working from home
View GitHub Profile
@VarunBatraIT
VarunBatraIT / Assignment.md
Last active Oct 24, 2018
Basic Assignment
View Assignment.md

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.
View events.js
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
View jQuery-level-2.md

Situation

  • We have three files - page.html, sidebard.html, main.html

page.html

  • Head only has jQuery
  • Body has three divs with id timestamp, sidebar and main.

main.html content

View jQuery-level-1.md

Situation

  • HTML body is black.
  • Head only has jQuery

Assignment

  • Create 100 li under ul - numbered 1,2,3 to 100 using jQuery
  • if clicked on any li, that li will be removed using jQuery
View elasticsearch.service
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
RuntimeDirectory=elasticsearch
Environment=ES_HOME=/usr/share/elasticsearch
Environment=ES_PATH_CONF=/etc/elasticsearch/elasticsearch.yml
@VarunBatraIT
VarunBatraIT / react_rails_redux.sh
Created Oct 7, 2017
Rails with React, Redux, ES6, Webpack, and Gulp
View react_rails_redux.sh
# Create rails app
gem install make_it_so
make_it_so rails <name>
rake db:create db:migrate db:test:prepare && rspec
# get NPM set up (make sure node is installed)
npm init
npm install --save babel-loader gulp webpack gulp-webpack react redux react-redux
touch webpack.config.js
vim webpack.config.js
View laravel-assignment.md

Please upload codes to github and share the url when you start the test.

Two different domains and Two Systems Client/Server.

  • Please consider that your backend is running at backendserver.com and html/css/jQuery OR angular/react app is running at frontendserver.com
  • Your server doesn't contain any codes of client. Both are mutually independent of each other. One laravel app is just a rest api, other app is nothing but simple forms built with angular/react or just jquery.

Three databases

  • information_db will contain a table shops with columns shop_name, db_name & reqeusts like

|id|shop_name|db_name|requests|

View assignment.md

Two different domains.

  • Please consider that your backend is running at backendserver.com and angular app is running at frontendserver.com

Three databases

  • information_db will contain a table shops with columns shop_name, db_name & reqeusts like
id shop_name db_name requests
1 Shop A shop_a 0
2 Shop B shop_b 0
@VarunBatraIT
VarunBatraIT / custom-error-page
Created Jul 6, 2016 — forked from simlegate/custom-error-page
Nginx return custom json
View custom-error-page
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
View php7_pthreads_en.sh
#!/bin/bash
apt-get update
apt-get install -y \
bison \
autoconf \
build-essential \
pkg-config \
git-core \
You can’t perform that action at this time.