This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Imagine you are a pizza house owner, and you have only one oven to bake pizza. You have different types of pizza and they take different amount of time to baked. Whenever a customer comes in, you take his/her order and do the following steps | |
- If the oven is free, you immediately start baking the pizza. | |
- If the oven is busy, you add that task to a list. | |
- Whenever, a pizza is baked and server, you check the list of pending prder and picks up the one that will take the shortest amount of time to bake. | |
Given an 2D array of customer's arrival time and baking time of their pizza, calculate the minimum average waiting time for customers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.id,t.name from trainers as t | |
WHERE | |
NOT EXISTS ( | |
SELECT * FROM unavailabledates as ud WHERE ud.date="2020-11-25" AND ud.trainer=t.id | |
) | |
AND | |
EXISTS ( | |
SELECT * FROM schedules as s | |
WHERE | |
s.day="SUNDAY" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import moment from "moment"; | |
import styled from "styled-components"; | |
import CommentBox from "./CommentBox"; | |
const PostContainer = styled.div` | |
width: 100%; | |
margin: 30px auto; | |
border: 1px solid black; | |
box-sizing: border-box; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import styled from "styled-components"; | |
import axios from "axios"; | |
import Post from "./Post"; | |
import CommentBox from "./CommentBox"; | |
const Container = styled.div` | |
width: 80%; | |
margin: auto; | |
border: 1px solid black; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// XPath CheatSheet | |
// To test XPath in your Chrome Debugger: $x('/html/body') | |
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
// 0. XPath Examples. | |
// More: http://xpath.alephzarro.com/content/cheatsheet.html | |
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, bs4, math | |
import urllib.request | |
res = requests.get('https://www.adidas.ca/en/trefoil-tee/CW0703.html', headers={'User-agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36'}) | |
textFile = open('adidas.txt','w') | |
textFile.write(res.text) | |
textFile.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<EditText | |
android:id="@+id/written" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.umar.broadcasting_intent; | |
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.EditText; | |
public class MainActivity extends AppCompatActivity { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.umar.broadcasting_intent; | |
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.EditText; | |
public class MainActivity extends AppCompatActivity { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.umar.intent_internetconnection; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.View; | |
import android.widget.TextView; | |
import android.widget.Toast; |
NewerOlder