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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6f8689d07c1597b70429f0ee01fd1fdf53069e5b | JavaScript | nna774/piet-loader-canvas | /test/test-loader.js | UTF-8 | 2,006 | 2.65625 | 3 | [] | no_license | const assert = require('assert');
const Canvas = require('canvas');
const fs = require('fs');
const easyimg = require('easyimage');
const loader = require('../src/lib/loader');
const Image = Canvas.Image;
const pattern20 = [
['lred', 'lyellow', 'lgreen', 'lcyan', 'lblue', 'lmagenta'],
['red', 'yellow', 'green', 'c... | true |
6e478b82d548f0a47270f5d3ff9fc060906ee683 | JavaScript | fauzankadri/shopify-web-developer | /src/components/favourites/Favourites.js | UTF-8 | 2,561 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
import * as actions from "../../actions";
import DisplayResult from '../common/DisplayResult';
import './Favourites.css';
class Favourites extends Component {
constructor(props) {
super(props);
this.state = {
... | true |
cf74bf01a8e5d3494043d53dca839ec0a36cfc2d | JavaScript | mcli28/HTML-CSS-JS | /HTML5 Web Application Development By Example/6 Piano Man/audioManager.js | UTF-8 | 2,007 | 2.75 | 3 | [] | no_license | function AudioManager(audioPath) {
audioPath = audioPath || "";
var audios = {},
audioExt = getSupportedFileTypeExt();
function getSupportedFileTypeExt() {
var audio = $("<audio>")[0];
if (audio.canPlayType("audio/ogg")) return ".ogg";
if (audio.canPlayType("a... | true |
c93175c9c427fc4ffacd57d048aba96608dffb10 | JavaScript | bayzid-dev/JavaScript-Practice | /freecodecamp/7.Conditional(else).js | UTF-8 | 3,632 | 4.21875 | 4 | [] | no_license |
//********** THIS IS ALL ABOUT ELSE STATEMENT */
//// function with else if statement
/****** shift + Alt + A ****/
function returnFValue (val) {
if (val > 50) {
return "value is greater than 50";
}
else if (val < 20) {
return "the value is smaller than 20";
}
else ... | true |
e27cfc4d021c5d18f33617e1d43472a39550a1b1 | JavaScript | NewsHubby/newshubby | /app/assets/javascripts/interview.js | UTF-8 | 7,169 | 2.78125 | 3 | [] | no_license | /*jslint browser: true*/
/*global $, jQuery, alert*/
$(document).ready(function() {
var i = 1; // counter starting at 1
var qCount = $('.question').length; // count the number of .question divs
//console.log('There are ' + qCount + ' question divs present'); // log number of .question in console. Sanity c... | true |
172071753f2443a350d5890b3663f0ead314abb4 | JavaScript | AndrewKhristich/SpringBootJdbcExample | /src/main/resources/static/post.js | UTF-8 | 716 | 2.640625 | 3 | [] | no_license | $(document).ready(function () {
$("#lineForm").submit(function (event) {
saveJson();
resetData();
event.preventDefault();
});
function saveJson() {
$.ajax({
type : "POST",
contentType : "application/json",
... | true |
4651c39317725b9d7b5203d6128d0a29360e0a84 | JavaScript | franco-dias/mecontrata-chat | /src/contexts/AuthContext.jsx | UTF-8 | 1,581 | 2.5625 | 3 | [] | no_license | import React, {
createContext,
useContext,
useState,
useEffect
} from 'react';
import api from '../resources/api';
const AuthContext = createContext();
const AuthProvider = ({ children }) => {
const [userData, setUserData] = useState(null)
const setInterceptor = (token) => {
api.interceptors.request... | true |
89a1b5d295dfe2f04d8f8787119da04ebccad608 | JavaScript | JoshuaJC23/Word-Guess-Game | /assets/javascript/game.js | UTF-8 | 2,189 | 3.390625 | 3 | [] | no_license | // create variable with array of nba teams
var teams = ["Celtics", "Bulls", "Hawks", "Nets", "Cavaliers", "Hornets", "Knicks",
"Pistons", "Heat", "Seventy Sixers", "Pacers", "Magic", "Raptors", "Bucks",
"Wizards", "Nuggets", "Warriors", "Mavericks", "Timberwolves", "Thunder",
"Blazers", "Jazz", "Clippers", ... | true |
9c4af373078e54136c9c133ea4a1b1b95660c691 | JavaScript | normanxin/leetcode-practice | /src/131.palindrome-partitioning.js | UTF-8 | 1,002 | 3.53125 | 4 | [] | no_license | /*
* @lc app=leetcode id=131 lang=javascript
*
* [131] Palindrome Partitioning
*
* https://leetcode.com/problems/palindrome-partitioning/description/
*
* algorithms
* Medium (38.31%)
* Total Accepted: 141.8K
* Total Submissions: 370.2K
* Testcase Example: '"aab"'
*
* Given a string s, partition s such ... | true |
d7ae799605902b4527ad148d648a582a1e01ce3a | JavaScript | wningLemon/taskThirteen | /gitHomeWork/taskTwelve/partTwo/js/index.js | UTF-8 | 21,922 | 3.015625 | 3 | [] | no_license | /**
* Created by Administrator on 2017/4/18.
*/
$(function () {
//盛放html的问题的数组
var arrQ0=[
{
question:"XHTML和HTML有什么区别?",
answer:"HTML是一种基本的WEB网页设计语言,XHTML是一个基于XML的置标语言<br/>" +
"最主要的不同:XHTML 元素必须被正确地嵌套;XHTML 元素必须被关闭;标签名必须用小写字母;XHTML 文档必须拥有根元素。"
},
{
... | true |
3caccd3e47987788386fd20c9f8e1877a147686d | JavaScript | everitosan/NearbyApp | /components/api/client.js | UTF-8 | 1,586 | 2.5625 | 3 | [] | no_license | const URL = "http://localhost:3000/api";
const JSON_HEADERS = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
function loginUser(user) {
return fetch (URL + "/authUser", {
method: 'POST',
headers: JSON_HEADERS,
body: JSON.stringify({
name: user.name,
showId... | true |
73c0c1f7f6743577dd55da9433dc8df1a7b56f6f | JavaScript | leesei/node-scrapebp | /ImgScraper.js | UTF-8 | 511 | 2.609375 | 3 | [
"MIT"
] | permissive | const url = require("url");
// scrape function
// res: `node-fetch` `Response` object (https://github.com/bitinn/node-fetch#interface-body)
// $: `cheerio` object with page loaded (https://github.com/cheeriojs/cheerio#api)
// return: Promise of scraped result
module.exports = (res, $) => {
// console.info("process... | true |
dc5d74378aa4eb2fe6c87078aa705da01b474db0 | JavaScript | rafikovt/todolist | /todoApp.js | UTF-8 | 4,044 | 3.0625 | 3 | [] | no_license | (() => {
const createAppTitle = (title) => {
const titleApp = document.createElement(`h2`);
titleApp.innerHTML = title;
return titleApp;
};
const createAppForm = () => {
const form = document.createElement(`form`);
const input = document.createElement(`input`);
const button = document.c... | true |
2b7380b3c1f73dbb6ac5bc3cab72aca76749c47b | JavaScript | justinsillou/Rezozio | /js/action_recherche.js | UTF-8 | 1,825 | 2.765625 | 3 | [] | no_license | // SILLOU Justin
window.addEventListener('load',initUsers);
function initUsers(){
document.getElementById('rechercheUser').addEventListener('input',loadUsers);
}
//affichage des messages au chargement de la page (deconnecte)
function loadUsers(){
//nettoyage avant recherche
document.querySelector('sec... | true |
99596f859bc899a042119a5144cef869cb72ac27 | JavaScript | JoRoy23/My-Spotify-Version | /src/App.js | UTF-8 | 11,569 | 2.578125 | 3 | [] | no_license | import React, { useEffect, useContext } from "react";
import { getTokenFromUrl } from "./spotify";
import { SpotifyContext } from "./ContextApi/SpotifyState";
import { getArtists } from "./helpers";
import SpotifyWebApi from "spotify-web-api-js";
import Login from "./components/Login";
import MainLoadingScreen from "./... | true |
6454f01db7052365f26fbaa74ca1fdedf21467ef | JavaScript | MikolajKubek/CookBookApp | /frontend/src/components/Recipes/RecipeDetails.js | UTF-8 | 14,798 | 2.765625 | 3 | [] | no_license | import React, { Component } from "react";
import './RecipeDetails.css'
import Comment from './Comment'
import AddComment from './AddComment'
class RecipeDetails extends Component {
constructor(props) {
super(props)
this.state = {
title: '',
description: '',
id: ... | true |
b828c89bf6f7679d954e7db0b1a02ab8c820d450 | JavaScript | ajay007qq/Asphalt8 | /src/main/webapp/resources/js/compare.js | UTF-8 | 1,497 | 2.671875 | 3 | [] | no_license | var arguments = [ "氮气强度", "最大氮气强度", "速度", "最大速度", "氮气推进速度", "最大氮气推进速度" ];
var randomColorFactor = function() {
return Math.round(Math.random() * 255);
};
var randomColor = function() {
return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ','
+ randomColorFactor() + ',.7)';
};
var barCha... | true |
4b8e83e377a146680dc58e82a77e1d3d1b3ccb8a | JavaScript | cloneforyou/content-review-lookup | /dist/de.phtl/TitleMainpage.js | UTF-8 | 191 | 2.53125 | 3 | [
"CC-BY-4.0"
] | permissive | // TEST
/*var titleTag = document.getElementsByTagName('title');
[].slice.call(titleTag).forEach(function (changeTitleTag) {
changeTitleTag.innerHTML += 'TEST WIKI';
});
*/
alert('Test'); | true |
ce38d9d539b1c6f6e6e8fdf5cd158ac8f474771e | JavaScript | pindell-matt/algo-rhythms | /selection_sort.js | UTF-8 | 673 | 3.21875 | 3 | [] | no_license | 'use strict'
const _ = require('lodash')
let findSmallest = (array) => {
let smallest = array[0],
smallestIndex = 0
for (let i = 0; i < array.length; i++) {
if (array[i] < smallest) {
smallest = array[i]
smallestIndex = i
}
}
return smallestIndex
}
let selectionSort = (array) => {
... | true |
856f1c92cc8037a90fdf4070ff9d123b738ccd8f | JavaScript | victordruc/javascript-level_2 | /development/dom_shop/src/catalog.js | UTF-8 | 1,303 | 3.03125 | 3 | [] | no_license | // const catalog = [
// new Product(1, "Olive Oil", "images/olive-oil-968657_640.jpg", {
// amount: 50,
// currency: "MDL"
// }),
// new Product(2, "Nuts", "images/nuts-2971675_640.jpg", {
// amount: 150,
// currency: "MDL"
// }),
// new Product(3, "Strawberry", "imag... | true |
c74ce661aa1b83c976d9aa425347d5ac196023b3 | JavaScript | Hinoir/TrabajoFinal | /frontend/src/App.js | UTF-8 | 8,390 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class App extends Component {
constructor() {
super();
this.state = {
_id:'',
name: '',
username: '',
identification: '',
password: '',
photo: '',
active: '',
users: []
};
this.addUser = thi... | true |
6df7f4853def7b23374dbe225142d817499761b8 | JavaScript | XAVIERenc/stock-quotes | /quote_mechanics.js | UTF-8 | 644 | 2.9375 | 3 | [] | no_license | // All Javascript written by Jeffrey B. Madden 2019.
// XMLHttpRequest Parser
function sendQuote( func , quote , symbol )
{
var parsreq = new XMLHttpRequest() ;
parsreq.onreadystatechange = function() {
if ( (parsreq.readyState === 4) && (parsreq.status === 200) )
{
func(parsreq.responseText) ;
}
} ;
var lo... | true |
709e0619f9db4492a17b81f4e43890c5383b3f64 | JavaScript | awesomesk1ll/nodeJS_2_1106 | /Students/Ivan_Krasnobaev/lessons/3/public/js/main.js | UTF-8 | 2,037 | 3.53125 | 4 | [] | no_license | const answers = document.getElementById('answers');
const enter = document.getElementById('enter');
const withdraw = document.getElementById('withdraw');
const input = document.getElementById('inp');
const repeat = document.getElementById('repeat');
let attempts = 10;
let number = getNumber();
repeat.hidden = true;
c... | true |
8d4e98d2162ca64408094de2481cd44a8d5ecd69 | JavaScript | harben31/wk_3_RPS_project | /assets/script.js | UTF-8 | 2,570 | 3.421875 | 3 | [] | no_license |
var RPS = ["R", "P","S"];
var scoreComp = 0;
var scorePlayer = 0;
var scoreTie = 0;
var mainFun = function(){
var inputPrompt = function() {
var inInput = prompt("choose R P or S:", "put it here");
inInput = inInput.toUpperCase();
return inInput;
console.log(i... | true |
5a373fe60ba736f15ef8369d9c491b657adabaeb | JavaScript | Divya-5/quiz-divyanshi | /index.js | UTF-8 | 1,458 | 3.390625 | 3 | [] | no_license | var chalk=require('chalk');
var readlineSync = require("readline-sync");
var score=0;
var highestScores = [
{
name: "Divyanshi",
score: 5,
},
{
name: "Akshat",
score: 4,
},
]
function welcomeToGame() {
var userName=readlineSync.question("What's your name? ");
console.log("Welcome "+ userNam... | true |
ec820682b4573194a8a32c49f1d23add2d4cc535 | JavaScript | airlukasz89/airlukasz89.github.io | /Wall.js | UTF-8 | 1,328 | 3.234375 | 3 | [] | no_license | class Wall {
constructor(x, y) {
let _x = x
let _y = y
let _pointsArray = [];
this.getPoints = () => {
return _pointsArray;
}
let _getDiffVector = (direction) => {
var diffVector = {
x: 0,
y: 0
... | true |
325b71397cea044c7d8968cb4558d44095c333fb | JavaScript | Pumala/twitter_clone | /back_end.js | UTF-8 | 16,294 | 2.5625 | 3 | [] | no_license | const mongoose = require('mongoose');
const bluebird = require('bluebird');
const express = require('express');
const bodyParser = require('body-parser');
const uuidV4 = require('uuid/v4');
const moment = require('moment');
// BCRYPT
const bcrypt = require('bcrypt-promise');
cons... | true |
5c1eb75e367938a57be020c9826adb1b462c8fdb | JavaScript | igvteam/hic-straw | /test/nodeLocalFile.test.js | UTF-8 | 702 | 2.59375 | 3 | [
"MIT"
] | permissive | import { assert } from 'chai';
import NodeLocalFile from '../src/io/nodeLocalFile.mjs'
const range = {start: 25, size: 100};
suite('NodeLocalFile', function () {
test('test read range', async function () {
const path = "test/data/BufferedReaderTest.bin"
const file = new NodeLocalFile({path: pa... | true |
75d326bd1de6526036f99b316eed0943c0576c52 | JavaScript | kyw624/my-mate | /src/js/main.js | UTF-8 | 17,731 | 2.859375 | 3 | [] | no_license | let defaultListArray = [];
let customListArray = [];
let itemArray = [];
const defaultList = document.querySelector('.nav__default-list');
const customList = document.querySelector('.nav__custom-list');
const contentList = document.querySelector('.content-list');
const newListButton = document.querySelector('.new-list-... | true |
10e56ec82a500b5e389e8b42970a700ded9c564c | JavaScript | joshsprague/2013-06-recursion | /src/getElementsByClassName.js | UTF-8 | 1,130 | 3.84375 | 4 | [] | no_license | // If life was easy, we could just do things the easy way:
// var getElementsByClassName = function (className) {
// return document.getElementsByClassName(className);
// };
// But in stead we're going to implement it from scratch:
var getElementsByClassName = function (className) {
// your code here
/* var node ... | true |
1a4a60874a0fd65b5ea2efefebe762456fa3e6a9 | JavaScript | EthanKeng/Javascript | /pdfjs/dist/script.js | UTF-8 | 1,564 | 2.703125 | 3 | [
"MIT"
] | permissive | var doc = new jsPDF('l', 'pt', 'a4', false);
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#cmd').click(function () {
doc.fromHTML($('#content').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
... | true |
0322b1a60c6cea835ba05af866b5147d82577875 | JavaScript | yehiashouman/AS4JS | /events/StageVideoEvent.js | UTF-8 | 770 | 2.609375 | 3 | [] | no_license | /**
* @namespace events
* @requires events.Event
* @class StageVideoEvent
* @author Nermeen Shoman
*/
var StageVideoEvent=function(type, bubbles, cancelable, status, colorSpace){
Event.call(this, type, bubbles, cancelable, status, colorSpace);
// The color space used by the video being displayed in the StageVideo o... | true |
dd15a7eb684b3e871a907aff581cdebb566ba0a7 | JavaScript | arh450/note-taker | /routes/apiRoutes.js | UTF-8 | 1,966 | 3.03125 | 3 | [] | no_license | const router = require("express").Router();
const fs = require("fs");
const path = require("path");
const { v4: uuidv4 } = require('uuid');
const db = path.join(__dirname, "../db/db.json");
// get request to return data in db file to client on html
router.get("/notes", (req, res) => {
// read data from db using re... | true |
ceb8e3abd56da802e7125d5c0334cd0f95e1b2fa | JavaScript | linh4/algos | /algos/structured_algos/Multiple Pointers/Count Unique Values.js | UTF-8 | 634 | 4.5625 | 5 | [] | no_license | // Write a function which accepts a sorted array, and counts the unique values in the array.
// There can be negative numbers in the array, but it will always be sorted.
// time complexity: O(n)
function countUniqueValues(arr) {
if (arr.length === 0) return 0
let i = 0
// loop from the next element
for (let j... | true |
2687f2bcc22987646b5b0e02c6df070bcc467053 | JavaScript | shachopin/github-search-glitch | /app/core/repo.service.js | UTF-8 | 673 | 2.515625 | 3 | [] | no_license | (function() {
'use strict';
angular
.module('app.core')
.factory('RepoService', RepoService);
function RepoService() {
var repo = {};
var existingRepos = [];
var setRepo = function(authorName, repoName) {
repo.authorName = authorName;
repo.repoName =... | true |
847e0f8bc5980f2e27af0dc2ac2b6ddc58be8db0 | JavaScript | Oktawian-L/Sum4Fun | /App.js | UTF-8 | 545 | 2.6875 | 3 | [] | no_license | import * as React from 'react';
import Game from './Game';
class App extends React.Component{
state= {
gameId:1,
};
resetGame= () =>{
this.setState((prevState)=>{
return{gameId:prevState.gameId+1};
})
}
render(){
return(
//nadajac nowe gameID resetuje komponent
//randomNumber - ile li... | true |
0335aa7f4fef0474e34e881aba958f897bc2f8d2 | JavaScript | kaledoux/javascript_small_problems | /smallProblems/easy1/10.js | UTF-8 | 577 | 4.34375 | 4 | [] | no_license | /*
* start with a string
* break the string into an array of characters
* iterate through the array
* reduce the array such that each char is converted to its ascii with String.charCodeAt(0)
* return the total
*/
function asciiValue(string) {
if (string.length < 1) { return 0 };
return string.split('').map( ... | true |
a17fdf73c36463db0e2950c8d827475bd7adb259 | JavaScript | jermin2/verseViewer | /src/components/HoverableDiv.js | UTF-8 | 2,621 | 2.90625 | 3 | [] | no_license | import React, {useEffect, useState} from 'react'
import VerseService from './VerseService'
const verseService = new VerseService();
const HoverableDiv = ({ handleMouseOver, handleMouseOut, handleClick, verseRef }) => {
return (
<div onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} onClick={handleClick}... | true |
84db252fbd1fd596e1660a0631d19e583afc7d28 | JavaScript | alanmariz/tarefas-api | /seeds/02_Users.js | UTF-8 | 490 | 2.546875 | 3 | [] | no_license | exports.seed = function(knex, Promise) {
const tableName = "users";
const data = [
{
nome: "Alan",
email: "alan@ifrn.com",
senha: "12345"
},
{
nome: "Anne",
email: "anne@ifrn.com",
senha: "1234"
},
{
nome: "Minora",
email: "minora@ifrn.com",
... | true |
6bf773b7cfc5eca23d166a88df7610f715b0183c | JavaScript | antgonto/localizacion | /GPS_Position.js | UTF-8 | 839 | 3.265625 | 3 | [] | no_license |
//Esta función llama a las funciones para localizar al usuario
function getGPSPosition(){navigator.geolocation.getCurrentPosition(showCoords, showError);}
//Esta función muestra la posicicón del usuario
function showCoords(posicion){
//Este se agregó como un ejemplo para probar el codigo, es el id de un botón
var ... | true |
dcd53490c3039a0979c315df0ef637551503a1d1 | JavaScript | anndrill/js-lesson-3 | /main.js | UTF-8 | 609 | 4.09375 | 4 | [] | no_license | // Задание 1.
// let a = 1;
// let b = 100;
// while (a < b) {
// a++;
// for (let c = 2; c < a; c++) {
// if (a % c != 0) {
// console.log(a);
// }
// break;
// }
// }
//Задание 2 и 3.
// x = [10, 4, 35, 8, 73, 60];
// let countBasketPrice = x.reduce(function (acc, e... | true |
cf074f8504bfe4315ff49fe4a8b28d7695094f8a | JavaScript | dbpokorny/autoclave | /test/mutual_recursion.js | UTF-8 | 278 | 2.5625 | 3 | [] | no_license | var g;
var f = function f ( x ) {
if ( x == 0 ) {
return 0;
} else {
return 1 + g ( x - 1);
}
};
g = function g ( x ) {
if ( x == 0 ) {
return 0;
} else {
return 1 + f ( x - 1);
}
};
module.exports = { f : f , g : g } ;
| true |
7230cb9eb505ce1fc81ab6a958d52faf039da28a | JavaScript | YL2120/intro-react | /src/components/MainAddTodo.js | UTF-8 | 1,696 | 3.25 | 3 | [] | no_license |
import { useState } from "react";
import { v4 as uuidv4 } from 'uuid';
const MainAddTodo = ({ addTodo }) => { // "addTodo" is the propos comming from the App.js
const initialtodos = [ // array of data
{ key : "", title : "", check : false },
];
const [todos, setTodos] = useStat... | true |
f01ae34e1ea90412d0e872e579bec4c7b8757d9b | JavaScript | ga-dc/wdi5 | /w07/d01/js_functions/in_class/basic_functions.js | UTF-8 | 1,563 | 4.3125 | 4 | [] | no_license | nums = [1,2,3,4,5];
aryEach(nums, printItem);
console.log("*******");
aryEach(nums, printItemPlusOne);
// // Write a function to accept three numbers and return
// // their product.
//
// function multiplyNums(num1, num2, num3) {
// var product = num1 * num2 * num3;
// return product;
// }
//
// // console.log(mu... | true |
8084fd30c688f69c149688807632f97836b3f0cd | JavaScript | VictorNorm/Victor-Norman-JS1-CA | /script/jsdetails.js | UTF-8 | 1,660 | 3.203125 | 3 | [] | no_license | const queryString = document.location.search
console.log(queryString)
const parameters = new URLSearchParams(queryString);
console.log(parameters)
const id = parameters.get("id");
console.log(id)
const container = document.querySelector(".container")
const pageTitle = document.querySelector(".pageTitle")
const erro... | true |
53c26d4e11defa0fddaf0d9d06c49fa7e835c013 | JavaScript | CrisThur/CrisThur.github.io | /app/worldmapper/main.js | UTF-8 | 13,490 | 2.546875 | 3 | [
"MIT"
] | permissive |
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgba(0,0,0,255)";
ctx.fillRect(0, 0, canvas.getAttribute("height"), canvas.getAttribute("width"));
function randInt(min,max) { return Math.floor(Math.random() * (Math.floor(max) - Math.ceil(min) + 1)) + min; }
func... | true |
6e0762ad2b7f5e21f5e436c9428c94921a5cb8e5 | JavaScript | gsitcia/Chrome-Extensions | /EVIL/options.js | UTF-8 | 1,010 | 2.65625 | 3 | [] | no_license | function ov(v) {
var z = document.createElement('option');
z.value = v;
return z;
}
chrome.storage.local.get(['id'], function(e) {
if (e.id) {
chrome.management.get(e.id,function(r) {
document.getElementById('name').value = r.name;
document.getElementById('success').inne... | true |
de5fa7c69e5a7a8ba8aa220acd3c96f864c2392b | JavaScript | jenifer7/ApiCertBF | /app/models/Prescription.js | UTF-8 | 2,624 | 2.6875 | 3 | [] | no_license | const sql = require('../connect.js');
const Prescription = function(prescription){
this.description = prescription.description;
this.is_active = prescription.is_active;
this.user_id = user_id;
this.patient_id = patient_id;
this.product_id = product_id;
};
Prescription.create = (newPrescriptio... | true |
957d49fdbbad56a93104a6da3fda907005acdbdb | JavaScript | jrc-eng/JacksMathWorkshop | /client/src/containers/Algebra/MathCalculator.js | UTF-8 | 7,910 | 3.015625 | 3 | [] | no_license | import React,{useEffect} from "react"
import Jumbo from "../../components/Jumbo"
import NavBar from "../../components/NavBar"
import {Container, Col, Row} from "react-bootstrap"
import {IconButton, TextField, Tooltip, Button} from "@material-ui/core";
const MathCalculator =()=>{
const [value, setValue] = Reac... | true |
3df45bb993f725f574d291b2bfa9cc49967a3648 | JavaScript | aemcee/npm_intro | /src/index.js | UTF-8 | 445 | 2.515625 | 3 | [] | no_license | // import $ from 'jquery'; // import entirety of jquery library
// // web browser cannot read import statment?
// // we need to use webpack to build
// $('#root').append('<h1>I was added with jQuery</h1>');
import sQeury, { addToDom, makeElement } from './helpers';
import add from './add';
addToDom('Who needs jQue... | true |
70421714b37297c11fc3d87c2ae9f031aa898fd9 | JavaScript | Sinead-CYF/JavaScript-Core-2-Coursework-Week2 | /exercises/D-todo-list/script.js | UTF-8 | 1,604 | 4.0625 | 4 | [] | no_license | function todoList(todos) {
const content = document.querySelector("#content");
const heading = document.createElement("h1");
heading.style.color = "#4f92d4";
heading.textContent = "My To-Do List";
content.appendChild(heading);
const ul = document.createElement("ul");
content.appendChild(ul);
for (let i... | true |
50eaa6dbca00781afb19e36a0627864659021476 | JavaScript | Matoseb/sokomplex | /js/libs/WebGL.js | UTF-8 | 2,000 | 2.609375 | 3 | [] | no_license | /**
* @author alteredq / http://alteredqualia.com/
* @author mr.doob / http://mrdoob.com/
*/
var WEBGL_ = {
isWebGLAvailable() {
try {
var canvas = document.createElement('canvas');
return !!(window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('exp... | true |
60c07642d8b7d95039be8a314e3e033dc6b8019c | JavaScript | abhishekhjs/sikkim8b | /script.js | UTF-8 | 1,000 | 2.6875 | 3 | [] | no_license | //THE LOGIN FORM
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
modal.style.display = "block";
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick... | true |
41e8a0fa1f610a5fddcb90e7933a9b4a9b69c57a | JavaScript | YaroslavReact/react | /src/task2.js | UTF-8 | 3,001 | 3.859375 | 4 | [] | no_license | const arr = [1, 2, 3, 4, 5, 6]
const arrSome = arr.some(item => item > 3); // хоть один больше 3?
console.log(arrSome);
console.log("Some_______________________");
const arrReduce = arr.reduce((sum, item) => sum + item); // сумма всех елементов массива
console.log(arrReduce);
console.log("Reduce_______________________"... | true |
3bd8d696b7d5b59e0f22ed7e31601bc3e2aaec68 | JavaScript | mmalecki/notquiteorm | /query-builder.js | UTF-8 | 909 | 2.609375 | 3 | [] | no_license | const errors = require('./errors.js')
class QueryBuilder {
constructor (query) {
this.query = query
}
where (...args) {
this.query = this.query.where(...args)
return this
}
update (update) {
this.query = this.query.update(update).returning('*')
return this
}
insert (data) {
thi... | true |
22ec954fa293a2c8d677874f3d201a2937e30eaa | JavaScript | Maphorbs/Bank-JS | /src/Account.js | UTF-8 | 1,103 | 3.0625 | 3 | [
"MIT"
] | permissive | (function (exports) {
"use strict";
function Account(balance= 0){
this.transactions = [];
this.balance = balance;
}
Account.prototype.deposit = function(amount){
var that = this;
var deposit = new Deposit(amount, "credit", this.balance);
addAmount(amount);
this.addTr... | true |
24becd8612327d5ab1fe854f1e64a04b5b6dae2a | JavaScript | davit37/dsc_laptop_kantor | /assets/front/js/custom.js | UTF-8 | 4,223 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict'
var counter = 0;
var IDsetInterval = 0;
var arrayImg = null;
var formdata = null;
let file = null;
var imageType = /image.*/;
//slider
function nextShow() {
counter++;
if (counter == arrayImg.length) {
counter = 0;
}
$('.jumbotron').css({
'background-image': 'url(' + arrayImg[counter].image + ... | true |
d119b913a58de9c07446cce916bfe335ee0bcd71 | JavaScript | MaligneCanyon/js210 | /lesson4/intermediate_uses_pp3.js | UTF-8 | 236 | 3.796875 | 4 | [] | no_license | function backAndForth(arr) {
return arr.concat(arr.slice().reverse());
// return [...arr, ...(arr.reverse())];
}
let arr = [1, 2, 3, 4];
console.log(backAndForth(arr)); // [1, 2, 3, 4, 4, 3, 2, 1]
console.log(arr); // non-mutating
| true |
622f33eefc53b6cf944b214c3ef20753bba1f0b9 | JavaScript | Karna98/Project-VAPPP | /Socket/Server.js | UTF-8 | 1,805 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive |
// var path = require('path');
// var bodyParser = require('body-parser');
// var server =require('http').createServer(app);
// var express = require('express');
// var app = express();
// var io=require('socket.io').listen(server);
// server.listen(3000);
// app.get('/',function(req,res){
// res.sendFile(__dirname ... | true |
0d6dd66142687a4a5c1d42f46d88cd0a670b312d | JavaScript | liu-austin/data-structures | /sprint-one/src/functional-shared/queue.js | UTF-8 | 748 | 3.40625 | 3 | [] | no_license | // jshint esversion:6
var Queue = function() {
// Hey! Rewrite in the new style. Your code will wind up looking very similar,
// but try not not reference your old code in writing the new style.
var queue = {};
queue.obj = {};
queue.key = 0;
_.extend(queue, queueMethods);
return queue;
};
var queueMethod... | true |
5ef161edacd9c42e1fe8030f95d57758a598cb8f | JavaScript | natallia-lukyaniuk/courseProject | /UniverSpringMVC/src/main/webapp/app/js/controller/GoodsTypeController.js | UTF-8 | 2,649 | 2.609375 | 3 | [] | no_license | 'use strict';
univerApp.controller('GoodsTypeController', [
'$scope',
'GoodsTypeService',
function($scope, GoodsTypeService) {
var self = this;
self.goodsType = {
id : null,
type : '',
};
self.goodsTypes = [];
self.submit = submit;
self.edit = edit;
self.remove = remove;
self.r... | true |
90e61f8143c882de063c6b52511b77fff81112ec | JavaScript | wangbing234/qkkj | /react1.3/BDOS-UI/components/rightMenu/index.jsx | UTF-8 | 4,061 | 2.625 | 3 | [] | no_license | import React, { PropTypes } from 'react'
import { render } from 'react-dom'
import classNames from 'classnames'
import './index.less'
class RightMenu extends React.Component {
constructor(props) {
super(props);
this.state = {};
this.menu;
this.currentNode;
let that = this;
//右键菜单相关函数
this... | true |
6fa34abda4997b8edbaa6f8420ea950c0baa46dd | JavaScript | kostaschaidoulis/JavaScriptAlgoFreeCodeCampExc | /divisors.js | UTF-8 | 333 | 4.03125 | 4 | [] | no_license | function divisors(integer) {
var number = [];
for (var i = 0; i <= integer; i++) {
if(integer % i === 0) {
number.push(i);
}
}
number.pop();
number.shift();
if(number.length === 0) {
number = integer + " is prime"
}
return console.log(number);
}
... | true |
e766739a6807461b441520d64af33dde8ce6a070 | JavaScript | Shivelle/scotchJS | /scotchJSstarter/projects/crazyButtons/cb.js | UTF-8 | 1,199 | 3.421875 | 3 | [] | no_license | // grab everything we need
const crazyButtons = document.querySelectorAll('.btn-crazy');
// define our functions
function goCrazy(e) {
const button = e.target;
// get a random number for the left offset
const offsetLeft = Math.random() * (window.innerWidth - this.clientWidth);
// get a random number for top offs... | true |
4ceb70718943d6c8fe3832640b416115ff588b62 | JavaScript | JonasRodon/FinalProject_tpc | /temp/PLANTILLES/transformData.js | UTF-8 | 4,304 | 2.640625 | 3 | [] | no_license | let data = require('./bd.json')
const fs = require('fs')
let cleanData = []
// console.log(data)
data.forEach(item => {
let keyName = item.Nomenclatura
let position = {}
let tpc = item.indexTPc
let gtpc = item.indexgTpc
let cord = item.Cordenadas
let posC = ''
let posF = ''
let gposC = ''
let gpos... | true |
db2a9327438aef43ed7559a0bc62dcaefbbb8be5 | JavaScript | tlivings/graphql-seneca-example | /author/db.js | UTF-8 | 589 | 2.734375 | 3 | [] | no_license |
const CUID = require('cuid');
class DB {
constructor() {
this.data = {
'cj9ribob50000ridq580knp6j': {
id: 'cj9ribob50000ridq580knp6j',
name: 'J.R.R Tolkien'
}
};
}
get(id) {
console.log(`fetched ${JSON.stringify(this.data[id])... | true |
a543e1b1090e6fcf2a2cc12629f9c27ab6372329 | JavaScript | Yasmine011/PerSHomework | /app.js | UTF-8 | 4,326 | 3.0625 | 3 | [] | no_license | let butt = document.getElementsByClassName('borough')
Array.from(butt).forEach(object => object.addEventListener("click", UserRequest))
/**
*
* @param {Event} place //User calls on the borough they are interested in
*/
function UserRequest(place) {
let UserInput= document.getElementById('numOfComplaint... | true |
f87e5096541e52aa26aa3bbfea0ffd951b55c91c | JavaScript | mycoralhealth/mycoral-patient | /src/utilities/symmetric_enc.js | UTF-8 | 964 | 2.65625 | 3 | [] | no_license | import forge from 'node-forge';
export const generateKey = async () => {
return new Promise(function(resolve) {
const key = forge.random.getBytesSync(16);
const iv = forge.random.getBytesSync(8);
resolve({ key, iv });
});
}
export const encrypt = async (data, key, iv) => {
return new Promise(functi... | true |
a0e95362211a2e8831e4f80c322e540df4549255 | JavaScript | monojack/blips | /src/utils/when.js | UTF-8 | 262 | 2.609375 | 3 | [
"MIT"
] | permissive | export function when (condition, transform, data) {
let bool = Boolean(condition)
if (typeof condition === 'function') {
bool = Boolean(condition(data))
}
return bool
? typeof transform === 'function' ? transform(data) : transform
: data
}
| true |
f2b8a6e7653f122b9837d6df8e9c20f2248e6f69 | JavaScript | MonikaGUser/car-rental | /src/main/resources/static/script.js | UTF-8 | 3,662 | 2.734375 | 3 | [
"MIT"
] | permissive | var gValueMiasto;
var tbody = document.querySelector('tbody');
tbody.addEventListener('click', handleClick);
$.ajax({
url: "http://localhost:8080/city",
method: "get",
success: function onSuccess(cities) {
console.log(cities);
let $citiesDrop = $("#zmiastoOdbioru");
// console.log(c... | true |
a714decd2a504615e6bf2fb096dd330aed76a3e7 | JavaScript | Caweca105/Bytes4Future-React | /Bytes4future - avançado/BootCamp/Exercícios/Javascript/Capítulo 1/Tipos de Dados Primitivos/dist/perimetroDoTrapezio.dev.js | UTF-8 | 310 | 3.234375 | 3 | [] | no_license | "use strict";
function perimetroDoTrapezio(comprimentoMaior, comprimentoMenor, altura) {
// escreve aqui a função
var altura1 = Math.pow(altura, 2) + Math.pow((comprimentoMenor - comprimentoMaior) / 2, 2);
var altura2 = Math.sqrt(altura1);
return comprimentoMenor + comprimentoMaior + altura2 * 2;
} | true |
803009a067f084a7d88ba2f996a6e12c536b3159 | JavaScript | jeffleu/coding-challenges | /leetcode/easy/nextGreaterElement1/nextGreaterElement1.js | UTF-8 | 322 | 3.359375 | 3 | [] | no_license | /**
* @param {number[]} findNums
* @param {number[]} nums
* @return {number[]}
*/
const nextGreaterElement = (findNums, nums) => {
return findNums.map(n => {
const nIndex = nums.indexOf(n);
for (let i = nIndex + 1; i < nums.length; i++) {
if (nums[i] > n) return nums[i];
}
return -1;
});
}... | true |
8c52f9c173621c2a517c0eea1904b0391b16f169 | JavaScript | jozhi/jozhi.github.com | /demo/big-screen/resource/js/components/resetScreenSize.js | UTF-8 | 623 | 2.8125 | 3 | [] | no_license | function resetScreenSize() {
function init() {
var _el = document.getElementById('app');
var hScale = window.innerHeight / 1080;
var wScale = window.innerWidth / 1920;
_el.style.transform = 'scaleX(' + wScale + ') scaleY(' + hScale + ')'
_el.style.marginLeft = -((1920 - win... | true |
302d26a1c1dfddb641fbdee4c484cf87dc60b7c3 | JavaScript | ashishshah1995/Weather-API | /Weather-API/main.js | UTF-8 | 453 | 3.25 | 3 | [] | no_license | // Print out data to the console
// Make it flexible with ARGV key
const weather = require('./weather.js');
let city = process.argv.slice(2);
city.forEach(data1 => {
weather.get(data1);
});
// If the users types number it will change the q to id
if (isNaN(city)===false){
//generate an country ID query li... | true |
8fcab9cd23f8b31c422d8042446c95470d86bca6 | JavaScript | anasfaraz/virtusa-frontend-pattern-matching | /src/service/authentication.js | UTF-8 | 5,869 | 2.5625 | 3 | [] | no_license | import axios from 'axios'
export const USER_NAME_SESSION_ATTRIBUTE_NAME = 'authenticatedUser'
class AuthenticationService {
register(firstname,lastname, email, password) {
return axios.post('https://virtusa-api.herokuapp.com/api/auth/signup', {
firstname,
lastname,
ema... | true |
2b8b8171efa825678a6a1453638c3c63c1cf0c5b | JavaScript | homestuckITA/homestuckita.github.io | /new animations/31/script.js | UTF-8 | 4,018 | 2.546875 | 3 | [
"MIT"
] | permissive |
//Page 31 - John & his CDs
window.onload = function() {
// Put the location of the images here!
var Prefix = "https://homestuckITA.github.io/new animations/31/";
/* LINKS */
var BQLink = "https://homestuck.com/bard-quest";
var PSLink = "https://homestuck.com/problem-sleuth";
var JBLink = "https://homest... | true |
2b0ba1499917759dcda2751b84a4d1ede8778e10 | JavaScript | RIHAB2021-CH/CP-Redux | /src/JS/Reducers/reducerTasks.js | UTF-8 | 987 | 2.921875 | 3 | [] | no_license | import { ADDNEW,DELETED,COMPLETED, EDITED} from "../constants/ActionTypes";
const intialState = [{id:Math.random(),
description:"Bouton EDIT A REPARER",
isDone:true,},{id:Math.random(),
description:"Task 2",
isDone:false,},
{id:Math.random(),
description:"Task 3",
isDone:true,}];
co... | true |
b822acd8b54315e167c09d632df6fce69bed0855 | JavaScript | TrekFuel/home_tasks_FE-2 | /public_html(hw-6)/js/app.js | UTF-8 | 1,067 | 2.59375 | 3 | [] | no_license | function eventListeners() {
// eslint-disable-next-line no-undef
const rest = new Rest();
// eslint-disable-next-line no-undef
const ui = new Ui();
ui.loadAllPostsButton.addEventListener('click', (event) => {
event.preventDefault();
rest.getAllPosts()
.then(ui.renderResponses);
});
ui.load... | true |
aa301ec1b9b2f0456f7a4123c72390fcfc912f7b | JavaScript | Dkhuonghp/Question | /js/app.js | UTF-8 | 555 | 3.171875 | 3 | [] | no_license | //using selectors inside the element
// traversing the dom
// const question = document.querySelectorAll(".question");
// question.forEach(function (orange){
// const
// });
// currentTarget : là phần tử lắng nghe sự kiện
// target : phần tử kích hoạt sự kiện
const btns = document.querySelectorAll(".question-b... | true |
b1128ba45065c695c918a557ebb406ee7e515d54 | JavaScript | Lissa10ten/homeworks | /classw26Apr.js | UTF-8 | 1,286 | 2.734375 | 3 | [] | no_license |
// confirm() && null || false
// confirm() && "dskljf" || false
// (confirm() && "ddd") &&
// var i = 0
// arr[i++] = i++
// arr=[]
// var i=0
// arr[i++] = i*5
// arr [5,10,15,20]
// var i = 0
// arr[i++] = ++i
// =>
// arr = []
{/* <body>
<div>
<span>Enter a data please:</span><br... | true |
279f327444dfc8d7494a7cf3f0cb38d035dd0e87 | JavaScript | hotel-eme/tp-web | /mobile/src/screens/18.PerfilDev.js | UTF-8 | 1,439 | 2.734375 | 3 | [] | no_license | import axios from 'axios';
import React, { useState } from 'react';
import { Button, Image, Text, TextInput, View } from 'react-native';
export function PerfilDevScreen() {
var [foto, setFoto] = useState(null);
var [id, setId] = useState(null);
var [nome, setNome] = useState(null);
var [repositorio, setReposit... | true |
473bb579c9eec0afbd7706a482a2ca8be9d4a6be | JavaScript | ga-wolf/WDi14-Homework | /DanielHarsanyi/week_01/28-1-16/verbing.js | UTF-8 | 1,104 | 4.9375 | 5 | [] | no_license | //Create a function called verbing. It should take a single argument, a string. If its length is at least 3,
//it should add 'ing' to its end, unless it already ends in 'ing', in which case it should add 'ly' instead.
//If the string length is less than 3, it should leave it unchanged. For example:
//verbing('swim'): ... | true |
6de6a780e4a26339fa37cecba7c86fc85011151b | JavaScript | nss-day-cohort-50/will-you-be-mine-team-venus | /scripts/Facilities.js | UTF-8 | 2,805 | 3.046875 | 3 | [] | no_license | import { getFacilities, getTransientState, setFacility } from "./dataAccess.js"
const facilities = getFacilities()
const transientState = getTransientState()
document.addEventListener("click",
(event) => {
try {
const itemClicked = event.target.name
const [, facilityId] = itemClick... | true |
dd626be8a49acd9eea86b63f85c5b463f66b70b1 | JavaScript | HelenTim/vue-project | /es6/变量赋值解构/index.js | UTF-8 | 1,804 | 3.96875 | 4 | [] | no_license | // let a = 1
// let b = 2
// let c = 3
// let [a, b, c] = [1, 2, 3]
// let [foo, [[bar], baz]] = [1, [[2], 3]]
// console.log(bar) //--->2
// let [, , third] = ['a', 'b', 'c']
// console.log(third) //--->c
// let[x, y] = [1, 2, 3]
// console.log(x, y) //--->1 2
// let[head, ...tail] = [1, 2, 3, 4]
// con... | true |
6adbb54f7feeca99620f189ddc5445f7c1463335 | JavaScript | pan-pawel/leavetracker-frontend | /src/helpers/fakeBackend/desks.js | UTF-8 | 1,629 | 2.609375 | 3 | [] | no_license | export const desksApi = desks => (opts, url, resolve, reject) => {
if (url.endsWith('/desks')) {
switch (opts.method) {
case 'GET':
const responseJson = { desks };
resolve({ json: () => responseJson });
return;
case 'POST':
let params = JSON.parse(opts.body);
if... | true |
bc7b37f72aa8420aac253e67c628a3f429aef6c7 | JavaScript | its-a-wrap/aoc-2019-day-1- | /src/index.js | UTF-8 | 283 | 3.640625 | 4 | [] | no_license | import fs from 'fs';
const data = fs.readFileSync('./numbers.txt');
const numberArray = data.toString().split('\n')
let totalFuel = 0;
numberArray.forEach(number => {
const divdedNumber = Math.floor(number / 3);
totalFuel += divdedNumber - 2;
});
console.log(totalFuel); | true |
8a1f8169c35546520a560d6d9787fbcab6b3dafd | JavaScript | dangyue1214/hello | /范文凯/fanwenkai.js | UTF-8 | 548 | 3 | 3 | [] | no_license | <script>
//1.创建ajax的实例
let xhr = new XMLHttpRequest();
//2.请求配置项
xhr.open("get","txt",true);
console.log(xhr);
//3.监听状态改变 0~663353端口号范围
xhr.onreadystatechange = function(){
//ajax的状态为2的时候
if(xhr.readyState ===2){
}; //服务器返回的HTTP网络状态码为200并且已经获取了请求主体内容
if (xhr.readyState === 4&&xhr.status === 200){
//获取服务器返回的响应... | true |
01bebcdc612acc7ce94c2a6665107c1da6a0462d | JavaScript | ismenialeao/atividade3 | /exercicio5.js | UTF-8 | 1,260 | 4.875 | 5 | [] | no_license | // 5 - Vamos criar uma calculadora com as 4 operações matemáticas básicas? rs
// a) Deverá ser possível escolher uma operação aritimética em forma de string: 'soma', 'multiplicacao',
//'divisao' e 'subtracao'
// b) Deverá ser possível passar 2 números para a operação escolhida
// c) Deverá retornar o resultado e impr... | true |
47b1f91a19e6921801b4f5b17894ffd6422b00dd | JavaScript | Aditya-Thakur/TODO | /scripts/script.js | UTF-8 | 2,826 | 3.25 | 3 | [] | no_license | var tasks = [{
"id": 1,
"value": "Get Newspaper"
},
{
"id": 2,
"value": "Get Milk"
},
{
"id": 3,
"value": "Do Laundary"
},
{
"id": 4,
"value": "Cook Lunch"
},
{
"id": 5,
"value": "Visit Gran... | true |
27210c94d6c8e64a83022e13742a783d048a30f4 | JavaScript | Knewton/react-toolbox | /components/date_picker/CalendarMonth.js | UTF-8 | 2,902 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { range } from '../utils/utils';
import time from '../utils/time';
import CalendarDay from './CalendarDay';
class Month extends Component {
static propTypes = {
disabledDates: PropTypes.arrayOf(PropTypes.instanceOf(Date)),
e... | true |
ecb9f932cc7fc305c2e58289f4e4834266bf8d5e | JavaScript | astik/experiment-mongo-change-stream-and-sse | /node-worker/src/index.js | UTF-8 | 831 | 2.78125 | 3 | [] | no_license | import starwars from 'starwars';
import { initDb } from './initDb.js';
const config = {
db: {
username: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
url: process.env.DATABASE_URL,
name: process.env.DATABASE_NAME,
},
tempoInSecond: process.env.TEMPO_IN_SECOND,
};
console.log('conf... | true |
50eb4889bba905039881b35155964fb29c4a87f4 | JavaScript | ermannod/js-jsnacks-blocco-1 | /6/script.js | UTF-8 | 130 | 3.59375 | 4 | [] | no_license | var n = parseInt(prompt('enter a number'));
for (var i = 1; i <= n; i++) {
var cube = Math.pow( i , 3);
console.log(cube);
}
| true |
94de670ee3e8182a8b56c371d73bd1e90e2ddbcf | JavaScript | yzzhuozhuo/Daily | /trainingJs/instanceof.js | UTF-8 | 505 | 3.734375 | 4 | [] | no_license | /*
instanceof 判断原理:就是判断右边变量的prototype在左边变量的原型链上即可
因此instanceof 在查找的过程中会遍历左边变量的原型链,直到找到右边变量的prototype。
*/
function instanceOf(left, right) {
let rightPrototype = right.prototype;
let leftProto = left.__proto__;
while (true) {
if (leftProto == null) {
return false;
}
if (leftProto == rightProto... | true |
b5ea7b481ea97313157fb022aec78b334f613dcc | JavaScript | liulinboyi/Introduction-to-graphics | /apps/01-2d/index.js | UTF-8 | 2,107 | 2.5625 | 3 | [] | no_license | // import { initGL } from "../../lib/boot/initGL.js";
// initGL()
/**
import RenderContext from '../../lib/RenderContext'
const gl = RenderContext.getGL()
const program = RenderContext.getProgram()
console.log(gl)
console.log(program)
*/
import { Model, shape } from '../../lib'
import RenderContext from '../..... | true |
cfbb4be5848ce0635a6263a7e24e4a558fc9f7c9 | JavaScript | wdoironlarue1/game_board | /src/checkers/checker.js | UTF-8 | 1,013 | 2.515625 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
import "./checker.css";
class Checker extends React.Component {
static propTypes = {
color: PropTypes.string,
row: PropTypes.number,
column: PropTypes.number,
setSelectedPiece: PropTypes.func,
isSelected: PropTypes.bool,
isKing: P... | true |
cd7d244bd981cd4e328abddabea37a26594f2b34 | JavaScript | DiazLighuen/Grupo10Taller | /js/login.js | UTF-8 | 990 | 3 | 3 | [
"MIT"
] | permissive | /**
* Login functionality
*/
$("#loginForm").submit(function (e) {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
/* Prevent the form from submitting natively */
e.preventDefault();
/* If the the username or password is empty,... | true |
6f6bb6e127e223f6612761c9f6ddb00e18e404b2 | JavaScript | TrungDuongNguyen/caelumRTS | /js/screens/play.js | UTF-8 | 1,824 | 2.53125 | 3 | [
"MIT"
] | permissive | game.PlayScreen = me.ScreenObject.extend({
/**
* action to perform on state change
*/
onResetEvent: function() {
//load map
me.levelDirector.loadLevel("Map");
this.handle = me.event.subscribe(me.event.KEYDOWN, this.keyPressed.bind(this));
me.game.world.addChild(me.poo... | true |
f535fc1a2044a809e02a2374798ec49dc2d36295 | JavaScript | lakeshbiyala/React-Sorting-Visualizer | /src/algorithms/heapsort.js | UTF-8 | 2,053 | 3.15625 | 3 | [] | no_license | import { swap } from './swap';
import colors from '../SortingVisualizer/colorCodes';
let count = 0;
const arrayBars = document.getElementsByClassName('arrayBar');
export const heapsort = (tempArr, speed) => {
count = 0;
const arr = tempArr.map(item => item.val);
sort(arr, arr.length, speed);
return {... | true |
2090da9ac0be19aaca12e6a2c1d9d6ccdf016f0e | JavaScript | goshovat/Telerik-Academy-1 | /Javascript UI & DOM/04.SVG/SVG/scripts/windows-start-menu.js | UTF-8 | 5,401 | 2.875 | 3 | [] | no_license |
function createText(posX, posY, content, fillColor, fontSize, fontFamily, fontWeight) {
if (fontSize === undefined) {
fontSize = 9.5;
}
if (fontFamily === undefined) {
fontFamily = "Arial";
}
if (fontWeight === undefined) {
fontWeight = "normal";
}
if (fillColor... | true |
9a6cfb0175953a6b15cce687c5835128422a3262 | JavaScript | jpark-dev/LHL_kata | /kata5.js | UTF-8 | 918 | 4.0625 | 4 | [] | no_license | const urlEncode = function(text) {
// define a new output string to be returned
let newText = "";
// define a starting index and ending index, to seperate strings starting and ending with an empty space
let startIndex = 0;
let endIndex = text.length;
// check if the string starts with an empty space
if... | true |