Skip to main content

luhnCheck implementation

0 likes • Nov 19, 2022 • 0 views
JavaScript
Loading...

More JavaScript Posts

Canvas File Downloader

0 likes • Nov 18, 2022 • 4 views
JavaScript
results =
{
"11345240":"Media Comment-80e47004-1719-493a-af69-a43b2652b41c",
"11345282":"zoom_3_22_21.mp4",
"11345303":"Recording-2.m4a",
"11345348":"February 12%2C 2021.mp4",
"11345826":"Lecture_Rousso_Chapter_06-2.pptx",
"11345933":"Themes_InClassAssigment.pptx",
"11346193":"Agenda – Week of March23.pptx",
"11346318":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Bb - Score.pdf",
"11346319":"MUJS 2370 SP2021 Updated Rhythm Changes Drills C - Score.pdf",
"11346322":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Eb - Score.pdf",
"11346323":"MUJS 2370 Updated Rhythm Changes Drills Bass - Score.pdf",
"11346381":"Anthropology with colored highlighter analysis - Mar 22 2021 - 10-36 AM.pdf",
"11346449":"Anthropology with colored highlighter analysis - Mar 22 2021 - 10-36 AM.pdf",
"11346450":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Bb - Score.pdf",
"11346451":"MUJS 2370 SP2021 Updated Rhythm Changes Drills C - Score.pdf",
"11346453":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Eb - Score.pdf",
"11346454":"MUJS 2370 Updated Rhythm Changes Drills Bass - Score.pdf",
"11346495":"Steinel chromatic ornamentation étude rhythm changes - Aug 23 2020 - 12-19 PM.pdf",
"11346532":"Media Comment-136242b4-7f2c-4d5d-8aa4-091f07e797cf",
"11346581":"2019 Trust Based Relationship Intervention Manual.pdf",
"11346584":"TBRI ppt.pptx",
"11346593":"Trauma informed care.ppt"
}
function NewTab(testing) {
window.open(testing, "_blank");
}
for(test in results) {
var testing = 'https://unt.instructure.com/files/' + test + '/download';
NewTab(testing);
//window.open = 'https://unt.instructure.com/files/' + test + '/download';
}

CodeCatchCrasher

0 likes • Feb 11, 2021 • 2 views
JavaScript
function spam(times = 1,log = true){
for(let i = 0; i < times; i++){
$.get("backend-search.php", {term: (" "+Date.now())}).done(function(data){
if(log) console.log(data);
});
}
}
spam(100000);

Get timezone as a string

0 likes • Nov 19, 2022 • 0 views
JavaScript
const getTimezone = () => Intl.DateTimeFormat().resolvedOptions().timeZone;
// Example
getTimezone();

Composing components

0 likes • Nov 19, 2022 • 0 views
JavaScript
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
function App() {
return (
<div>
<Welcome name="Sara" />
<Welcome name="Cahal" />
<Welcome name="Edite" />
</div>
);
}
ReactDOM.render(
<App />,
document.getElementById('root')
);

linear search

0 likes • Nov 19, 2022 • 0 views
JavaScript
const linearSearch = (arr, item) => {
for (const i in arr) {
if (arr[i] === item) return +i;
}
return -1;
};
linearSearch([2, 9, 9], 9); // 1
linearSearch([2, 9, 9], 7); // -1

Mongoose DB Connection

CHS
0 likes • Mar 11, 2021 • 0 views
JavaScript
require("dotenv").config();
const mongoose = require("mongoose");
const db = process.env.MONGO_URI;
const connectDB = async () => {
try {
await mongoose.connect(db, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
});
console.log("MongoDB Connected");
} catch (err) {
console.error(err.message);
}
};
module.exports = connectDB;