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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b0b67317b1a2aa32b6f494192d2c720143c60f90 | JavaScript | Danrley-Costa/shortUrl | /src/Controllers/Url.js | UTF-8 | 1,499 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict';
const mongoose = require('mongoose');
const Url = mongoose.model('Url')
//Rota que lista todos as URLs
exports.get = (req, res, next) => {
Url
.find({})
.then(data => {
res.status(200).send(data);
}).catch(e => {
res.status(400).send(e);
});
};... | true |
2eac01a21b088268c640d15d2966ebe0c7249690 | JavaScript | karminer60/React-Testing-Contact-Form | /src/App.test.js | UTF-8 | 1,206 | 2.609375 | 3 | [] | no_license | import React from "react";
import { render, fireEvent, screen } from "@testing-library/react";
import App from "./App";
import ContactForm from './components/ContactForm.js'
test("renders App without crashing", () => {
render(<App />);
});
test("submits user infromation and renders information on screen", async ... | true |
09addfedefd88a26b8298b9cf0ff20dce08dd15a | JavaScript | sjlaurino/Star-Wars-API | /app/components/swService.js | UTF-8 | 1,123 | 2.90625 | 3 | [] | no_license | import Vehicle from "../modules/vehicle.js";
// @ts-ignore
let _vehicleApi = axios.create({
baseURL: 'https://swapi.co/api/vehicles'
})
let _state = {
vehicle: [],
nextPrevVehicle: {
nextUrl: '',
previousUrl: ''
}
}
let _subscribers = {
vehicle: [],
nextPrevVehicle: []
}
function setState(prop, ... | true |
a3d87e5c8c88c4340213da75d3edc801f020711b | JavaScript | MathewAaron/portal-for-competitive-exams-for-blind-students | /Static/js/exampage.js | UTF-8 | 10,939 | 2.71875 | 3 | [
"MIT"
] | permissive | var i = 1, k, attempted = 1,distance;
function PysrcSTT(){
console.log("STT");
return $.ajax({
type: "POST",
url: '/student/SpeechRecog',
async: true,
});
}
function PysrcTTS(input){
return $.ajax({
type: "POST",
url: '/student/speak',
as... | true |
474d592a98cb6d737e0554999ab30bd4e340cb43 | JavaScript | Patrockanite/JavaScriptEtAngular | /Exercice_p55/JS/script.js | UTF-8 | 463 | 2.875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded",function(event){
let tableau =['a','b',6,'d',3,'b',99,'e',6,'e','c',15,'f',8,'b',6,'f',5,'b',338576,'f',057,'e'];
document.writeln(tableau[0]+"<br>");
document.writeln(tableau[2]+tableau[4]+"<br>");
let alphabet = ['a','b','c','d','e','f','g','h','i','j','k',... | true |
b5d36dcd7dcd3380739a877671a7e01ee9ba7c48 | JavaScript | neoDJS/api-cli-pro-man | /app/assets/javascripts/worker.js | UTF-8 | 771 | 3.21875 | 3 | [] | no_license |
// class Worker {
// constructor(val) {
// fetch(`http://localhost:3000/workers/${val}.json`)
// .then(resp => resp.json())
// .then(json => (this.json = json['data']))
// .then(data => this.init(data));
// }
// init(data) {
// this.id = data.id;
// ... | true |
697b5d73bc375ef110731e576250044001632037 | JavaScript | hrymel/Programming-Challenges | /charLocation/charLocation.js | UTF-8 | 1,213 | 3.40625 | 3 | [] | no_license | function charLocation(tex, wid, ch) {
var newArray = [];
var locations = [];
var lastRowChars = tex.split("").length % wid;
var neededChars = wid - lastRowChars;
console.log(neededChars);
//split into arrays the length of wid
do {newArray.push(tex.substring(0, wid)) }
while( (tex = ... | true |
969c8c04ad052552857eb9fddb075e1a67198f09 | JavaScript | lorenalugo/LIM009-hackathon-peliculas | /src/data.js | UTF-8 | 788 | 2.875 | 3 | [] | no_license | const getSearchData = (data) => {
const dataMovie = data.map(data => {
return { Title: data.Title, Poster: data.Poster, Year: data.Year };
});
return dataMovie;
};
const getId = (data) => {
const dataMovie = data.map(data => data.imdbID);
return dataMovie;
};
const getItemDetails = (data) => {
const d... | true |
2d18c13f262b88375858d86e35740fe092f51996 | JavaScript | andreassolberg/uwap | /appengine/apps/dev/js/controllers/appPicker.js | UTF-8 | 3,529 | 2.921875 | 3 | [] | no_license | define(function(require, exports, module) {
var appPicker = function(element, callback) {
this.selected = null;
this.callback = callback;
console.log("Initing app picker");
this.element = element;
$(this.element).on("click", "a", this.proxy(this.select));
};
/**
* Wraps a function to be called with r... | true |
3384e1b552a92500388a63aa254631038f8a855f | JavaScript | EQAR/deqar_frontend | /src/utils/validators.js | UTF-8 | 3,538 | 2.921875 | 3 | [] | no_license | import * as EmailValidator from 'email-validator';
import moment from 'moment'
export const validateRequired = (value) => {
if (!value) {
return 'This field is required!'
} else if (value.length === 0) {
return 'This field is required!'
}
};
export const validateEmail = (value) => {
if (!EmailValidato... | true |
b79ef0df4c5e65f36456728239d9f4ff906ec805 | JavaScript | tomerry/turf | /packages/turf-line-intersect/test.js | UTF-8 | 2,794 | 2.53125 | 3 | [
"MIT"
] | permissive | import fs from 'fs';
import test from 'tape';
import path from 'path';
import load from 'load-json-file';
import write from 'write-json-file';
import truncate from '@turf/truncate';
import { featureCollection, geometryCollection, lineString, polygon } from '@turf/helpers';
import lineIntersect from '.';
const director... | true |
83736bc498459399611986c069ad033673b49aa6 | JavaScript | Zhangzhenguo3352/webpack-4 | /src/mytest-file/props-dom.js | UTF-8 | 684 | 2.609375 | 3 | [] | no_license | import React, {Component} from 'react';
// 这节对 props练习 (es6)
class PropsState2 extends Component {
constructor(){
super();
{console.log(this)}
this.state = {
setNumber:2
}
}
//组件真实 渲染到 浏览器
//state = {setNumber:0}
render(){
return(
<div>... | true |
f6a2ec0897d523b29f34c0a8089ad63e7bdae0b3 | JavaScript | vladkabat/Store | /WEB/CustomerWeb/src/main/resources/src/reducers/products/frequencyConverters.js | UTF-8 | 2,923 | 2.734375 | 3 | [] | no_license | import {
SET_FREQUENCY_CONVERTERS
} from '../../constants/products/frequencyConverters'
import {
SORT_FREQUENCY_CONVERTERS_BY_PRICE_DESC,
SORT_FREQUENCY_CONVERTERS_BY_PRICE_ASC
} from '../../constants/products/sort/sortFrequencyConverters'
import {API_URL} from "../../constants/store"
const initialState = ... | true |
96a417328cf9f58f6206dcd8317ae354e2a83d47 | JavaScript | chungchi300/headfirst-js-for-leetcode | /87.scramble-string.js | UTF-8 | 194 | 2.75 | 3 | [
"MIT"
] | permissive | /*
* @lc app=leetcode id=87 lang=javascript
*
* [87] Scramble String
*/
/**
* @param {string} s1
* @param {string} s2
* @return {boolean}
*/
var isScramble = function(s1, s2) {
};
| true |
a9958a66187febd698ad3c0c10d6eef624e89191 | JavaScript | reesdraminski/spotify-playlist-analyzer | /public/js/app.js | UTF-8 | 16,451 | 2.96875 | 3 | [
"MIT"
] | permissive | // references to DOM elements
const searchBtn = document.getElementById("searchBtn");
const userSearchInput = document.getElementById("userSearch");
const cardContainerEl = document.getElementById("card-container");
const dataViewEl = document.getElementById("dataView");
const playlistSelectEl = document.getElementById... | true |
5ab13865c8256a64219786c215fa9110a0d1acf8 | JavaScript | ankit1910/test_block_chain | /main.js | UTF-8 | 1,566 | 3.375 | 3 | [] | no_license | // const SHA256 = require('crypto-js/sha256');
class Block {
constructor(index, timestamp, data, prevHash = '') {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.hash = '';
}
calculateHash() {
return (this.index + this.timestamp + JSON.str... | true |
723aa0ddf2c5903e8ee6ecd5f10a19b032ec50a6 | JavaScript | SAP/openui5 | /src/sap.ui.suite/test/sap/ui/suite/qunit/VerticalProgressIndicator.qunit.js | UTF-8 | 11,696 | 2.59375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | /*global QUnit */
sap.ui.define([
"sap/ui/thirdparty/jquery",
"sap/ui/qunit/utils/createAndAppendDiv",
"sap/ui/suite/VerticalProgressIndicator"
], function(jQuery, createAndAppendDiv, VerticalProgressIndicator) {
"use strict";
// prepare DOM
createAndAppendDiv("uiArea1");
createAndAppendDiv("uiArea2").style = "... | true |
226e89f151d7e0dea3c0fe0cbbcaccaf73962e11 | JavaScript | ShamshabadAnil/DemoApps | /ES6/hospital.js | UTF-8 | 313 | 2.53125 | 3 | [] | no_license | class Hospital{
constructor(id,name,phone){
this.id=id;
this.name=name;
this._phone=phone;
}
toString(){
return this.id+'-'+this.name;
}
set phone(phone){
this._phone=phone;
}
get phone(){
return 108;
}
}
module.exports=Hospital; | true |
deac0fe46c9c0ba8ab23b573216d29711bd9332d | JavaScript | abhilash26/face-primer | /assets/js/main.js | UTF-8 | 1,261 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | "use strict";
//entry point :
function main() {
JEEFACETRANSFERAPI.init({
canvasId: "canvas",
NNCpath: "assets/model/",
callbackReady: function(errCode) {
if (errCode) {
console.log(
"ERROR - cannot init JEEFACETRANSFERAPI. errCode =",
errCode
);
errorCal... | true |
02aec6c147b30b4730e3157b514a9eaf4da31a9b | JavaScript | team-lexues-academy/ma10 | /app/assets/javascripts/karuta.js | UTF-8 | 519 | 2.609375 | 3 | [] | no_license | $(document).ready(function(){
$('.karuta').bind("click",function(){
var elem = $(this);
if(elem.data('flipped')){
elem.revertFlip();
elem.data('flipped',false)
} else {
elem.flip({
direction:'lr',
speed: 50,
onBefore: function(){
elem.html(elem.siblings(... | true |
beaab7fc888c5854b5aa92fd547f31cd3220852b | JavaScript | jonnycut/Space_Invaders | /js/localStorage.js | UTF-8 | 4,059 | 3.234375 | 3 | [] | no_license | /**
* Created by UFO on 04.2016.
*/
/**Objekt playerData
* @param Das Objekt beinhaltet alle notwendigen Attribute und ein Spielstand zu speichern und ggf. wiederherstellen.
*/
var playerData = {
name: "",
diff: "",
level: "1",
live: "3",
highscore: "0",
design: "",
alien1: "0",
ali... | true |
74ecb34a0ea1807020ace0878db53c0cf931b759 | JavaScript | rocks6/hackumbc18 | /server.js | UTF-8 | 695 | 2.71875 | 3 | [] | no_license | // SETUP
// Bring in our dependencies
const path = require('path');
const express = require('express');
var bodyParser = require('body-parser');
// Bring in our routes
const api = require('./scripts/javascript/routes/api');
const static = require('./scripts/javascript/routes/static');
// Create an app variab... | true |
0487fd178f7c6fe89d525c324ca27eb13338462e | JavaScript | takanobu68/reShootingGame | /src/game/character/Shot.js | UTF-8 | 2,120 | 3.453125 | 3 | [] | no_license | import { Vector2 } from "../common/Vector2.js";
import { CharacterBase } from "../common/CharacterBase.js";
export class Shot extends CharacterBase {
/**
* @constructor
* @param {CanvasRenderingContext2D} ctx
* @param {number} x
* @param {number} y
* @param {number} w
* @param {number} h
* @para... | true |
ac90fe5f6b49c5fd86280494ec6387ab2ba942fc | JavaScript | wccttt/newMushroom | /详细页面/js/index.js | UTF-8 | 3,485 | 2.65625 | 3 | [] | no_license | /**
* Created by 29120 on 2018/9/21.
*/
//let LIKE = (function () {
let Like = document.getElementById('like');
let List = document.getElementById('list');
let uls = List.getElementsByTagName('ul');
let contents=document.getElementsByClassName('content');
let data = null;
let minH = null;
... | true |
2bfc328394ebd8c2e705c190cf7da11e1b382594 | JavaScript | hochanlee96/HeraClass-Partners | /src/routes/EditStudio.js | UTF-8 | 8,183 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect, useCallback } from 'react';
import { useDispatch } from 'react-redux';
import { useRouteMatch, useHistory } from 'react-router-dom';
import * as authActions from '../store/actions/auth';
import Studio from '../models/studio';
const EditStudio = () => {
const dispatch = useDis... | true |
399bd577572557ee3c0db7943de482c803c6353d | JavaScript | drawwithcode/2018-group-work-group-14 | /js/oxy.js | UTF-8 | 1,231 | 2.890625 | 3 | [] | no_license | function Oxy(x, y, r) {
var options = {
friction: 0.2,
restitution: 0.8,
frictionAir: 0.01,
collisionFilter: {}
}
//CREATE the body
this.body = Bodies.circle(x, y, r*2, options);
//create an internal variable for the radius
this.r = r;
//adding the body to the world
World.add(world, t... | true |
c039bea6ba1572efe2ccef4dcecdfe621cc3a840 | JavaScript | lohaslive45/countdown-day-hour-min-sec-js | /app.js | UTF-8 | 1,357 | 3.65625 | 4 | [] | no_license | const countdown = () =>{
const countDate = new Date("May 25, 2021 00:00:00").getTime();//!---目標時間---
const now = new Date().getTime();//!---現在時間---
const gap = countDate - now;//!---相隔時間---
//console.log(countDate); //!---偵錯-印出數值--
//todo---時間換算>> 日/時/分/秒 時間單位,因為 getTime預設單位為 ms---
con... | true |
eef2414b45c2454d2d74dd954acbb033eab8dc69 | JavaScript | OlivierJM/textParser | /index.js | UTF-8 | 697 | 3.484375 | 3 | [] | no_license | function parseText(text) {
if (typeof text !== "string") throw new TypeError("Expected a string");
let filterSpace = item => item.length > 1;
let spacedWords = text
.split(" ")
.filter(filterSpace)
.map(word => `${word} `);
spacedWords.map((word, i) => {
if (!word.indexOf("_"... | true |
64b67cd8e66a6bfb5f8a742d243c46ba44e24c59 | JavaScript | kianma/SpaceWars | /MainMenu.js | UTF-8 | 3,328 | 3.140625 | 3 | [] | no_license | //declare variables
var background;
var title;
var shipSelect;
var star;
Game.MainMenu = function(game){};
Game.MainMenu.prototype = {
create: function(){
//add background
background = this.add.tileSprite(0,0,800,600, 'stars');
//star group
star = this.add.group();
star.enableBody = true;
this.time... | true |
036e5e8e62e586fc412bad6664b3cdda88fd5671 | JavaScript | Gyumong/whatwearing | /src/components/Test.js | UTF-8 | 1,633 | 2.546875 | 3 | [] | no_license | import React,{useState,useEffect} from 'react'
import axios from 'axios';
import { Descriptions } from 'antd';
const Test=()=> {
const [Data, setData] = useState([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
const URL =`https://api.openweathermap.org/data/2.5/onecall?lat=33.... | true |
d22b566806159e231f162ee3a37bd6c24c89ba79 | JavaScript | drb1220/rat-fiesta | /backups/rat.js | UTF-8 | 905 | 2.875 | 3 | [] | no_license | function loop(){
window.rat.update();
requestAnimationFrame(loop);
}
class Rat{
constructor(){
this.canvasElm = document.createElement("canvas");
this.canvasElm.width = 800;
this.canvasElm.height = 600;
this.gl = this.canvasElm.getContext("webgl2");
this.gl.clearColo... | true |
01bbfaba4aee306e1d4a1649109cfb738fd990ee | JavaScript | birdy90/ReactRA1 | /composition/accordion/js/index.js | UTF-8 | 1,038 | 2.828125 | 3 | [] | no_license | 'use strict';
class Accordion extends React.Component {
state = this.props;
toggler = (e) => {
let index = parseInt(e.target.getAttribute('data-index'));
data = data.map((item, itemIndex) => ({...item, index: index, open: index === itemIndex}));
this.setState(data);
};
render() {
return (
... | true |
4feecd5112a6a8e2c68cab71327e21e9995f42b6 | JavaScript | JamieMagee/triathlon-calculators | /body/weight_improvement/js/improvement.js | UTF-8 | 6,962 | 3.109375 | 3 | [] | no_license | // init function
function init() {
"use strict";
document.getElementById("WeightToday").value = 0;
document.getElementById("FutureWeight").value = 0;
document.getElementById("Distance").value = 0;
document.getElementById("MyHourTxt").value = 0;
document.getElementById("MyMinuteTxt").value = 0;
document.ge... | true |
814ab0c7a3aae677d72a56beb4d48bb17af795ed | JavaScript | brad-mortensen/JavaScript-III | /assignments/this.js | UTF-8 | 1,353 | 4.8125 | 5 | [] | no_license | /* The for principles of "this";
* in your own words. explain the four principle for the "this" keyword below.
*
* 1. Window Binding: If this is declared on a global scope it is bound to the window it is being run in.
* 2. Implicit Binding: If this is used to envoke a function with dot notation it is inplicitly bound.
... | true |
b760ad6f5dafc13e0bbed98f2d59e831f9e41d31 | JavaScript | lishuliang/leetcode-JavaScript | /leetcode/95.不同的二叉搜索树II.js | UTF-8 | 861 | 3.78125 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {number} n
* @return {TreeNode[]}
*/
function TreeNode(val) {
this.val = val;
this.left = this.right = null;
}
let generateTrees = function(n) {
if(n ... | true |
7ff25d66e8a2470c9fd19328afce5fa16a647c93 | JavaScript | ahmedhitec/myPublicRepo | /images/libraries/apex/widget.textField.js | UTF-8 | 4,758 | 2.796875 | 3 | [] | no_license | /*!
Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
* The text field item of Oracle Application Express.
*/
/*global apex*/
(function( item, $ ) {
"use strict";
const CASE_NONE = "NONE",
CASE_UPPER = "UPPER",
CASE_LOWER = "LOWER",
WS_NONE = "NONE",
... | true |
81916e0c5a5809962bd9ff4dfd4ead84a9e3e535 | JavaScript | sabeelhps/Web-Summer-Bootcamp-June21 | /Lecture-11/shopping-app/frontend/src/pages/Cart.js | UTF-8 | 1,757 | 2.578125 | 3 | [] | no_license | import React, { useContext } from 'react';
import UserContext from '../store/user-context';
import CartItem from '../Components/cart/CartItem';
import { Container,Col,Row,ListGroup,Button } from 'react-bootstrap';
function Cart(){
const currentUser = useContext(UserContext);
const cart = currentUser.car... | true |
ff7effcd137883479342e2a799e99518c12341f0 | JavaScript | fjsantosb/Molecule | /examples/example_07/scripts/game.js | UTF-8 | 1,496 | 2.953125 | 3 | [
"MIT"
] | permissive | Molecule({
width: 320,
height: 320,
globals: {
sprite: null
}
})
.sprite('flappy', 'assets/flappy.png', 34, 24)
.ready(function (game) {
// Change friction
game.physics.friction.x = 0;
game.physics.friction.y = 0.05;
// Change gravity (pixels per frame)
game.physics.gravity... | true |
f95181eb9be2d81842a64447ccb7cde350594ef8 | JavaScript | cloneforyou/content-review-lookup | /dist/carnage-test/PortableCSSPad.js | UTF-8 | 5,617 | 2.8125 | 3 | [
"CC-BY-4.0"
] | permissive | /**
* PortableCSSPad
*
* Creates a module that allows you to write or paste CSS rules.
* The primary script provides a simple API
**/
( function( window, $, mw ) {
"use strict";
function insertAtCaret( el, text ) {
text = text || "";
if ( el.selectionStart || el.selectionStart === 9 ) {
const sta... | true |
f6071a6cded4ae12d5d8a72af3ae4980a0342f46 | JavaScript | marak89/FizzBuzz | /fizzbuzz.js | UTF-8 | 333 | 3.3125 | 3 | [] | no_license | console.log('Wellcome to FizzBuzz!');
for(let i=1;i<=100;i++){
modulo3 = i%3;
modulo5 = i%5;
if(modulo3===0 && modulo5===0){
console.log('FizzBuzz');
} else if(modulo3===0){
console.log('Fizz');
} else if(modulo5 === 0) {
console.log('Buzz');
} else {
console.log... | true |
e536cb8837ed1d73738509d89c2172946cb612cb | JavaScript | ALittleWhiteRabbit/baidu_life | /Day39_41/js/hash.js | UTF-8 | 2,280 | 2.734375 | 3 | [] | no_license | let hash = {
region : '',
product :'',
regionSelect : null,
productSelect : null,
selectAll: null,
'setHash' : function () {
this.region = '';
this.product = '';
this.selectAll = document.querySelectorAll('input[checkbox-type=all]');
this.regionSelect = document.q... | true |
1d767cb0a08a68dd808730309e29346be4d77748 | JavaScript | DaveMDS/node-red-contrib-tasmota | /nodes/base_tasmota.js | UTF-8 | 6,410 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict'
const TASMOTA_DEFAULTS = {
// basic
broker: '', // mandatory
device: '', // mandatory
name: '',
outputs: 1,
uidisabler: false,
// advanced
fullTopic: '%prefix%/%topic%/',
cmndPrefix: 'cmnd',
statPrefix: 'stat',
telePrefix: 'tele',
qos: 1,
retain: false
}
const LWT_ONLINE = 'Onli... | true |
995457680e28ec50e9f6316e5a6f7c36ffda13f0 | JavaScript | trestletech/dallas-police | /scraper/scraper.js | UTF-8 | 1,967 | 2.78125 | 3 | [
"MIT"
] | permissive | // This is a PhantomJS Script
var fs = require('fs');
var page = require('webpage').create();
page.open('http://www.dallaspolice.net/MediaAccess/Default.aspx');
page.onLoadFinished = function(status) {
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
evalNext('', fun... | true |
52fef709baa6249ed0abbd4828c97cdb6ad617be | JavaScript | mlenoir42bis/frameworck-php | /frameworck-matcha/webroot/assets/javascripts/my/setting.js | UTF-8 | 1,526 | 2.71875 | 3 | [
"MIT"
] | permissive | function updateSettingData(name, firstname, email) {
let type = "POST";
let url = "/setting/updateSettingData/"
let data = {name: name, firstname: firstname, email: email};
function fRes(ret) {
ret = JSON.parse(ret);
displayMsg("#msg", ret);
$(".profile-usertitle-name").html(firstnam... | true |
20d8319a7157d74a105be0edb89814a565f1b852 | JavaScript | newsroomdev/geometric | /src/polygons/polygonRotate.js | UTF-8 | 309 | 2.828125 | 3 | [
"MIT"
] | permissive | import {pointRotate} from "../points/pointRotate";
// Rotates a polygon by an angle in degrees around an origin.
export function polygonRotate(polygon, angle, origin){
var out = [];
for (var i = 0, l = polygon.length; i < l; i++){
out.push(pointRotate(polygon[i], angle, origin));
}
return out;
} | true |
a027e4f8f42835c70305ec1ab96af887ffd5b4b9 | JavaScript | thecloaca/thecloaca.github.io | /space/js/index.js | UTF-8 | 1,480 | 3.375 | 3 | [] | no_license | var ctx = c.getContext("2d"),
stars = [],
initialStars = 50,
n = initialStars,
incrementStars = 5,
maxSize = 5,
mouse = false,
i;
c.width = innerWidth;
c.height = innerHeight;
ctx.fillStyle = "#fff";
function init() {
for (i = 0; i < initialStars; i++){
stars.push({
x: Math.f... | true |
367c42aaae0dfff0c7dee670da8d33f47a6302b8 | JavaScript | Milchelle/APIrest_Biblioteca.adonisjs | /app/Controllers/Http/ClienteController.js | UTF-8 | 3,162 | 2.578125 | 3 | [] | no_license | 'use strict'
/** @typedef {import('@adonisjs/framework/src/Request')} Request */
/** @typedef {import('@adonisjs/framework/src/Response')} Response */
/** @typedef {import('@adonisjs/framework/src/View')} View */
/**
* Resourceful controller for interacting with clientes
*/
const Cliente = use('App/Models/Cliente'... | true |
a69758cda338c97f0f55ba151f05691a5620c947 | JavaScript | moved0311/MasterThesis | /Chrome Extension Web Extractor/Chrome Extractor/preformat.js | UTF-8 | 712 | 2.59375 | 3 | [] | no_license | //when click download pre-format
//$('#downloadPreformat').click
function createPreformat(){
//read data and replace original element with custom defined label, like <jt-v></jt-v> ...
for(let k of Object.keys(data)){
let pos = $(data[k].pos);
let ifWrap = $(data[k].pos).parent(data[k].label).le... | true |
3bf5c3a088ed2b003bd139a97573f43323bfe15d | JavaScript | Dodge164/JS | /js/sandbox_Vol.4/js/proto.js | UTF-8 | 1,204 | 4.25 | 4 | [] | no_license | // __proto__
// Object.getPrototypeOf()
function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.voice = function () {
console.log(`Cat ${this.name} says "Miao"`); // Cat Lilu says "Miao"
};
const cat = new Cat('Lilu', 'white');
console.log(Cat.prototype);
cat.voice();
console.log(cat.... | true |
aecd067eceea52856de83169e3c6ee9c824ce2c3 | JavaScript | Slyteer/-WEB-R.I.P-Project | /backOffice/includehtml/mainUsers.js | UTF-8 | 1,075 | 2.6875 | 3 | [] | no_license | $(document).ready(function() {
$("#inputUsers").keyup(function() {
//console.log("yay");
$.ajax({ //create an ajax request to display.php
type: "GET",
url: "getUsersFromTextAJAX.php?inputText=" + $("#inputUsers").val() + "&isBanned=0" ,
dataType: "html", //expect html to be r... | true |
efdd643ecf5c4c63cb522c10aa1ab1169d35e44b | JavaScript | Uneedcode/vue-learn | /Vue-4/observer/dep.js | UTF-8 | 1,681 | 3.3125 | 3 | [] | no_license | /*
* @Author: uneedcode
* @Date: 2021-09-24 16:21:23
* @LastEditors: uneedcode
* @LastEditTime: 2021-09-24 19:22:38
* @Description: dep和watcher是多对多的关系
*/
// dep和watcher是多对多的关系
// 每个属性都有自己的dep
let id = 0; //dep实例的唯一标识
export default class Dep {
constructor() {
this.id = id++;
this.subs = []; //这个是存放watch... | true |
d7c7145ceb661f7f4ef6c59c2d3f17d40a8ddf95 | JavaScript | Shivamishra21/Node-authentication | /models/User.js | UTF-8 | 2,612 | 3.421875 | 3 | [] | no_license | // This is model part of mvc architecture . In model we store data our application is using like data base so here we basically created thev schema ie. how our collection will look like and then created a model and exported it to use in our controller functions
//PASSWORD HASHING PROCESS
//user_password + salt(it is ... | true |
5684b9dcac5522230a74954c0209c69c560d878b | JavaScript | crackAsmiles/angularPro | /index.js | UTF-8 | 764 | 2.71875 | 3 | [] | no_license | /**
* Created by zhagtingjiang on 2018/12/19.
*/
function readFileList(path,filesList,str) {
var fs = require('fs');
var files = fs.readdirSync(path);
var ingnor = ['node_modules','bower_components','static'];
files.forEach(function(itm){
var stat = fs.statSync(path + itm);
if (stat.is... | true |
a797cac35d2f15004cde35dca932e8e209315e9a | JavaScript | NielsenWeb/S-T-N | /script.js | UTF-8 | 3,754 | 2.671875 | 3 | [] | no_license | /* Navbar hide */
var prevScrollpos = window.pageYOffset;
var navSreen = document.getElementById("navbar-screen");
var navMobile = document.getElementById("navbar-mobile");
/* DropDown */
var dropMenu = document.getElementById("nav-mobile-drop");
var closeLayer = document.getElementById("close-layer");
/* Donation m... | true |
fe49e641c06a0b0b4c27a943933ce4a85a13a65e | JavaScript | unixpickle/auto-pause | /inject.js | UTF-8 | 3,090 | 3.046875 | 3 | [] | no_license | // The actual in-browser auto-pause script.
(function () {
function runAutopause() {
if (window.AUTO_PAUSING) {
return;
}
window.AUTO_PAUSING = true;
const popup = new Popup();
waitSongEnd().then(() => {
popup.cancel();
pauseSong();
... | true |
3d4fe17c21d714af4e2c57d4be55e5b9743ccf2a | JavaScript | silicona/angularjs | /ajax/controller.js | UTF-8 | 1,179 | 2.796875 | 3 | [] | no_license |
/* Se importan modulos en el array */
var app = angular.module('MiApp', []);
// $scope contiene la vista para pasar variables y mostrar datos
app.controller('PrimerControlador', function($scope, $http){
/* Asincrono - promise
.delete()
.get()
.head()
.jsonp()
.patch()
.post()
.put()
*/
$scope.datos... | true |
5a95b60b224a9f9952e034eff99e0338caeec754 | JavaScript | ArdaCraft/ardacraft.me | /style/js/fader.js | UTF-8 | 1,971 | 2.8125 | 3 | [] | no_license | function Fader(interval, fade, urls) {
this.interval = interval;
this.fade = fade;
this.top = "fader-top";
this.bottom = "fader-bottom";
this.urls = urls;
this.start = function() {
if (this.top === "" || this.bottom === "") {
return
}
var btm = document.getE... | true |
ffd4b5363dad6b2967cfd2212ae97aeff5ff191f | JavaScript | Omenstudio/hypermedia-library-web-ui | /src/js/request_maker.js | UTF-8 | 2,462 | 2.609375 | 3 | [
"MIT"
] | permissive | function invokeRequest(method, url, data, headers) {
var self = this;
var settings = {
'type': method || 'GET',
'headers': headers || { 'Accept': 'application/ld+json, application/json;q=0.1' },
'processData': false,
'data': data || null,
'dataType': 'text',
'asy... | true |
cc81f218a7f1dd85da4701f619241ea482927d93 | JavaScript | Tititesouris/MultiAgentSystems | /Particles/ParticlesAgent.js | UTF-8 | 1,876 | 3 | 3 | [] | no_license | class ParticlesAgent extends Agent {
constructor(environment, position, color, indecisiveness, direction, bounceBehavior, hitColor) {
super(environment, "Ball", position, color, indecisiveness);
this.direction = direction;
this.bounceBehavior = bounceBehavior;
this.hitColor = hitColo... | true |
ab5599c7773d7fe9032496497f944163a9773509 | JavaScript | ashiksayed8/javascript | /57iterateobject.js | UTF-8 | 224 | 3.4375 | 3 | [] | no_license | var obj = {
x: 40,
y: 60,
z: 75
}
// in operator=======
console.log('x' in obj);
console.log('p' in obj);
// for in loop=============
for(var i in obj) {
console.log(i);
console.log(i + ':' + obj[i]);
} | true |
aeae410c79b9972dc80df9fcdda66cb6b681a580 | JavaScript | rahmat-juniardi/javascript | /array.js | UTF-8 | 215 | 3.3125 | 3 | [] | no_license | function panggilArray() {
var data = [1,2,3,5,6,7]
var nama = ["abi","abi2","abi3"]
console.log(data.length)
console.log(nama.length)
console.log(nama[0])
console.log(data.toString())
}
panggilArray()
| true |
524dfe8fba2c1118b518e46739bc3d38d614a658 | JavaScript | Euchigere/mini-challenges-5 | /src/rotten-tomatoes/index.js | UTF-8 | 1,684 | 3.328125 | 3 | [] | no_license | function rottenTomatoes(grid) {
if (!Array.isArray(grid)) {
throw Error("Unsupported data format");
}
const ROW_LEN = grid.length;
const COL_LEN = grid[0].length;
// variable to be used later
let minute = 0;
let row;
let col;
let rotten;
let rottenCount;
// Helper f... | true |
ad8887b8edb529754074761f07f5cd796dee81ac | JavaScript | anapitalai/APEC-API | /test.js | UTF-8 | 3,344 | 3 | 3 | [] | no_license |
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// create a schema
var userSchema = new Schema({
name: String,
username: { type: String, required: true, unique: true
password: { type: String, required: true },
admin: Boolean,
location: String,
meta: {
age: Number,
website: String
},
created_at: Date,... | true |
f2da3576022d4c9c087bf74faa3140e1e1ce39bf | JavaScript | zohaib194/CodebaseVisualizer3D | /frontend/js/FDG/FDG.js | UTF-8 | 5,795 | 3.046875 | 3 | [
"MIT"
] | permissive | /**
* Function for making a Force-Directed-Graph object, manages nodes and links.
* @param {float} minDistance - Minimum desired distance between nodes.
* @param {float} maxDistance - Maximum desired distance between nodes.
* @param {float} gravityForce - Gravitational attraction to "gravityCenter".
* @param {THRE... | true |
7cfeba3758e9613bda52efa0fcc6ddabd8054d17 | JavaScript | isaiahaiasi/inv-app | /multerHandler.js | UTF-8 | 1,573 | 2.609375 | 3 | [] | no_license | // middleware for handling file uploads
const multer = require("multer");
// to create directory if it doesn't already exist
const fs = require("fs");
// to generate UUIDs for tmp files
const { nanoid } = require("nanoid");
// TODO: more elegant solution
const { UPLOAD_PATH } = require("./rootdir");
const getFileEx... | true |
a6b6f5cfa446613787ce1413a521a6603af94d3a | JavaScript | dovjay/phase0-xavier-fox | /week4/exercise6.js | UTF-8 | 719 | 3.4375 | 3 | [] | no_license | function hitungHuruf(kata) {
var arrKata = kata.split(" ");
var cekLetter = '';
for (let i=0; i<arrKata.length; i++) {
for (let j=0; j<arrKata[i].length; j++) {
cekLetter = arrKata[i][j];
for (let k=j+1; k<arrKata[i].length; k++) {
if (cekLetter === arrKata[i][k]) {
retur... | true |
c67f16eb03f5129ddd472ae1e9dd3c89af3e7466 | JavaScript | pavliggs/MortgageCalculatorJS | /script.js | UTF-8 | 7,021 | 3.28125 | 3 | [] | no_license | const CREDIT_MIN = 0;
const CREDIT_MAX = 15000000;
const FIRST_CONTRIBUTION_MIN = 0;
const FIRST_CONTRIBUTION_MAX = 7500000;
const RETURN_PERIOD_MIN = 1;
const RETURN_PERIOD_MAX = 30;
const creditText = document.querySelector('#creditText');
const creditRange = document.querySelector('#creditRange');
const firstCon... | true |
4c8cab79466842b7bffef40929fd4f8ba6cc67a4 | JavaScript | gaurav1992/dddd | /public/packages/pingpong/admin/js/charges-bonus.js | UTF-8 | 3,411 | 2.53125 | 3 | [
"MIT"
] | permissive | /** Function for convert 24 hour date format to 12 hour**/
function tConvert (timeString) {
// Check correct time format and split into components
var H = +timeString.substr(0, 2);
var h = (H % 12) || 12;
var ampm = H < 12 ? " AM" : " PM";
timeString = h + timeString.substr(2, 3) + ampm;
return timeString... | true |
46b1ab648b8aed18447194a3eac94011f32a4072 | JavaScript | cescoffier/hubu | /src/main/js/hubu-bind.js | UTF-8 | 5,558 | 3 | 3 | [
"Apache-2.0"
] | permissive | /**
* Hubu Binding extension
* This extension allows to bind components together.
* It is recommended to use <tt>topics</tt>.
* @constructor
* @class
*/
DE_AKQUINET.binding = function (hubu) {
/**
* The given hub.
* @private
* @memberOf HubuBindingExtension
*/
var hub = hubu;
/**
... | true |
f0d9bc7cf548e79c17940825df09f25394d8cb84 | JavaScript | Gutsu-Eric/js-2-b-156 | /lesson-06/src/index.js | UTF-8 | 2,256 | 3.015625 | 3 | [] | no_license | import isObject from "lodash/isObject";
import axios from "axios";
import { user } from "./data";
// console.table(user);
//
// for (const prop in user) {
// console.log(prop, user[prop]);
// }
// вовзращает массив имён свойств
// console.log(Object.keys(user.address));
// вернёт массив с парами свойств и значе... | true |
100c0b73423ad84c7f8b624783bcd0bf71f48a1b | JavaScript | PavelPavells/repositoryForWindows | /FreeCodeCamp/Introduction to the API's and Microservices Projects/URL-Shortener Microservice/app/checkURL.js | UTF-8 | 729 | 2.71875 | 3 | [
"MIT"
] | permissive | "use strict";
const checkURL = function (prot,url) {
const orig = prot + "//" + url;
const _prot = prot === "http:" ? require("http") : require("https");
const _url = require("url");
const options = {method: "HEAD",
host: _url.parse(orig).host,
path: _url.parse... | true |
8dfa2a9f35219823fc54e07b2f0aed424b1b609e | JavaScript | build-week-refugeestories/vlad-burlutskiy-frontend | /front-end/js/stories.js | UTF-8 | 1,098 | 3.03125 | 3 | [
"MIT"
] | permissive |
//fixed Navigation bar
const nav = document.querySelector('#main');
let topOfNav = nav.offsetTop;
function fixNav() {
if (window.scrollY >= topOfNav) {
document.body.style.paddingTop = nav.offsetHeight + 'px';
document.body.classList.add('fixed-nav');
} else {
doc... | true |
4e40a9b2463b85ccb071b6ba2c7eed75a374f674 | JavaScript | mikaelasquirchuk/JS05 | /class04 functions hoisting + scope/code/functions.js | UTF-8 | 1,611 | 4.03125 | 4 | [] | no_license | // Function Declaration
function doSomething() {
console.log("The doSomething function was called");
}
doSomething();
//Function Expression
var logSomething = function() {
console.log("The logSomething function was called");
}
logSomething();
function squareFive() {
console.log(Math.pow(5,2));
}
sq... | true |
28b467b56856b3af855fc0c400cbcf978620237e | JavaScript | nicholascloud/vette | /test/is-boolean.test.js | UTF-8 | 1,416 | 2.578125 | 3 | [
"MIT"
] | permissive | 'use strict';
var expect = require('chai').expect;
var isBoolean = require('../src/is-boolean');
describe('isBoolean', function () {
it('returns true for value true', function (done) {
expect(isBoolean(true)).to.be.true;
done();
});
it('returns true for value false', function (done) {
expect(isBoo... | true |
0e5a565a2cea743c6bbde7a794c6198c82f72b4c | JavaScript | javoire/dyslexia-friendly | /src/js/lib/store.js | UTF-8 | 2,506 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | /* eslint-disable no-console */
// default user config
var DEFAULT_CONFIG = {
// inputs:
// these are the `name="something-checkbox"` etc,
// names need to be manually in sync...
extensionEnabled: true,
fontEnabled: true,
rulerEnabled: true,
rulerSize: 30,
fontChoice: 'opendyslexic'
};
const updateChan... | true |
c500802ec43ae0e6eba9e1c4512ba4c7f8730ab7 | JavaScript | Al-Amin49/Basic-js-practise | /wildAnimals.js | UTF-8 | 476 | 3.84375 | 4 | [] | no_license | function animalCalculator(depth){
var animal=0;
if(depth<=10){
animal=depth*50;
}
else if(depth<=20){
var firstPart=10*50;
var remaining= depth-10;
var secondPart= remaining*100;
animal = firstPart+secondPart;
}
else{
var firstPart=10*50;
var secondPart=10*100;
var remaining= dept... | true |
040d5e1d1c15efb32ff296627946879586038f32 | JavaScript | bodicherlajay/WebRTCDHS | /test/userModelUnitTest.js | UTF-8 | 1,469 | 2.65625 | 3 | [] | no_license | /**
* @author Yogesh Randhawa
*/
/*jslint node: true, nomen: true, indent:2, todo: true, stupid: true*/
/*global describe, it, before, beforeEach, after, afterEach, done*/
'use strict';
var expect = require('chai').expect;
var bcrypt = require('bcrypt-nodejs');
var userModel = require('./../lib/model/userModel.js')... | true |
28d2055cd8da2be18e1cb371c2e5fe80b9fe2041 | JavaScript | KaminoShimobe/KSbot | /modules/mafia.js | UTF-8 | 18,861 | 2.59375 | 3 | [] | no_license | const Discord = require("discord.js");
const mysql = require("mysql");
module.exports = {
name: 'mafia',
description: 'Play mafia in a server.',
execute(message, args, bot, mafiaPlayers, mafiaServers, mafia, villagers, doctors, detectives) {
let messageArray = message.content.split(" ");
var werewolves = ... | true |
1b5d9914b799905224e6ee0dfb5f267d7ad2e121 | JavaScript | Payge/japxlate-android | /platforms/android/assets/www/js/search_interface.js | UTF-8 | 11,832 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | /**
* The look and feel of searching and search results
*
* @package JapxlateAndroid (https://github.com/drappenheimer/japxlate-android)
* @author Daniel Rhodes
* @copyright Copyright (c) 2013-2014 Warp Asylum Ltd (UK) [trading as "Dr Appenheimer"].
* @license see LICENCE file in source code root fold... | true |
4ea02594d299052b20608e994395664f3289147d | JavaScript | eunbin-lee/learning-redux | /velopert/redux/src/exercise.js | UTF-8 | 2,070 | 3.53125 | 4 | [] | no_license | import { createStore } from 'redux';
// [초기 상태]
const initialState = {
counter: 0,
text: '',
list: [],
};
// [action type 생성]
const INCREASE = 'INCREASE';
const DECREASE = 'DECREASE';
const CHANGE_TEXT = 'CHANGE_TEXT';
const ADD_TO_LIST = 'ADD_TO_LIST';
// [action 생성함수]
const increase = () => (... | true |
81819ac0168fdcf7c96c40645bdb6e35f2a17c28 | JavaScript | HafidzulEzani1624327/ClassActivity2 | /student.js | UTF-8 | 1,281 | 3.21875 | 3 | [] | no_license | class Student{
constructor(name, matricno, major){
this.name = name;
this.matricno = matricno;
this.major = major;
}
get Name(){
return this.name;
}
set Name(name){
this.name = name;
}
get MatricNo(){
... | true |
a0a75a3db201bb6476ee2fbd3e0b580799df37bf | JavaScript | Qu-xiaoyuan/dash-bio | /src/lib/components/Molecule3dViewer.js | UTF-8 | 3,825 | 2.734375 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Molecule3d from 'molecule-3d-for-react';
/**
* The Molecule3dViewer component is used to render schematic diagrams
* of biomolecules. It can display ribbon-structure diagrams, or
* render atoms in the molecule as sticks or spheres.
... | true |
c7ebb52e847243ce9f8225271d2a9d8f5b7fd3fc | JavaScript | Lisianthus-A/leetcode-js | /answers/0001-0500/0419. 甲板上的战舰.js | UTF-8 | 528 | 3.21875 | 3 | [] | no_license | /**
* @param {character[][]} board
* @return {number}
*/
var countBattleships = function (board) {
let res = 0;
for (let i = 0; i < board.length; i++) {
for (let j = 0; j < board[i].length; j++) {
if (board[i][j] === 'X') {
//通过左边和上边的值判断是否船头
if (board[i][j ... | true |
0403bf4b8611b0b681af2b1b9454ea536410b06b | JavaScript | mariavitoria0/TrabalhoFinal | /ATC3/Exercicio11.js | UTF-8 | 873 | 4.3125 | 4 | [] | no_license | /*ler valor de array n
utilizar laço de repetição para somar os numeros pares, sendo o numero dividido por 2 com resto igual a 0
e somar os números ímpares, sendo, os números divididos por 2 com resto diferente de 0
programa para a soma quando entrar um número maior que 1000
apresentar resultados */
var n = [2,56,32,2... | true |
2ada09e22514c21270fd60f8a0f7cff147692c7c | JavaScript | hpstream/MVVM | /demo1/ProxyData.js | UTF-8 | 549 | 3.1875 | 3 | [] | no_license | function ProxyData(data) {
// 判断是否数据是json 对象
if (typeof data !== "object")
return console.error(new Error("data is no not object"));
Error("data is not object");
for (let key in data) {
let val = data[key]; //
Object.defineProperty(data, key, {
enumerable: true,
configurable: false,
... | true |
40e1a6c4c11d55a8fc440935f1727ab3cf3ca385 | JavaScript | SpencerDWallace/PhotoAlbum | /main.js | UTF-8 | 13,164 | 2.59375 | 3 | [] | no_license | const targetElement = document.querySelector('#screen');
var windowW = $(window).width(); var windowH = $(window).height(); var cnv; var browserZoomLevel;
var sidebarActive = false; var sidebar; var sidebarW = windowW / 40; var sidebarH = windowH / 25;
var menuAnimation = false; var menuW; var menuH; var header; var... | true |
d7b2bab9971286537d361f8f37157cffcc46d84d | JavaScript | z19910517/vue-meme-editor | /src/components/js/ClassGraph.js | UTF-8 | 3,347 | 2.578125 | 3 | [] | no_license | export default class Graph {
constructor(ctx, x, y, w, h){
this.ctx = ctx
this.x = x
this.y = y
this.w = w
this.h = h
this.zIndex = 0
this.rotateDeg = 0
this.initDeg = 0
this.controlPathList = []
this.dragPath = null
this.draggi... | true |
2a89f7d12073730d4d8ba74b2d419c8a1d4fb665 | JavaScript | StevenVallarsa/Connect_Four | /js/Board.js | UTF-8 | 788 | 3.609375 | 4 | [] | no_license | class Board {
constructor() {
this.rows = 6;
this.columns = 7;
this.spaces = this.createSpaces();
}
/**
* Generates a 2D array of spaces
* @return {Array} An array of space objects
*/
createSpaces() {
const board = [];
for (let i = 0; i < this.colu... | true |
58cc0595b616bf25c733640b9be1e5d3a3b5bdc7 | JavaScript | ZrybeaWhitfield/javascriptMethods | /practice.js | UTF-8 | 625 | 3.75 | 4 | [] | no_license | let obj = {}
obj.color //expression evaluates
obj.color = "green"
console.log(obj);
let a = []
a[0] = "green"
obj["color"] = "red"
obj["weight"] = 4
console.log(obj);
let propertyName = "height"
let propertyValue = 6.2
obj[propertyName] = propertyValue
obj.propertyName = 5.3
console.log(obj);
let arr = ["white... | true |
05d28c938c1812e26d66396e9490a87f68fe8e72 | JavaScript | wejs/simple-hooks-callback | /lib/index.js | UTF-8 | 2,435 | 3.28125 | 3 | [
"MIT"
] | permissive | /**
* Hooks prototype
*/
var Hooks = function HooksPrototype (){
this.list = {};
// set hooks.log for show logs
this.log = null;
};
/**
* Register one hook method listenner
*
*
* @param {String} hookName
* @param {Function|Array} hookFunction function or array of functions to register in this hook
* ... | true |
0bcdd700eeb0f226a9dfb205460417d529f4a426 | JavaScript | etcchang/RockPaperScissors | /js/main.js | UTF-8 | 3,072 | 4.25 | 4 | [] | no_license | var botScore = 0;
var playerScore = 0;
// associate button presses with functions
// throwRock, throwPaper, throwScissors
document.getElementById('rock').onclick = throwRock;
document.getElementById('paper').onclick = throwPaper;
document.getElementById('scissors').onclick = throwScissors;
function throwRock() {... | true |
fc2ee644a8c05d371ed907d3e4b65417b5c305cf | JavaScript | borisbutenko/utilites | /dev/utils/methods/off.js | UTF-8 | 652 | 2.984375 | 3 | [] | no_license | 'use strict';
/**
* Удаляем обработчик на элемент
* @param eventName str event name
* @param handler callback
* @param eventDive boolean; default = false
*/
(function(node) {
node.prototype.off = function(eventName, handler, eventDive) {
let element = this;
if (node.prototype.removeEventListe... | true |
aecbd8fba94dbcd3eb3f6a6c8705106b32f5047a | JavaScript | supatchaikamaporn/pond-hub | /src/models/Person_context.js | UTF-8 | 419 | 2.53125 | 3 | [] | no_license | const axios = require("axios").default;
const Person_model = require("./Person_model").default;
class Person_context {
constructor(person = Person_model) {
this.person = person;
this.persons = [];
}
get_all_person() {
const url = "http://localhost:3000/persons";
return axios.get(url).then(response... | true |
65d0bf3c3b811fdcade30debe38db1ad5c0e4a29 | JavaScript | mcnalj/maine_codes | /mc_app/static/mc_app/javascript/answer_questions.js | UTF-8 | 6,641 | 2.84375 | 3 | [] | no_license | $(function(){
var questionNumber = 0;
var answerChoice;
var alreadyAnswered = false;
var postData = {};
var selection;
var questions = randomizeQuestions(originalQuestions);
showQuestion(questionNumber);
document.getElementById("answer_a").onclick = function() {
if (!alreadyAnswered){
postDat... | true |
4c459df0a7bc7e82b45a8c89228cecd4ef59a09e | JavaScript | taksenov/taksenov.github.io | /VanillaJS/DZ_10_08122016-master/calc/script.js | UTF-8 | 8,363 | 3.78125 | 4 | [] | no_license | 'use strict';
// Взять калькулятор, который был сделан в контексте ДЗ от 8 ноября.
// (url: https://github.com/taksenov/ls-js-hm-2/tree/master/hm2_3 )
//
// Если домашнее задание не сделано, то сейчас необходимо сделать.
// Необходимо модифицировать калькулятор следующим образом:
// Превратить калькулятор в Класс (конс... | true |
df0e536024ec9f7238313054d10c8f12d2189eb0 | JavaScript | willediger/React-Sorting-Hat | /react-sorting-hat/src/components/Question.js | UTF-8 | 973 | 2.734375 | 3 | [] | no_license | import React from 'react';
import './Questions.css';
class Question extends React.Component {
constructor(props) {
super(props)
this.state = {}
}
updateScores = e => {
const { name, value } = e.target;
this.setState({[name]: Number.parseInt(value)});
this.props.onChange({name: name, value: N... | true |
11a20477d0ecaf20696ab135fe889b1f9dfe10f5 | JavaScript | ntm/IDN | /main/js/formContact.js | UTF-8 | 418 | 2.625 | 3 | [] | no_license | /*
*/
function envoi() {
var question = window.document.formu.question.value;
var reMail = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(reMail.test(window.document.formu.inputEmail3.value)){
... | true |
d0b2cce5d714f5602226bb1dcf188f784b440ba7 | JavaScript | twiw49/template_with_login | /src/client/lib/makeId.js | UTF-8 | 283 | 2.890625 | 3 | [
"MIT"
] | permissive | const makeId = () => {
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
return [...Array(10).keys()].reduce((id, i) => {
id += possible.charAt(Math.floor(Math.random() * possible.length));
return id;
}, '');
};
export default makeId;
| true |
c7bbae6f037ca138811263bceb0ac490c153efc5 | JavaScript | Rezga12/gameoflife | /src/index.js | UTF-8 | 9,854 | 2.734375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import "./index.scss"
class Cell extends React.Component{
constructor(props){
super(props);
}
shouldComponentUpdate(nextProps, nextState) {
return nextProps.size !== this.props.size || this.props.className !== nextProps.clas... | true |
c1aa982629c516cc28f85a438b985568a87b20aa | JavaScript | Loronix/effectfuljs | /packages/debugger/__fixtures__/code.js | UTF-8 | 763 | 2.53125 | 3 | [
"MIT"
] | permissive | const { mod } = require("mod");
let v0 = 10;
function C(a) {
let v1 = 10;
try {
const v2 = 11;
var v3;
mod.proc1(mod.fn1(a), v0, v1, v2, v3);
for (const i of something) {
mod.proc2(i);
}
for (var i of something) mod.proc3(i);
var v4 = 100;
} catch (e) {
mod.proc4(e, v4, i);... | true |