This file contains 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 { ICoordinates } from "../types"; | |
export const getIsWithinRange = ( | |
claimantCoordinates: ICoordinates, | |
reportCoordinates: ICoordinates | |
): boolean => { | |
const rangeRadius = 0.0008695277120173415; | |
const deltaLat = reportCoordinates.lat - claimantCoordinates.lat; | |
const deltaLng = reportCoordinates.lng - claimantCoordinates.lng; | |
const squareLegLat = Math.pow(deltaLat, 2); |
This file contains 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 { PrismaClient } from "@prisma/client"; | |
const prisma = new PrismaClient(); | |
async function removeOldReports() { | |
const activeReports = await prisma.report.findMany({ | |
where: { isActive: true }, | |
}); | |
const toDeactivateIdList = activeReports |
This file contains 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
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") | |
shadowDatabaseUrl = env("SHADOW_DATABASE_URL") | |
} | |
generator client { | |
provider = "prisma-client-js" | |
} |
This file contains 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
{ | |
"name": "script", | |
"license": "MIT", | |
"devDependencies": { | |
"nodemon": "^2.0.15" | |
}, | |
"scripts": { | |
"start": "ts-node ./server.ts", | |
"job:remove-old": "ts-node ./scripts/removeOldReports.ts" | |
}, |
This file contains 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
#include <SoftwareSerial.h> | |
SoftwareSerial SIM900(7, 8); | |
String testJSON="{ \"coordinateX\" : 0406, \"coordinateY\" : 1992, }"; | |
void setup() | |
{ | |
Serial.begin(19200); | |
This file contains 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
from flask import Flask, render_template, request, redirect, url_for, jsonify | |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import sessionmaker | |
from database_setup import Base, Restaurant, MenuItem | |
app = Flask(__name__) | |
engine = create_engine('sqlite:///restaurantmenu.db') | |
Base.metadata.bind = engine |
This file contains 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 sys | |
from sqlalchemy import Column, ForeignKey, Integer, String | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import relationship | |
from sqlalchemy import create_engine | |
Base = declarative_base() | |
This file contains 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
const api = "http://localhost:3001" | |
// Generate a unique token for storing your bookshelf data on the backend server. | |
let token = localStorage.token | |
if (!token) | |
token = localStorage.token = Math.random().toString(36).substr(-8) | |
const headers = { | |
'Authorization': token |
This file contains 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
// | |
// main.c | |
// fleury_algorithm | |
// | |
// Created by Henrique de Almeida on 10/12/2018. | |
// Copyright © 2018 Henrique de Almeida. All rights reserved. | |
// | |
//Graph | |
//6 9 |
This file contains 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
// | |
// main.cpp | |
// enigma | |
// | |
// Created by Henrique de Almeida on 27/10/2018. | |
// Copyright © 2018 Henrique de Almeida. All rights reserved. | |
// | |
#include <iostream> |
NewerOlder