blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 3 236 | src_encoding stringclasses 29
values | length_bytes int64 8 7.94M | score float64 2.52 5.72 | int_score int64 3 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 8 7.94M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
9952f5fc660e55ae3b7e41ff3565e79532034372 | JavaScript | thejohnyu/coderust | /coderbyte/subset.js | UTF-8 | 844 | 3.84375 | 4 | [] | no_license | function ArrayAdditionI(arr) {
// get largest number and remove it from array
var sum = Math.max.apply(null, arr);
arr.splice(arr.indexOf(sum), 1);
// power set
var sets = [[]];
let totalParent = 0;
let totalChild = 0;
// generate the power set and for each new set
// check if the temporary sum equal... | true |
e1471ab5fbcd70b5e245553394c927475019cf5f | JavaScript | MichaelPaulukonis/ditherer | /src/filters/grayscale.js | UTF-8 | 962 | 2.546875 | 3 | [
"MIT"
] | permissive | // @flow
import { cloneCanvas, fillBufferPixel, getBufferIndex } from "utils";
export const optionTypes = {};
export const defaults = {};
const grayscale = (input: HTMLCanvasElement): HTMLCanvasElement => {
const output = cloneCanvas(input, false);
const inputCtx = input.getContext("2d");
const outputCtx = ou... | true |
e1ed56a24fb4b79ac65826d068219ea1416add55 | JavaScript | williambutacu/part4 | /tests/part2.test.js | UTF-8 | 4,211 | 2.8125 | 3 | [] | no_license | const mongoose = require("mongoose")
const supertest = require("supertest")
const app = require("../app")
const Blog = require("../models/blog")
const listhelper = require("../utils/list_helper")
const api = supertest(app)
beforeEach( async()=>{
await Blog.deleteMany({})
let blogObject = new Blog(listhelper.... | true |
8044d663fd9bc6f8c66969312dd1c2f165610dd0 | JavaScript | abhishekSen999/Mass-Video-Downloader | /extension/videos.js | UTF-8 | 1,058 | 2.609375 | 3 | [] | no_license | // export const VIDEO_ADDED_EVENT = 'video-added';
const state = {
video_links: [],
//listeners: {},
}
export default{
addVideos(urls) {
urls.forEach((url)=>{
state.video_links.push(url);
});
// console.log("firing");
// this.fire('videos-added');
},... | true |
63dde38b1d98e6ad4da7755ffff5cc50015356e2 | JavaScript | louisse/FlappyBird | /sketch.js | UTF-8 | 585 | 2.65625 | 3 | [] | no_license | let b;
let pipes;
let G = 0.4;
let groundHeight = 25;
function setup() {
createCanvas(600, 400);
reset();
}
function reset() {
b = new Bird(height / 2);
pipes = new Pipes();
}
function draw() {
drawStage();
pipes.update();
b.update();
pipes.show();
b.show();
}... | true |
033adfcf53b1b59abcb3381ff7f0ce7dc584ea32 | JavaScript | fozy81/form-builder | /public/assets/js/add_item.js | UTF-8 | 4,161 | 3 | 3 | [
"Apache-2.0"
] | permissive | // find results and dislay in div id="results"
import { renderNav } from '/assets/js/components/navbar.js'
var $addForm = document.querySelector('#add_project')
var $subtitle = document.querySelector('#subtitle')
var locationHash = window.location.hash.replace('#', '')
/**
* With hoodie we're storing our data locally... | true |
b4243ac7946353b9d482db671a1ed2238196d381 | JavaScript | earthday-lim/product_page | /js/detail.js | UTF-8 | 5,288 | 3.25 | 3 | [] | no_license | $(document).ready(function(){
var $price = $(".pd_price span").text();//ํ์ฌ์ ๊ฐ๊ฒฉ์ ๋ณด๋ฅผ ์ ์ฅ & typeof์ฒดํฌ
console.log("ํ์ฌ์ ๊ฐ๊ฒฉ์ ์๋ณธ ์ ๋ณด : "+$price);
console.log("ํ์ฌ์ ๊ฐ๊ฒฉ์ ์๋ณธ ์ ๋ณด์ type : "+ typeof $price);//๋ฌธ์๋ฐ์ดํฐ
var $origin_price = $price.replace(",", "");//,๋ฅผ ์ ๊ฑฐํ๊ณ ์๋ณธ์ ์์ํ ์ซ์๋ง ์ ์ฅ
console.log("์ซ์์ ๋ณด์ ๊ฐ : "+$o... | true |
074ddda106bd8db7885100086c6891203ef8bd0a | JavaScript | Orifiel/Curso_Udemy_Web2020 | /controles/switch.js | UTF-8 | 574 | 3.625 | 4 | [] | no_license | const imprimirResultado = function (nota) {
switch (Math.floor(nota)) {
case 10:
case 9:
console.log('Quadro de Honra')
break
//para que seja executado apenas um case atendendo a condiรงรฃo
case 8: case 7:
console.log('Aprovado')
break
cas... | true |
1c6afeec002a37c44e175377577ccb6b580bed4b | JavaScript | gregschmit/rest-scaffold | /src/helpers/actions/record.js | UTF-8 | 4,736 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* This module implements action links.
*/
import U from '../../utils.js';
/*
* Add actions and return HTML list items for each.
*/
function addRecordActionHelpers(scaffold) {
/* create record helper */
scaffold.createRecord = function(formElement) {
/* show the spinner for status */
$(this.spinne... | true |
f58308263eec27b3baf0730ac64b36b8f4830044 | JavaScript | omartemirgali/Module_5 | /scripts/task_1.js | UTF-8 | 255 | 3.671875 | 4 | [] | no_license | let n = prompt('Enter: ');
let m = +n;
if('number' === typeof m && !isNaN(m)) {
if (m % 2 === 0) {
console.log('Even');
} else {
console.log('Odd');
}
} else {
console.log('ะฃะฟั, ะบะฐะถะตััั, ะฒั ะพัะธะฑะปะธัั');
} | true |
f4c0e989ad936adbbc95b4c7970566eabb575bfa | JavaScript | AmilAbdullazadeh/intro_webpack | /src/index.js | UTF-8 | 5,731 | 3.4375 | 3 | [
"MIT"
] | permissive | import "../assets/main.scss";
// Vanila JavaScript todo list app
var taskInput = document.getElementById("new-task"); // New-task
var addButton = document.getElementsByTagName("button")[0]; // First button
var incompleteTasksHolder = document.getElementById("incomplete-tasks"); // I... | true |
74032ef6f4bff302f3ef502018ea711ac8f6c882 | JavaScript | courtneymcallister/table-creator | /public/js/app.js | UTF-8 | 3,665 | 2.890625 | 3 | [] | no_license | $(document).ready(function(){
const table = document.getElementById('table');
$('#table').hide();
$('.showHtmlField').hide();
$('.clearTable').hide();
$('.alignmentOptions').hide();
$(".createTable").click(function(){
table.innerHTML = "";
//get user inputs
var rows = $('#rows').val();
va... | true |
1f4300037e52a7539f6e00bf6e68f967ad50b5f3 | JavaScript | protodave/sonic-earth | /js/main.js | UTF-8 | 8,836 | 3.046875 | 3 | [
"MIT"
] | permissive | // couple of constants
var POS_X = 1800;
var POS_Y = 500;
var POS_Z = 1800;
var WIDTH = 1000;
var HEIGHT = 600;
var FOV = 30;
var NEAR = 1;
var FAR = 4000;
var quakeData;
// some global variables and initialization code
// simple basic renderer
var renderer = new THREE.WebGLRenderer();
renderer.setSize(WIDTH, HEIGHT... | true |
8245ec39770a7d11217ad10fe8420f3d9077104c | JavaScript | ympek/graphviz | /EdgeSet.js | UTF-8 | 845 | 3.4375 | 3 | [] | no_license | /* exported EdgeSet */
class EdgeSet {
constructor() {
this.edges = {};
}
hash(pair) {
pair.sort(this.compareNumbers);
return pair.join("_");
}
compareNumbers(a, b) {
return a - b;
}
deleteBetween(v1, v2) {
let edge = [v1, v2].sort(this.compareNumbers)
let hash = this.hash(edge)... | true |
160257348d65e99754140c431f52f81dd35b34ff | JavaScript | ben-hunter-hansen/RedditChatAPI | /routes/authorize.js | UTF-8 | 1,527 | 2.609375 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var RedditAPI = require('../api/RedditApi.js');
/**
* RedditChat Auth API
*
* Manages the user authentication process for Reddit OAuth2.
* Exposes endpoints to the front end that allow the user action
* required by reddit's api.
*/
/**
* Get... | true |
edf6b96483a7d6dc29598aea0ab32320edae6f2c | JavaScript | ClarkHo/h5 | /core/src/common/money.js | UTF-8 | 788 | 2.875 | 3 | [] | no_license | /**
* Created by dcl on 2016/7/30.
*/
import Vue from "vue";
/**
* ๆ ผๅผๅ้้ข
* ๅ ๅ
ฅhtmlๅ
็ด ๆพ็คบ็นๆฎๆ ทๅผ
*
* ไพๅญ๏ผ<div v-money="pro.price"></div>
* ็ปๆ๏ผ<div>๏ฟฅ<span class="mainprice">1550</span>.00</div>
*/
function currency(value) {
value = parseFloat(value);
if (!isFinite(value) || !value && value !== 0) return '';
... | true |
513d7a8c0e78398ba1e2df1e79318c6df85bb6c2 | JavaScript | NatashaTroth/MyOnlineWallet | /src/js/pages/renderAbout.js | UTF-8 | 4,391 | 3.046875 | 3 | [] | no_license | /*eslint-disable */
import { h } from "jsx-dom"
/*eslint-enable */
import { hideMain } from "./hideMainGlobal"
export function renderAbout() {
let main = document.querySelector("main")
hideMain()
main.appendChild(
<article class="about__article media-block">
<h1 class="about__article__h1">About</h1>
<p clas... | true |
71f684889eab02291c44f67b7acb444cab802169 | JavaScript | IEEE-UH-Manoa/hanabot | /scripts/events.js | UTF-8 | 1,987 | 3.40625 | 3 | [
"MIT"
] | permissive | var http = require('http');
module.exports = function(robot) {
robot.respond(/events/i, function(msg){
//The url we want is: 'www.random.org/integers/?num=1&min=1&max=10&col=1&base=10&format=plain&rnd=new'
var options = {
host: 'api.ieeeatuhm.com',
path: '/events-upcoming'
... | true |
23f3551bab9b5aadfdd5cdd046dd1fd8a06f54f6 | JavaScript | fcesnek/code-wars-katas | /TriangularNumberSum.js | UTF-8 | 782 | 3.921875 | 4 | [] | no_license | /**
* https://www.codewars.com/kata/580878d5d27b84b64c000b51
* @param {Number} n nth number
* @return {Number} sum
*/
function sumTriangularNumbers(n) {
let sum = 0;
for (let i = 1; i <= n; i++) {
sum += (i*(i+1)/2);
}
return sum;
}
/**
* https://www.codewars.com/kata/580878d5d27b84b64c000b51
* @par... | true |
4e551435b563bb5423a21cea9fb8e5148bf330d8 | JavaScript | SultanRayhan32/REMIDIFRONTEND | /src/Component/Tablemovies.js | UTF-8 | 3,235 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
class Tablemovies extends Component {
state = {list : [] , editgak : 0}
componentDidMount(){
axios.get('http://localhost:1946/list')
.then((res)=>{
this.setState({list : res.data})
})
}
onBtnAddC... | true |
470816b5053c8193a17f9aeda3e2956b22fbb32a | JavaScript | youseop/NeverEndingStory | /server/routes/thumbsup.js | UTF-8 | 1,843 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const { Game } = require('../models/Game');
const {ThumbsUp} = require("../models/ThumbsUp");
const { getThumbsUp } = require('./functions/thumbsup');
router.get('/:objectId/:userId', async (req,res) => {
con... | true |
2efed2dc950812b1d4e4b498c758d054d1ae5a0f | JavaScript | tyrmand/sit-on-chair | /js/app.js | UTF-8 | 4,614 | 3.484375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() { // po zaลadowaniu dookumentu wywoลujemy funkcjฤ
// SLIDER
var prevPicture = document.getElementById('prevPicture'); // wyszukujemy i pobieramy do zmiennej element o identyfikatorze 'prevPicture'
var nextPicture = document.getElementById... | true |
0816f4616e41eb712f2eb40872e59debf1426929 | JavaScript | pentamania/native-fs-sample | /main.js | UTF-8 | 1,951 | 2.765625 | 3 | [] | no_license | import { openFile, saveFile, isNativeFileSystemSupported } from "./nfs-utils.js";
import { addLog } from "./logger.js";
const nativeFSSupported = isNativeFileSystemSupported();
let globalFSHandle;
// ใญใผใใผใใคใใณใๅฎ็พฉ
document.addEventListener("keydown", async (e) => {
if (e.ctrlKey && e.shiftKey && e.code === "KeyS") {
... | true |
9dd0c02796c00921e79305538d921261c11c41b1 | JavaScript | MDunitz/AuthBoilerplate | /controllers/authentication.js | UTF-8 | 2,345 | 2.953125 | 3 | [] | no_license | const User = require('../models/user');
//use jwt library to take the user ID + secret string -> JSON Web Token (jwt)
const jwt = require('jwt-simple');
//get the secret we created
const config = require('../config');
//put in logic for creating a token
//pass in user model
function tokenForUser(user){
//when this... | true |
16d73abcb6ab2196d331889ef24e74d202e8b502 | JavaScript | sansahamdi/projet-fin-d-etude | /routes/situation.js | UTF-8 | 1,114 | 2.703125 | 3 | [] | no_license | const express = require('express');
const { check, validationResult } = require('express-validator');
const Situation = require('../models/Situation');
const router = express.Router();
//http://localhost:4000/api/situation
// @route Post /api/situation
// @desc Post situation
// @access Private
router.post(
'/',
... | true |
c95adc031cec734c1cdd033caf461fc70484b868 | JavaScript | Wayne-Bai/AST-normalize | /data/FullScreenShenanigans/FullScreenPokemon/GameStartr/InputWritr/InputWritr.js | UTF-8 | 21,193 | 3.03125 | 3 | [] | no_license | /**
* InputWritr.js
*
* A general utility for automating interactions with user-called events linked
* with callbacks. Pipe functions are available that take in user input, switch
* on the event code, and call the appropriate callback. These Pipe functions
* can be made during runtime; further utilities allow ... | true |
cee03eff2dba712ca0e55e0b2d0cfb9d32968507 | JavaScript | iBiziness/iBusiness.sa | /js/contact.js | UTF-8 | 1,921 | 2.8125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | $(document).ready(function () {
$('.error').hide(); //Hide error messages
$('#main-result').hide(); //we will hide this right now
$('#form-wrapper').show(); //show main form
$('.contact-btn').click(function () { //User clicks on Submit button
// Fetch data from input fields.
va... | true |
80eb02b7117e83ef0705a69e34961abd54d2ab2d | JavaScript | Ellyll/MuffinPatterns | /lines_and_circles.js | UTF-8 | 831 | 3.15625 | 3 | [] | no_license | function do_lines_and_circles() {
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var patterns = [];
patterns = patterns.concat(get_graph_thing(canvas, 16));
patterns = patterns.concat(get_circle_thing(canvas));
var canvasRenderer = new CanvasRenderer();... | true |
5b5cf60af62285f189573bd448be59ca9bfeec8e | JavaScript | miltonarce/veton | /front/src/Components/Appointments/AppointmentHourPicker/index.js | UTF-8 | 1,368 | 2.671875 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
import { FormControl, InputLabel, MenuItem, Select, FormHelperText } from "@material-ui/core";
const AppointmentHourPicker = ({ hours, onHourChange, label }) => {
const [hour, setHour] = React.useState("");
/**
* Handle when user select any h... | true |
202356494c1ef36926075505b735fb843eee2e7a | JavaScript | GiuntaJC/haiku-checker | /__tests__/haiku.test.js | UTF-8 | 629 | 2.640625 | 3 | [
"MIT"
] | permissive | import Haiku from './../src/haiku.js';
// import syllable?
describe('Haiku', () => {
let reusableHaiku;
beforeEach(() => {
reusableHaiku = new Haiku("An ocean voyage.", "As waves break over the bow, ", "the sea welcomes me.");
});
test('should correctly create a haiku object', () => {
expect(reusable... | true |
57a06ca456122188739af62f5195733796dead91 | JavaScript | xianghui/is3106-app-new | /src/containers/NoteApp.js | UTF-8 | 2,757 | 2.890625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import api from "../helpers/api";
import NoteForm from "../components/NoteForm";
import NoteList from "../components/NoteList";
function NoteApp() {
//used to capture the notes
//the next id to use will be currentId + 1
//since we are most likely updating the n... | true |
4b62955ab1666104384c2e363341169f49cdc8c1 | JavaScript | zoh/translate.io | /common/gun.export.js | UTF-8 | 1,032 | 2.59375 | 3 | [] | no_license | const _ = require('lodash');
/**
*
* @param gun
* @param gunNode
* @param result
* @returns {Promise<void>}
*/
export async function makeTreeJSON(gun, gunNode, result = {}) {
for (let key in gunNode) {
if (key === '_') {
continue
}
const el = gunNode[key];
if (typeof el === 'object' && '#... | true |
768ec62683a755316c2805b5bb5e9e725bb8bccd | JavaScript | NiklasBr/ROT-n | /rot.js | UTF-8 | 1,183 | 3.53125 | 4 | [
"MIT"
] | permissive | /**
* @fileOverview Experiment in writing a ROT de-obfuscator. Inspired by Combitech's challenge.
*
* @author Niklas Brunberg <niklas@lynks.se>
*
*/
"use strict";
/**
* Steps every character one step in a ROT carousel.
* @param {number} index_rot number of steps, will wrap around if reaches max
*
*... | true |
7b6f9e265b4d146551b293d4ede360a64986726b | JavaScript | yash3199/dicegame | /index.js | UTF-8 | 548 | 3.484375 | 3 | [] | no_license | var n1=Math.random();
n1=(n1*6);
n1=Math.floor(n1) + 1;
var imagesource1=("images/dice" + n1 + ".png")
var n2=Math.random();
n2=(n2*6);
n2=Math.floor(n2) + 1;
var imagesource2=("images/dice" + n2 + ".png")
document.querySelectorAll("img")[0].setAttribute("src",imagesource1);
document.querySelectorAll("img")[1]... | true |
a38defb18f02863a7644acc677e27dd6fa1f70f7 | JavaScript | taknalut/TriviaGame | /assets/javascript/app.js | UTF-8 | 4,657 | 3.140625 | 3 | [] | no_license | // Declare global variables
var triviaArr = ["q1", "q2", "q3", "q4", "q5"];
var triviaObj = {
q1: { question: "What is Earth's largest continent?", choices: ["ANTARCTICA", "AFRICA", "ASIA", "EUROPE"], answer: 3, correct_img:'assets/images/asia.jpg'},
q2: { question: "What country has the most natural lakes?", choic... | true |
accd8dd943b1f604a0cfe97e7f4ca7921f1f8758 | JavaScript | khalilcodes/Algos-DS | /question5.js | UTF-8 | 306 | 3.421875 | 3 | [] | no_license | var readlineSync = require('readline-sync');
var x = Number(readlineSync.question("enter number to divide: "));
var y = Number(readlineSync.question("enter divide by number: "));
function f() {
var a = Math.floor(x/y);
var b = Math.floor(a*y);
var c = Math.floor(x-b);
console.log(c);
}
f(); | true |
cde13f0bd41b297d3cd877de4f43ec30163fb411 | JavaScript | A1rPun/AdventOfCode | /2016/day_02/solution.js | UTF-8 | 1,598 | 3.15625 | 3 | [] | no_license | import Vector from '../../js/vector.js';
var keypad = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
var keypadBathroom = [
[null, null, 1, null, null],
[null, 2, 3, 4, null],
[5, 6, 7, 8, 9],
[null, 'A', 'B', 'C', null],
[null, null, 'D', null, null],
];
var directions = {
U: [0, -1],
R: [1, 0],
D: [0, 1... | true |
74e186825653e8acec48aaa976707ad598eb4e47 | JavaScript | mervatyo/authentication-workshop | /src/controllers/auth.js | UTF-8 | 2,984 | 2.65625 | 3 | [] | no_license | const bcrypt = require("bcrypt");
const jwt = require("jsonwebtoken");
// use these functions to manipulate our database
const { findByUsername, addNewUser } = require("../models/users/User.model");
exports.loginPage = (req, res) => {
res.render("login", { activePage: { login: true } });
};
exports.registerPage = ... | true |
770cfeb9608bc73ae285b86eb57a8c7c0260c7b3 | JavaScript | osartun/ui-extensions-sdk | /lib/api/window.js | UTF-8 | 1,089 | 2.703125 | 3 | [
"MIT"
] | permissive | export default function createWindow (channel) {
let autoUpdateHeight = () => { self.updateHeight() }
let observer = new MutationObserver(autoUpdateHeight)
let oldHeight = null
let isAutoResizing = false
let self = {startAutoResizer, stopAutoResizer, updateHeight}
return self
function startAutoResizer (... | true |
e96e05cc41411ea6c4d014db8f6a32d50b4447a9 | JavaScript | milleymilli/js-exercises-tdd | /I.pass-tests/07-second-largest/second-largest.js | UTF-8 | 142 | 2.640625 | 3 | [] | no_license | function secondLargest(numbers) {
var orderedNum = numbers.sort((a, b) => b - a);
return orderedNum[1];
}
module.exports = secondLargest;
| true |
7f24190e38a9a8456ee4a8903df6217ba30ca1bc | JavaScript | brijGit/Training-Management-System | /css/2_column_replace_divs.js | UTF-8 | 1,171 | 3.1875 | 3 | [] | no_license | // JavaScript Document
function clearOld (absoluteDivName) {
// hides a div and absolutely positions it outside of the viewable area of the page.
var absoluteDiv = document.getElementById(absoluteDivName);
absoluteDiv.style.visibility = 'hidden';
absoluteDiv.style.overflow = 'hidden';
absoluteDiv.style.display = '... | true |
4ca5284b60f3f57546d6de94fa3753bb741fcbde | JavaScript | vadramson/quickserve | /QuickServe/static/src/js/reportsData.js | UTF-8 | 24,985 | 2.609375 | 3 | [
"MIT"
] | permissive |
$(document).ready(function(){
$.ajax({
url:"/quickserve/api/reports/attendance/",
method:"GET",
success: function(data){
console.log('Attendace Here');
console.log('Attendace Here');
console.log(data);
var labels = [];
var default... | true |
83e1fe5549be7b550e561facfdbbad222732c61a | JavaScript | code16/sharp | /resources/assets/js/vendor/vue2-google-maps/utils/simulateArrowDown.js | UTF-8 | 1,173 | 2.5625 | 3 | [
"MIT"
] | permissive | // This piece of code was orignally written by amirnissim and can be seen here
// http://stackoverflow.com/a/11703018/2694653
// This has been ported to Vanilla.js by GuillaumeLeclerc
export default (input) => {
var _addEventListener = (input.addEventListener) ? input.addEventListener : input.attachEvent
function ... | true |
71ca87ffe46194952ac043c7e446e75d25f25c29 | JavaScript | mokaymokay/coding-challenges | /javascript/urlify.js | UTF-8 | 567 | 4.1875 | 4 | [] | no_license | // Write method to replace all spaces in string with '%20'. You may assume that
// the string has sufficient space to hold the additional characters, and you are
// given the "true" length of the string.
// - INPUT: urlify("Mr John Smith ", 13);
// - OUTPUT: "Mr%20John%20Smith"
const urlify = (str, strLength) => {
... | true |
4686f24d2621fe52021ce4f28c0fa4a8a497bf0a | JavaScript | mostafa-jamali/all-country-APIs | /jQuery.js | UTF-8 | 3,528 | 2.578125 | 3 | [] | no_license | $(document).ready(function () {
// ............................... map API 1 .............................
let app = new Mapp({
element: '#map',
presets: {
latlng: {
lat: 35,
lng: 56,
},
zoom: 6
},
apiKey: 'eyJ0eXAiOiJKV1Q... | true |
25e4a98ca86b667007ee5f87854a89d329bf5b8e | JavaScript | Codex-/queue | /test/end.js | UTF-8 | 658 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var tape = require('tape')
var queue = require('../')
tape('end', function (t) {
t.plan(3)
var q = queue()
q.push(function (cb) {
setTimeout(cb, 0)
})
q.push(function (cb) {
setTimeout(function () {
t.equal(q.length, 2)
q.end(new Error('fake error'))
setTimeout(function () {
... | true |
78e2a3fdf0705d21ac389695533450f53d2c4e1d | JavaScript | archanabansal88/hacker-rank | /algorithms/Dynamic Programming/The Maximum SubArray/solution.js | UTF-8 | 594 | 3.3125 | 3 | [] | no_license | function maxSubarray (arr) {
// Complete this function
var sum = 0,
maxSum = arr[0],
subSum = 0
if (arr.length === 1) {
return [arr[0], arr[0]]
}
for (var i = 0; i < arr.length; i++) {
sum += arr[i]
if (sum < arr[i]) {
sum = arr[i]
}
if (maxSum < sum) {
maxSum = sum
... | true |
d85566f9ca521d4029f1dab2936e553d76c69bcd | JavaScript | kpolgar/leet-code | /problem-0231-power-of-two.js | UTF-8 | 657 | 4.125 | 4 | [] | no_license | /*231. Power of Two
Given an integer, write a function to determine if it is a power of two.
Example 1:
Input: 1
Output: true
Explanation: 20 = 1
Example 2:
Input: 16
Output: true
Explanation: 24 = 16
Example 3:
Input: 218
Output: false*/
/*STATS Runtime: 72 ms, faster than 75.26% of JavaScript online submissions... | true |
b4fd391e8256d918583e2f2e50888bb7ab296bf8 | JavaScript | shubham-shinde/Rapid-Es6 | /Demos/Scripts/module2/module2.23.js | UTF-8 | 151 | 2.9375 | 3 | [] | no_license | 'use strict';
let cat = {
age: 4,
sound:'meww',
makeSound:function(){
return () => console.log(this.sound);
}
};
console.log(cat.makeSound()());
| true |
fa54e0a8a2e45218c69f7aa3c1cd87db0363f2c8 | JavaScript | brobin665/SpatialAnalysis | /js/main.js | UTF-8 | 3,209 | 2.625 | 3 | [] | no_license | //Brian Robinson Geog 777 6/2017 Capstone in Geography
function createMap(){
var map =L.map('map').setView([44.76,-90.07],7);
//Create layer variables
var cr =new L.geoJson();
var nr =new L.geoJson().addTo(map);
var lr =new L.geoJson();
//call function to retrieve data
getData(lr, cr, nr);
L.tileLayer('h... | true |
95ac1c24a93aa4ae0b5bfa027edb9f3d276900c4 | JavaScript | serviktor050/iamtoday-app-AA-fix-changes-in-texts-april | /src/modules/Calendar/utils.js | UTF-8 | 2,313 | 2.78125 | 3 | [] | no_license | import moment from 'moment';
import { DAY, MONTH, SEVEN_DAYS, WEEK } from './constants';
import { capitalize } from 'modules/utils';
import * as R from 'ramda';
export function getWeekWithOffset(weekOffset = 0) {
const currentDate = moment();
const weekStart = currentDate.clone().startOf('isoWeek').add(weekOf... | true |
374dee93977dce7eaf1b2372e7707256cce19ab9 | JavaScript | beneater/khan-exercises | /utils/math.js | UTF-8 | 12,171 | 3.234375 | 3 | [
"MIT"
] | permissive | jQuery.extend(KhanUtil, {
// Simplify formulas before display
cleanMath: function( expr ) {
return typeof expr === "string" ?
KhanUtil.tmpl.cleanHTML( expr )
.replace(/\+ -/g, "- ")
.replace(/- -/g, "+ ")
.replace(/\^1/g, "") :
expr;
},
// A simple random number picker
// Returns a random in... | true |
9f4920c3774b0c07ab79a9b9f1b969803189c9da | JavaScript | alexsotocx/DesignAndAnalisisOfAlgorithms1 | /divide-and-conquer/binary_search.js | UTF-8 | 1,139 | 3.5625 | 4 | [] | no_license | var BinarySearch = {
search: function(array, number) {
/**
By master method
T(n) <= aT(n/b) + O(n^d)
T(n) <= 1T(n/2) + O(1)
The binary search uses case 1 if the master method
* a = b^d
* 1 = 2^0
* The case 1 states that n^d Log n will be the running time
* So the running time of binarySe... | true |
5c21ee7f947f4fa8ad3c8ca2c5b47ea3ef256de9 | JavaScript | bobbydwise1/dcc-20190722 | /scripts.js | UTF-8 | 682 | 4.0625 | 4 | [] | no_license | /*
Good morning! Here's your coding interview problem for today.
This problem was asked by Apple.
Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds.
*/
const randomFunction = () => {
console.log('button clicked')
return true;
}
const jobSched = (f, n) => {
... | true |
ba7aeadefa8c91df27e28b58ec612594bdf7469f | JavaScript | MarcusRobinson928/toDo-mongoDb | /public/js/app.js | UTF-8 | 1,861 | 2.875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | $(function () {
render = function () {
$.ajax({ url: '/todo', method: 'GET'})
.then(function (data) {
todoStr = '';
data.forEach(element => {
todoStr += `<li>${element.todo}</li>`;
todoStr += `<div class="listButtons">`;
todoSt... | true |
48bb7d6cd9db415cdf870a8431e7839413364431 | JavaScript | NietoCurcio/Confusion-REST-API-Server | /bin/www | UTF-8 | 3,123 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app')
var debug = require('debug')('confusionserver:server')
var http = require('http')
const https = require('https')
const fs = require('fs/promises')
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(proce... | true |
c167d0b81656d68604f5e587f8740cb2bf12aa70 | JavaScript | ankuraga1508/Home-Service | /HomeServiceApp/HSMUI/js/manageService.js | UTF-8 | 3,366 | 2.6875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
var select = document.getElementById("serviceName");
//Getting current service data from backend and populating the values on the page.
$.ajax({
type: "GET",
url: "api/service/services",
dataType: "json",
success: function (data) {
... | true |
25c22ee38e86a05f81e55927e95e727e89c2306f | JavaScript | HadriDreamwalker/PixiJs_FirstProject | /Chapter2/scripts/main.js | UTF-8 | 7,997 | 2.796875 | 3 | [] | no_license | ///////////////////////////
// Declaration des alias //
///////////////////////////
let TextureCache = PIXI.utils.TextureCache;
let autoDetectRenderer = PIXI.autoDetectRenderer;
let loader = PIXI.loader;
let resources = PIXI.loader.resources;
let Sprite = PIXI.Sprite;
let Rectangle = PIXI.Rectangle;
let Textur... | true |
fb1a8a19d9d3ffd0dae5f73cae4ae041238c8e63 | JavaScript | sergiodxa/isomorphic-react-todo | /views/app.jsx | UTF-8 | 1,539 | 2.515625 | 3 | [
"MIT"
] | permissive | import Layout from './layout.jsx';
import React from 'react';
import Todo from '../components/todo.jsx';
import xhr from 'promised-xhr';
const App = React.createClass({
getInitialState() {
const todos = this.props.todos;
return { todos };
},
createTodo: async function (e) {
try {
e.prev... | true |
95b3308f7bf6e6b77eebd46194662cbb6cfe6079 | JavaScript | andry9995/intranet | /src/RevisionBundle/Resources/public/js/images/graphes.js | UTF-8 | 14,487 | 2.5625 | 3 | [] | no_license | /**
* Graphes
*/
$(function() {
function _export(type) {
var graphe = $('#graphe');
if (graphe.highcharts() == undefined) {
show_info("Echec d\'exportation", "Graphe vide", "error");
return false;
}
else{
switch(type) {
case 0:
graphe.highcharts()
.pri... | true |
2df8731d4be46729c018ace6bce26c87ec80464a | JavaScript | daticahealth/Datica-V3 | /statamic/resources/js/l10n/l10n.js | UTF-8 | 730 | 2.734375 | 3 | [
"CC0-1.0"
] | permissive | // Bring in the Lang library
import Lang from './lang';
window.translate = function(key, replacements) {
var message = Lang.get(key, replacements);
if (message === key) {
return makeTitle(message.replace('cp.', ''));
}
return message;
};
window.translate_choice = function(key, count, replace... | true |
617338415dd5ae5e8184aad0ca66894c125bae63 | JavaScript | IRAKLY/library | /js/main.js | UTF-8 | 8,530 | 2.984375 | 3 | [] | no_license | (function() {
window.onload = function() {
var form = document.getElementById('form');
var addBookForm = document.getElementById('addBookForm');
var editBookList = document.getElementById('editBookList');
var removeBookList = document.getElementById('removeBookList');
var listBooks = document.getElementById(... | true |
a8dddfac4a4bdab985677c2db34f2369bc8831f3 | JavaScript | iroy2000/backbone-tutorial | /www/js/app/views/demo/ListView.js | UTF-8 | 3,053 | 2.9375 | 3 | [
"MIT"
] | permissive | // This is just a Demo Testing View
// This is how you define a RequireJS module
define(['text!templates/demo/data_row.html', 'text!templates/demo/container.html'],function(DataRowTemplate, ContainerTemplate) {
// this is the view for each item in the List
var ViewItem = Backbone.View.extend({
tagName:... | true |
505b422fdaa425d6ba09c700eef92f00232bd145 | JavaScript | sjolinjohan180/scrumlet | /scripts/views/task/addtaskview.js | UTF-8 | 2,052 | 2.78125 | 3 | [] | no_license | define(['jquery', 'underscore', 'backbone', 'task'], function($, _, Backbone, Task){
return Backbone.View.extend({
className: 'well',
template: _.template( $('#addTaskTemplate').html() || '' ),
//Construct
initialize: function(opts){
// If no task is provided at initialization, create one.
this.task = o... | true |
fb3a676adc028cf4bdd9ca883610b2370a0d1119 | JavaScript | Golodhros/js-jumpstart | /design-patterns/factory/factory-function.js | UTF-8 | 478 | 3.46875 | 3 | [] | no_license | // Reference: https://www.patterns.dev/posts/factory-pattern/
const createUser = ({ firstName, lastName, email }) => ({
firstName,
lastName,
email,
fullName() {
return `${this.firstName} ${this.lastName}`;
},
});
const user1 = createUser({
firstName: "John",
lastName: "Doe",
ema... | true |
b9b9e86138ee3feb503d0713198a00629b34da7f | JavaScript | hope-crichlow/Python | /ajax/ajax_flask/puppy_play_date/flask_app/static/site.js | UTF-8 | 2,306 | 3.53125 | 4 | [] | no_license | function getUsers() {
fetch("http://localhost:5000/users")
.then((res) => res.json())
.then((data) => {
var users = document.getElementById("users");
for (let i = 0; i < data.length; i++) {
let row = document.createElement("tr");
let name = document.createElement("td");
name.innerHTML = data[i].... | true |
5f62716e14732a3642e71d3fba1fc53f3b463724 | JavaScript | akuk/sl-test | /db.js | UTF-8 | 1,950 | 2.71875 | 3 | [] | no_license | /*
Mock DB with async calls to enable easy integration with an actual DB.
*/
'use strict';
const _ = require('underscore');
var store = {
// table of users containing courses and sessions data
user_stats: {}
};
// user: { courses: { sessions: { } } }
const DB = module.exports = {};
/*
Store session stats for... | true |
5c3229783ad87a1b8a1ab5ec6528d85f6b2b0eb1 | JavaScript | luop90/node-logstf | /index.js | UTF-8 | 1,743 | 2.734375 | 3 | [
"MIT"
] | permissive | const request = require('request');
const fs = require('fs');
var Logs = {};
/**
* POSTs a file to logs.tf
* @param {OBJECT} data
* @param {FUNCTION} callback
*/
Logs.uploadLogFile = function (data, callback) {
if (!data || typeof data === 'function' || !data.apiKey || !data.logLocation) {
return callback(n... | true |
f085ddc96a03175eece6a5acc157fb3899c96895 | JavaScript | s-panferov/microcosm | /src/Store.js | UTF-8 | 527 | 2.703125 | 3 | [
"MIT"
] | permissive | /**
* Store
* Used to provide default values for a store configuration
*/
let skip = i => i
function Store (config, id) {
// Fold configuration over self
for (var i in config) {
this[i] = config[i]
}
this.toString = () => id
}
Store.prototype = {
getInitialState : skip,
serialize : skip,
... | true |
da0d4baf7570a5476170866026e69bc09ae583fc | JavaScript | hesamuhammad/phase-0 | /live-code/humble-fox/week-5/2.js | UTF-8 | 2,532 | 4.09375 | 4 | [] | no_license | /*
========
warOfFun
========
[INSTRUCTIONS]
warOfFun adalah sebuat fungsi yang menerima parameter berupa string dan
akan mengembalikkan nilai string yang merupakan pemenang perlombaan.
[EXAMPLE]
INPUT: [
['andre', 'toni', 'toti'],
['risk', 'fun', 'go'],
['humble', 'psyhco', 'strong']
]
PROCESS:
1. array[0] ak... | true |
b9e3b038f033bf692edcfede0c58b64a431fb830 | JavaScript | mpiercy827/mpiercy827.github.io | /js/snake/snake.js | UTF-8 | 2,081 | 3.171875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | (function() {
if (typeof Snake === "undefined") {
Snake = window.Snake = {};
}
Snake.Snake = function(pos){
this.segments = [];
this.turning = false;
this.addSegment = false;
this.segments.push(new Vector(pos));
};
Snake.Snake.prototype.includes = function (vector) {
for (var i = 0; ... | true |
57249bfed91eab11ae1437be5463997210800fa7 | JavaScript | Nullifiers/phaser-game | /src/scenes/game.js | UTF-8 | 5,348 | 2.515625 | 3 | [
"MIT"
] | permissive | import config from '../config';
import addFullScreenButton from '../helpers/add_fullscreen_button';
class Game extends Phaser.Scene {
constructor() {
super('game');
this.portals = {};
this.overlappingPortal = null;
}
preload() {
}
createBoundaries() {
const bound1... | true |
51eaa45af8c31c9b67a73fc822f0573141685f63 | JavaScript | jry017/haakonbor.github.io | /WebGL/karaktergivende/functional/js/Cube.js | UTF-8 | 7,592 | 2.78125 | 3 | [] | no_license | // Verteksbuffer:
let cubePositionBuffer = null;
let cubeNormalBuffer = null;
let cubeTextureBuffer = null;
let cubeTexture = null;
let cubePositions = new Float32Array([
//Forsiden (pos):
-1, 1, 1,
-1, -1, 1,
1, -1, 1,
-1, 1, 1,
1, -1, 1,
1, 1, 1,
//H๏ฟฝyre side:
1, 1, 1,
1, -1... | true |
20dc5179b256fdb49e71c098bcc41286d46f20cb | JavaScript | JeffreyRiggle/somerobit | /src/standardActions/revokeAccessAction.js | UTF-8 | 1,435 | 2.5625 | 3 | [
"MIT"
] | permissive | import MessageSender from './messageSender';
import {fullAccess, revokeAccess} from '../accessControl';
import {log} from '../logging';
const userReg = /-u\s+([^\s"]+)|-u\s+"([^"]*)"/i;
const singleAccessReg = /-a\s+([^\s\[]+)/i;
const arrayAccessReg = /-a\s+\[([^\]]+)\]/i;
class RevokeAccessAction extends MessageSen... | true |
a26530ad6baf88ca02ef1f1d9f444274b8167c56 | JavaScript | j-ay-williams/project_the_first | /assets/canvas.js | UTF-8 | 1,700 | 2.984375 | 3 | [] | no_license | var loadcount = 0;
var loadtotal = 0;
var preloaded = false;
function loadImages(imagefiles) {
loadcount = 0;
loadtotal = imagefiles.length;
preloaded = false;
var loadedimages = [];
for (var i=0; i<imagefiles.length; i++) {
var image = new Image();
image.onload = function () {
... | true |
425d35ed0e85807d2db179dd816ce1a8181f8f90 | JavaScript | jessicaLarsson/hfs-trial | /js/counter.js | UTF-8 | 1,230 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | /* function that given
an id of a tag containing text,
endvalue to count to,
duration i milliseconds,
and a boolean representing if % will be displayed efter the number
counts from the current number displayed in the tag to the endvalue*/
function countTo(elementID, endvalue, duration, showPercent){
var textFinal... | true |
e9f92ee9645c3077f7d9c03bccab78ae6b054b64 | JavaScript | kristenIngelman98/intro-mysql-db | /week9/db/setup.js | UTF-8 | 1,931 | 2.6875 | 3 | [] | no_license | const {cp} = require('./connection.js');
cp.then(pool=>{
return pool.query(`
DROP TABLE IF EXISTS party_votes, district, province;
CREATE TABLE party_votes (
party_name varchar(255) NOT NULL,
district varchar(255) NOT NULL,
province varch... | true |
41101dcf66f6dbf4ae3a1565e54e8867ae28910d | JavaScript | alan-vs97/leaflet-challenge | /Leaflet-Step-1/static/js/logic.js | UTF-8 | 2,255 | 2.546875 | 3 | [] | no_license | var mymap = L.map('map').setView([34.052235, -118.243683], 5);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-... | true |
e6b0dfa234d5b50a4ac279743b8d235ab06fea7a | JavaScript | cdnexport/CanvasMessAround | /game/hangman/js/game.js | UTF-8 | 10,760 | 3.421875 | 3 | [] | no_license | function Level(phrase) {
this.phrase = phrase.toUpperCase();
this.phraseMasked = phrase.replace(/[A-Z]/ig, '_');
this.guesses = [];
this.status = null;
this.lives = 4;
this.player = null;
}
Level.prototype.letterGuess = function(event, letter) {
if (this.guesses.some((guess) => guess.le... | true |
c779a2d05d7d8a9adf779cbf50bba5bd1dc9c836 | JavaScript | bd2187/cryptocurrencies | /client/src/components/Header/Search/SearchContainer.js | UTF-8 | 4,386 | 2.765625 | 3 | [] | no_license | import React, { Component } from "react";
import Search from "./Search";
import { withRouter, Redirect } from "react-router-dom";
class SearchContainer extends Component {
constructor(props) {
super(props);
this.state = {
query: "",
searchResults: [],
selected: "... | true |
0ef74e08594313feb77d2e27d1df27942c8f9528 | JavaScript | troysandal/adventofcode | /2020/day5.js | UTF-8 | 7,446 | 3.46875 | 3 | [] | no_license | import {assert} from "../2019/util.js"
//const assert = console.assert
/*
--- Day 5: Binary Boarding ---
You board your plane only to discover a new problem: you dropped your boarding
pass! You aren't sure which seat is yours, and all of the flight attendants are
busy with the flood of people that suddenly made it thr... | true |
c601bf946e150d9150f08dc470234c38140d3668 | JavaScript | witodivaro/design_patterns | /strategy/solution.js | UTF-8 | 2,080 | 3.890625 | 4 | [] | no_license | /*
The solution is to create so-called 'Strategies'.
Each strategy represents some inner logic that will be called within the
main class. Main class is now called 'Context', because all it does is
calls the wanted 'Strategy' passing the context object (which is 'withTaxes' in this example).
Strate... | true |
b9d53f8475a20e20081c724b340fb4f9cf6244cc | JavaScript | saturator22/quest-store | /Quest_Store/src/main/resources/static/js/classform.js | UTF-8 | 3,368 | 2.796875 | 3 | [
"MIT"
] | permissive | function createClassForm() {
hideAddButton();
let studentsForm = document.getElementById("studentsform");
studentsForm.style.cssText = "display:flex; flex-direction: column; align-items: center;";
let form = document.getElementById("form");
form.style.cssText = 'position:relative;padding: ... | true |
17bd47a6e056ddf14dfd7ea29f8330dc6eadd17b | JavaScript | Dynarc/APIAnimaux | /testApi/js.js | UTF-8 | 5,198 | 2.921875 | 3 | [] | no_license | let select = document.querySelector('select');
let content = document.querySelector('.content');
let form = document.querySelector('.form');
let list = document.createElement('select');
function a(){
list.style.display='none';
let request = select.value;
content.innerHTML = '';
if(request == 'Animal'){... | true |
ba656042081e784e3f46a71b56393b4e185a8d1f | JavaScript | Peatechen/electron-redis | /src/services/redis.js | UTF-8 | 4,867 | 2.53125 | 3 | [] | no_license | const bluebird = window.require('bluebird');
const redis = window.require('redis');
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
const connectionString = null;
// Mapping of HOST:PORT to { keys, client }
const connections = {
};
const loadedHashKeys = {
};
const ... | true |
ab76aea8331c633b3ab7889ce5c7069455d84c3f | JavaScript | joao-duarte/Node-School | /6_mod.js | UTF-8 | 372 | 2.546875 | 3 | [] | no_license | module.exports = function (dir, file_ext, callback)
{
var fs = require('fs')
var path = require('path')
var result = []
function handler(err,list)
{
if (err)
{
return callback(err)
}
for (var i in list)
{
if (path.extname(list[i]) == ('.' + file_ext))
{
result.push(list[i])
}
}
c... | true |
1ce67a2fcd4dff973a3c1625f54dcaf72b29780b | JavaScript | JimboMan123/WebDevProject | /public/script/confirmOrder.js | UTF-8 | 537 | 2.515625 | 3 | [] | no_license | function sendOrderByEmail() {
fetch('/isUserLoggedIn', { method: 'POST', headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
} })
// Handle success
.then(response => response.json()) // convert to json
.then(json => {
if(json.logge... | true |
225339db25940898c61361291f81859ae5122c2d | JavaScript | bryce-mullican/temp-review | /js/app.js | UTF-8 | 12,906 | 3.953125 | 4 | [] | no_license | // import { add } from './math_functions.js';
// 'use strict';
// Data types
var string = 'string';
var string2 = "string";
var string3 = 'this is fun y\'all';
//var string3 = "this is fun y'all";
var string4 = "Bryce said coding is \"cool!\"";
//var string4 = 'Bryce said coding is "cool!"';
// integers
var int = 1;... | true |
022eb0fdea56519edbf9f323dc2c1bd49f70d288 | JavaScript | JamesO1231/employeeTracker | /server.js | UTF-8 | 6,005 | 2.96875 | 3 | [
"MIT"
] | permissive | const inquirer = require('inquirer');
const util = require('./util/util.js');
const dbUtils = require('./util/util.js');
init();
function init() {
inquirer.prompt([
{
type: 'list',
choices: [
'Add department',
'Add role',
'Add employee',
'View department',
'Vi... | true |
fc1a9a2c5cc82afc5d904ddf7f8d90ceb3267fd8 | JavaScript | kolyuchii/deliveroo | /src/pages/main/index.js | UTF-8 | 2,048 | 2.796875 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import AppComponent from "../../components/app";
import HeaderComponent from "../../components/header";
import PageComponent from "../../components/page";
import RestaurantComponent from "../../components/restaurant";
import LocationComponent from "../../components/lo... | true |
4b93e1cc80832debc94c575ca02fd311f8d6e201 | JavaScript | danisacramento/Javascript | /2019_12_02/geneflix.js | UTF-8 | 542 | 2.890625 | 3 | [] | no_license | Var numFilme = 0;
function tocaAnterior(){
numFilme--;
if (numFilme <0){
numFilme=3;
}
document.getElementById("myvideo").src="./filme"+numFilme+".mp4";
document.getElementById("myvideo").play();
}
function tocaAtual(){
console.log("atual =" +document.getElementById("myvideo").src);
... | true |
5f16d77b1cf710ade4cdff82b7e6d373fd46b8f0 | JavaScript | bimsarawijethunga/notes4u | /src/components/Notes.js | UTF-8 | 1,357 | 2.609375 | 3 | [] | no_license | import { useState, useEffect } from "react";
import {app} from '../Firebase/firebase';
import { getDatabase, ref, onValue, query, orderByChild, equalTo } from "firebase/database";
import Note from "./Note";
import { getAuth, onAuthStateChanged } from "firebase/auth";
const Notes =()=> {
const [notesList, se... | true |
8bfba81a34d3d99fbe86cb74cc09505f050c5fb2 | JavaScript | carolinamanoel/exercicios-js | /controle/while.js | UTF-8 | 542 | 4.15625 | 4 | [] | no_license | //ร mais apropriado para quando tem uma quantidade indeterminada de repetiรงรตes
//Enquanto o usuรกrio nรฃo digitar -1... faรงa isso.
//Enquanto for verdadeiro executa, sรณ vai sair quando for falso sai do laรงo.
function getInteiroAleatorioEntre (min, max) {
const valor = Math.random() * (max - min) + min //O que ele fe... | true |
d7be6970cea920c0ae231d84ad76f7169f170f8b | JavaScript | uw-project-2/Project2 | /routes/ingredient-api-routes.js | UTF-8 | 1,911 | 2.515625 | 3 | [
"MIT"
] | permissive | var db = require("../models");
module.exports = function(app) {
app.get("/api/ingredients", function(req, res) {
//finding all fo the ingredients
// Here we add an "include" property to our options in our findAll query
db.Ingredient.findAll({}).then(function(dbIngredient) {
res.json(dbIngredient);
... | true |
82b7d1291a2659073f8071c0e86ab5f517650529 | JavaScript | raylax/java-js | /src/main/resources/test.js | UTF-8 | 55 | 2.875 | 3 | [
"MIT"
] | permissive | let a = 1;
let b = 2;
let c = 3
console.log(a + b * c); | true |
5f679747a7ac0f294cbfe727053714ed79737f5a | JavaScript | Tunglamphan25/agency | /js/main.js | UTF-8 | 1,544 | 3.015625 | 3 | [] | no_license | /**============ 1, Responsive Menu ============= */
var toggleMenu = document.querySelector(".header__bar-button");
var topNav = document.querySelector(".header__bar-menu");
console.log(toggleMenu);
console.log(topNav);
toggleMenu.addEventListener("click", function () {
topNav.classList.toggle("active");
document.q... | true |
4d7b69226646ac5586b898a3f66bc40cb8fc8a3c | JavaScript | WangXiaoyugg/question-of-Frontend | /sort/bubbleSort.js | UTF-8 | 1,294 | 4.40625 | 4 | [] | no_license | /**
* ๅๆณกๆๅบ๏ผไธคไธคๆฏ่พ็ธ้ป็บชๅฝ็ๅ
ณ้ฎๅญ๏ผๅฆๆๅๅบๅฐฑไบคๆข๏ผ็ดๅฐๆฒกๆๅๅบ็็บชๅฝไธบๆญข
*/
function swap(arr, i, j) {
let temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
}
function bubbleSort1(arr) {
let i,j
for(i=0; i< arr.length; i++){
for(j=i+1;j <= arr.length ;j++){
if(arr[i] > arr[j]){
swap(arr, i... | true |
b23038d9f7b6c47dcab10765cdbf574511b52449 | JavaScript | Visheshk/energy-skate-park | /js/common/SplineEvaluation.js | UTF-8 | 1,773 | 2.578125 | 3 | [
"MIT"
] | permissive | // Copyright 2013-2020, University of Colorado Boulder
/**
* Use these modified variants of numeric.js spline code because they are much faster!
* Code copied from numeric.js and hence licensed under MIT
*
* @author Sam Reid (PhET Interactive Simulations)
*/
import dot from '../../../dot/js/dot.js';
import energ... | true |
b200f102ffafe9292c4a2372da39cd4ee51942d3 | JavaScript | cadumega/cursojstp_lumi | /aula32/atribdesestru.js | UTF-8 | 963 | 4.25 | 4 | [] | no_license | // Atribuiรงรฃo via desestruturaรงรฃo
/*
let a = 'A'; // B
let b = 'B'; // C
let c = 'C'; // A
const letras = [b, c, a];
[a, b , c] = letras; //Atribuiรงรฃo via desestruturaรงรฃo,modificando o valor das var
console.log(a, b, c);
*/
/*
// Facilitar a vida com a sintaxe abaixo de reatribuiรงรฃo
// 0 1 ... | true |
eaed26169040dc1aef7d4a02f5d1035c98d5fc80 | JavaScript | FunmiOjo/coding-exercises | /listArrayConverter.js | UTF-8 | 345 | 3.21875 | 3 | [] | no_license | "use strict"
function listToArray(list) {
if (!list.next) {
return [list.value];
}
return [list.value].concat(listToArray(list.next));
}
var list1 = {value: 1, next: {value: 2, next: {value: 3, next: null}}};
var list2 = {value: "foo", next: {value: "bar", next: null}};
console.log(listToArray(list1));
console.... | true |