Skip to content

Instantly share code, notes, and snippets.

View prajwal-stha's full-sized avatar

Prajwal Shrestha prajwal-stha

View GitHub Profile
const Activity = require('../../models/OnTheJobTraining/Activity')
const MemberActivity = require('../../models/OnTheJobTraining/MemberActivity')
const MemberActivityHours = require('../../models/OnTheJobTraining/MemberActivityHours')
const ActivityMedia = require('../../models/OnTheJobTraining/ActivityMedia')
const mongoose = require('mongoose');
/**
* List all the activities
* @param req
* @param res
import math
import random
random.seed(5)
def sigmoid(x):
return 1 / (1 + math.exp(-x))
for x in range(3):
random_num = random.randint(0,3)
main .content-section {
padding: rem(80) 0;
}
main .content-section .tabset ul.tabs {
padding: 0;
margin: 0;
list-style: none;
}
main .content-section .tabset ul.tabs li {
font-family: 'Mont-Regular';
@prajwal-stha
prajwal-stha / Hive-Assignment.txt
Created April 16, 2019 02:23
Answer for Hive Assignment
1. SELECT SUM(ConsumerCount) FROM(SELECT bc.BeverageName, bc.ConsumerCount FROM Beverages_Consumers_Internal AS bc RIGHT OUTER JOIN Beverages_Branches_Internal AS bb ON (bc.BeverageName=bb.BeverageName AND bb.BranchName='Branch1')) totalConsumer;
2. SELECT DISTINCT bc.BeverageName, SUM(bc.ConsumerCount) OVER (PARTITION BY bc.BeverageName ORDER BY bc.BeverageName ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS totalCount FROM Beverages_Consumers_Internal AS bc RIGHT OUTER JOIN Beverages_Branches_Internal AS bb ON bc.BeverageName=bb.BeverageName WHERE bb.BranchName='Branch1' ORDER BY totalCount DESC LIMIT 10;
3. SELECT DISTINCT bb.BranchName, bc.BeverageName, SUM(bc.ConsumerCount) OVER (PARTITION BY bc.BeverageName ORDER BY bc.BeverageName ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS totalCount FROM Beverages_Consumers_Internal AS bc RIGHT OUTER JOIN Beverages_Branches_Internal AS bb ON bc.BeverageName=bb.BeverageName WHERE bb.BranchName IN ('Branch1', 'Branch2') ORDER BY total
@prajwal-stha
prajwal-stha / reducer.py
Created April 9, 2019 13:04
Reducer File
#!/usr/bin/python
import sys
from operator import itemgetter
# using a dictionary to map words to their counts
current_word = None
current_count = 0
word = None
# input comes from STDIN
for line in sys.stdin:
line = line.strip()
@prajwal-stha
prajwal-stha / mapper.py
Created April 9, 2019 13:03
Mapper File
#!/usr/bin/python
import sys
# Word Count Example
# input comes from standard input STDIN
for line in sys.stdin:
# remove leading and trailing whitespaces
line = line.strip()
# split the line into words and returns as a list
words = line.split()
for word in words:
@prajwal-stha
prajwal-stha / pratice-answer.py
Created March 29, 2019 01:05
Answer for Practice Question
def find_max_min_sales(min_max_sold_index):
foodItemIndex = ['Burger', 'Pizza', 'Coke','Fries', 'Cake']
try:
index = foodItemIndex[min_max_sold_index]
except IndexError:
pass
return index
file = open("sales_data-sales_data.csv", "r")
data = file.readlines()
@prajwal-stha
prajwal-stha / README.md
Created August 10, 2018 11:43 — forked from sixertoy/README.md
ES6 Tips & Tricks

JavaScript Tips

Array

  • Fill N
  • Flatten
  • Remove duplicates
  • Convert an NodeList to Array

Object

@prajwal-stha
prajwal-stha / README.md
Created June 29, 2018 01:21 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@prajwal-stha
prajwal-stha / debug.php
Created February 20, 2018 02:25
If you add this line to your functions.php and then open a page on your WordPress powered site, you will see every action and filter that is called. Of course it will be inline in all of your template and content and that may not be the best solution.
add_action( 'all', create_function( '', 'var_dump( current_filter());' ) );