Skip to content

Instantly share code, notes, and snippets.

View zahqresh's full-sized avatar
🏠
Working from home

Muhammad Hamza Qureshi zahqresh

🏠
Working from home
View GitHub Profile
@zahqresh
zahqresh / PY0101EN-3-1-Conditions.ipynb
Created September 18, 2019 04:44
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zahqresh
zahqresh / PY0101EN-3-1-Conditions.ipynb
Created September 18, 2019 04:44
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zahqresh
zahqresh / PY0101EN-3.2_notebook_quizz__Loops.ipynb
Created September 18, 2019 05:18
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
socket.emit - This method is responsible for sending messages. socket.on - This method is responsible for listening for incoming messages
@zahqresh
zahqresh / schedulejs
Last active September 17, 2020 10:36
JS task runner with setInterval there are two interval one runs every 10 seconds and then executes a function is your main task runner when that function is being executed and your tasks are running a check which is a boolean is set to true so it tells the other interval that major task runner function is running a task so dont call it now to ru…
//Major Function
const MajorLazer = async () => {
if(NumberOfTasks != 0){
//Set the check to true so interval which is running majorlazer fun become clear
//then don't run the majorlazer multiple times causing errors or makig multiple calls
check = true;
var count = 0;
var myTimer;

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@zahqresh
zahqresh / directions.md
Last active June 26, 2021 05:23 — forked from omushpapa/directions.md
Deploy Django App on Heroku

Requirements

Run pip install pipenv to install pipenv

Run pipenv shell to create an environment, if does not exist, and activate it.

Run pipenv install python_decouple whitenoise dj_database_url Pillow gunicorn May take a while.

This should create two files: Pipfile and Pipfile.lock. Keep them in the project root.

//Our custom function to add uri into annotations
var pageUri = function () {
return {
beforeAnnotationCreated: function (ann) {
ann.uri = window.location.href;
}
};
};
//Init Annotatorjs
var app = new annotator.App()
//Create annotations
app.post('/api/annotations/:name', (req, res) => {
//create a random id object for annotations
let id = uuidv4();
const {
qoute,
ranges,
text
} = req.body;
const {
app.get('/api/search/:name', (req, res) => {
const {
name
} = req.params;
db.find({ file_name: name }).then(doc => {
let annotations = [];
doc.forEach(n => {
annotations.push(n.rows);
});
res.json({