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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40a22884e080237cf2ff39ce79b87138f9321e86 | JavaScript | apendua/very-simple-schema | /src/plugins/oneOf.js | UTF-8 | 3,963 | 2.53125 | 3 | [
"MIT"
] | permissive | import {
ERROR_VALUE_NOT_ALLOWED,
} from '../constants.js';
import {
isArray,
each,
every,
combine,
} from '../utils.js';
import {
validateIsObject,
} from '../validators.js';
const createValidateIsAllowed = (allowed) => {
const values = {};
const expected = [];
each(allowed, ({ isLiteral, value, ty... | true |
7276da2726cb254674ad966145ba912363bb8aad | JavaScript | matheushammarstrom/exercicios-trybe | /Fundamentos/bloco4_introducao_javascript_e_logica_de_programacao/dia3-logica-de-programacao-e-algoritimos/inverted_triangle.js | UTF-8 | 424 | 3.875 | 4 | [] | no_license | //Agora inverta o lado do triângulo.
let n = 10;
let line = "";
let symbol = "*";
let position = n;
for (let lineIndex = 0; lineIndex < n; lineIndex +=1){
for(let columnIndex =0; columnIndex < n; columnIndex += 1){
if(columnIndex < position){
line = line + " ";
}
else{
... | true |
5505a9cd6f2200d89007bdce1a45065283548f5a | JavaScript | tyqinjava/bbs | /WebRoot/javascript/getusercomment.js | UTF-8 | 2,857 | 2.640625 | 3 | [] | no_license | getuserpost_init();
function getuserpost_init(){
var respData=[];
var Length=10;
var loadMore=document.getElementsByClassName("loadMore")[2];
var ul=document.getElementsByClassName("user_comment")[0];
var uid=ul.getAttribute("_uid");
var url="/bbs/getuserdetail";
var xhr=new XMLHttpRequest();
xhr.open("POST", u... | true |
6cae311f550215e9857752e9116586e068543a3c | JavaScript | Mathis-web/PoulePoule-Online | /app/sockets.js | UTF-8 | 5,055 | 2.515625 | 3 | [] | no_license | const handleGameRooms = require('./gameRooms');
module.exports.listen = function(io) {
// receives the server as a function parameter and launch it
io.on('connection', socket => {
socket.on('newGame', createRoom);
socket.on('joinGame', joinRoom);
// socket.on('playerReady', onePlaye... | true |
bfd0e6ffed87fae0958d2288e479f44337b95a49 | JavaScript | cprebble/gaia-exercise | /helpers/connect-logger.js | UTF-8 | 3,467 | 2.5625 | 3 | [] | no_license |
let DEFAULT_FIELDS = ["url","method","status","responseTime","contentLength","reqheaders","remoteAddress","params"];
let path = require('path');
function getLogger(logger, options) {
let thislogger = logger
, level = options.logLevel || "info"
, fmtfields = options.loggerFields || DEFAULT_FIELDS;
return func... | true |
fd11fc10ae5b406d456d576a0ac99c2453cb0943 | JavaScript | lucasmc64/javascript_cev | /Aula14ex/ex016/script.js | UTF-8 | 1,280 | 3.03125 | 3 | [
"MIT"
] | permissive | var res = window.document.querySelector('div#res')
var p = window.document.createElement('p')
p.setAttribute('id', 'contar')
res.appendChild(p)
function iniciar() {
p.innerHTML = 'Preparando a contagem...'
}
var p2 = window.document.createElement('p')
p2.setAttribute('id', 'contando')
res.appendChild(p2)
p2.style.v... | true |
4e93b0a96067427a416b22f669b23787274baa71 | JavaScript | anim1311/Website | /projects/CreatureCreator/Creature creator/ButtonCreationMethods/AdvancedButtons/AllowBodyCollisionsToggleButton.js | UTF-8 | 465 | 2.9375 | 3 | [] | no_license | //this button toggles the allow body collisions boolean
function generateAllowBodyCollisionsToggleButton(x, y, w, h){
let toggleButton = new ToggleButton(x, y, w, h, "Allow Body Collisions", true);
toggleButton.toggleOn = () => {
allowBodyCollisions = true;
world.resetBodyCollisions();
};
... | true |
638a517e1be5d97d39722c4270c6f1884812a941 | JavaScript | GabeAboy/Algorithms | /functions/algorithm/triangle.js | UTF-8 | 448 | 3.734375 | 4 | [] | no_license |
console.log(tri(10));
function tri(n) {
var block = '*';
var space = ' ';
for(var i = 1; i <= n; i++) {
var blockStr = '',
spaceStr = '',
string = '';
for(var t = 0; t < (n - i); t++) {
spaceStr += space;
}
for(var j = 0; j < i; j++) {
... | true |
ffbb04bd696874f5f593d32b5370b9aef9c8046b | JavaScript | JamieScottC/RateMyGWU | /js/injectRate.js | UTF-8 | 2,988 | 2.921875 | 3 | [
"MIT"
] | permissive | constructPage();
var reaLink = "";
//Injects everything into page
function constructPage(){
//Loop through all the course rows
$('.crseRow1').each(function(i, obj) {
//Set currentTeacher
var currentTeacher = $(this).children().eq(6);
var teacherName = currentTeacher.text().substring(1, currentTeacher.text().ind... | true |
db7bb778127f0471397bfa6c24ad5f59e89c4af2 | JavaScript | rahulpunase/chat | /src/utils/util.methods.js | UTF-8 | 653 | 2.953125 | 3 | [] | no_license | const utilMethods = {
/**
* @param string {string}
* @param toLength {number}
*/
getSmallerString: (string, toLength) => {
const stringLength = string.length;
if (stringLength > toLength) {
return string.substring(0, toLength - 3) + '...';
} else {
return string;
}
},
nullCheck: (object, arrayOf... | true |
9bdc5e6ff096cbc1161fbb2c5e8b42fc2d1f1215 | JavaScript | jiraiyajr98/Canvas-Molecular-Lines- | /canvas.js | UTF-8 | 2,500 | 3.359375 | 3 | [] | no_license | var canvas =document.querySelector('canvas');
canvas.width=window.innerWidth;
canvas.height=window.innerHeight;
var c=canvas.getContext('2d');
var circlearray=[];
var close=[];
var maxRadius=2;
var distance=50;
var density=300;
var mouse={
x:undefined,
y:undefined
}
// c.beginPath();
// c.moveTo(x,... | true |
030c9d3c3db28f210054e95a6627760fb82c6061 | JavaScript | es92/web-wm | /src/PercentLayout.js | UTF-8 | 882 | 2.5625 | 3 | [] | no_license | // @flow
import React from 'react';
import WindowCompositor from './WindowCompositor.js'
type PercentLayoutProps = {
children: Array<React$Element>,
orientation: 'horizontal' | 'vertical',
}
export default function PercentLayoutManager({ orientation, children }: PercentLayoutProps) {
let windowPositions = {};... | true |
f5ad87c81b72739f8b49fa9c96045cfccccec6b8 | JavaScript | chezkevin/burger | /config/orm.js | UTF-8 | 1,335 | 3.28125 | 3 | [] | no_license | // require the database connection
var connection = require('./connection.js');
// export the functions
module.exports = {
selectAll: selectAll,
insertOne: insertOne,
selectScoped: selectScoped,
updateOne: updateOne
}
// each function below takes in callback as a parameter
// this way, it can take the data re... | true |
3db39ac89170b99b9a8167f29aa30f7cef5cc5fd | JavaScript | LoralieFlint/Sprint-Challenge-Applied-Javascript | /components/Cards/index.js | UTF-8 | 1,876 | 3.484375 | 3 | [] | no_license | /* creating component */
function cards(article) {
/* elements*/
const div1 = document.createElement("div");
const div2 = document.createElement("div");
const div3 = document.createElement("div");
const div4 = document.createElement("div");
const image = document.createElement("img");
const span = docume... | true |
d090cce8591a21ad9153b5448d6642841147ff38 | JavaScript | charlottemorgan/WDI-Final-Project | /src/components/ShoppingList.js | UTF-8 | 4,476 | 2.59375 | 3 | [] | no_license | import React from 'react'
import axios from 'axios'
import Auth from '../lib/Auth'
import { Link } from 'react-router-dom'
import { ToastContainer, toast } from 'react-toastify'
class ShoppingList extends React.Component {
constructor(props) {
super(props)
this.state = {
user: null
}
this.ite... | true |
457bd1519a6dbeb03ae658264b1766f945080ccd | JavaScript | borisyelnikoff/form-validation | /src/index.js | UTF-8 | 3,551 | 3.03125 | 3 | [] | no_license | import schemaBuilder from "./schemaBuilder.js";
import validate from "./validator.js";
import postData from "./httpService.js";
const API_URL = "https://przeprogramowani.pl/projekt-walidacja";
const inputFields = document.querySelectorAll("form input");
const nameInput = document.querySelector("#name");
const emailIn... | true |
1798295751f639544a24e308e2942dafe01eb998 | JavaScript | ALFIETAY/user-authentication-storage | /user-server/user.js | UTF-8 | 1,930 | 2.734375 | 3 | [] | no_license | const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
let SALT = 15
const userSchema = mongoose.Schema({
username:{
type: String,
required: true,
unique: 1,
trim: true
},
password:{
type: String,
required: true,
minlength: 6
},
... | true |
3dd6713bcf3e6e839b95d526010781a66ca16eaa | JavaScript | CaptainStorm21/Javascript-Regex-Udemy | /16-b-bounry.js | UTF-8 | 613 | 3.8125 | 4 | [] | no_license | let string1 = "testing a test to testify"
let pattern = /\btest\b /g;
// console.log(string1.match(pattern))
//test one separate word
let pattern1 = /\btest/g;
// console.log(string1.match(pattern1));
//[ 'test', 'test', 'test' ] - all words with test
let string2 = "testing your best test to testify";
let p... | true |
7aa7a73fdf0df0424187bf3e1d239dab74b06e36 | JavaScript | myYearOfCode/Studying | /hackerrank/newYearChaos.js | UTF-8 | 1,132 | 3.65625 | 4 | [] | no_license |
// https://www.hackerrank.com/challenges/new-year-chaos/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays&h_r=next-challenge&h_v=zen
// lineState = [2,1,5,3,4]
lineState = [2,5,1,3,4]
lineState3 = [1, 2, 5, 3, 7, 8, 6, 4]
function minimumBribes(lineState) {
let shortCou... | true |
2d6d7520192fafdb9bec5c79c5d6ab672be029d6 | JavaScript | Reinoptland/only-redux | /albums_reducer.js | UTF-8 | 799 | 3.0625 | 3 | [] | no_license | // albums_reducer.js
const initialState = [];
function reducer(state = initialState, action) {
switch (action.type) {
case "ADD_ALBUM": {
// => Ask yourself: what is action.payload?
return [...state, action.payload];
}
case "REMOVE_ALBUM":
return state.filter(album => {
if (albu... | true |
153904b61f3e5aae45f47e66c89b914983048f6b | JavaScript | ZackWard/react-tic-tac-toe | /src/stateManagement.js | UTF-8 | 3,003 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | // Use Redux with react-redux bindings for state management
// Because Tic-tac-toe state is fairly straightforward, let's keep the reducers, actions, etc in this file
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
const defaultState = {
playerMark: "X",
game: {
pa... | true |
ab1b6798a832b58b00ed6bc621badebf16ed30d3 | JavaScript | Riosahid25/Javascript | /13.switchpengkondisian/switch.js | UTF-8 | 848 | 3.40625 | 3 | [] | no_license | // var angka = prompt('masukan angka : ');
// switch (angka) {
// case '1':
// alert('anda memasukan angka 1 ');
// break;
// case '2':
// alert('anda memasukan angka 2 ');
// break;
// case '3':
// alert('anda memasukan angka 3 ');
// break;
// default:
... | true |
c8385876192801e9eaee2b0cd601966854d1e1b2 | JavaScript | mannyyang/the_mixer | /controllers/recipes.js | UTF-8 | 1,838 | 2.578125 | 3 | [] | no_license | const router = require('express').Router();
const Recipe = require('../models/recipes');
const auth = require('../services/auth');
const User = require('../models/users');
/**
* on /recipes/, display a random beverage in home page (home.html).
*/
router.get('/', auth.restrict,
Recipe.randomBeverage,
(req, res) => ... | true |
926a67ba2ce9272fefda61bcd9af60c0fe9ddee9 | JavaScript | Mekylei-Belchior/desenvolvimento-front-end | /TypeScript/3.avancado/app/dist/js/decorators/LogPerformace.js | UTF-8 | 752 | 3.078125 | 3 | [] | no_license | export function logPerformace(emSegundos = true) {
return function (target, propertyKey, descriptor) {
const metodoOriginal = descriptor.value;
descriptor.value = function (...args) {
let divisor = 1000;
let unidade = 'segundos';
if (!emSegundos) {
... | true |
40a87f4612cce684de974f88c3e9013ed57bd8f9 | JavaScript | joseangel2000/joseangel2000.github.io | /primesmaller.js | UTF-8 | 678 | 3.328125 | 3 | [] | no_license | function myFunction5() {
var x = document.getElementById("number5").value;
const max_size = x + 1;
var criba = [];
for(var i = 0; i < max_size; ++i){
criba[i] = true;
}
criba[0] = false;
criba[1] = false;
var primos = [];
var sr = Math.sqrt(max_size - 1);
... | true |
1c1c0a15d480f26679c702b32c699f56f7e88fc0 | JavaScript | Skullet-on/mayaClient | /src/components/faq/index.jsx | UTF-8 | 989 | 2.78125 | 3 | [] | no_license | import React, {Component} from 'react';
import FaqItem from './faq-item';
import './faq.css';
export default class Faq extends Component{
constructor(props) {
super(props);
this.state = {
faqList: [],
active: 0
}
}
componentDidMount() {
this.getData()
}
getData(){
fetch('/api/faq')
.then(res... | true |
c921e477381214b516a1c70eebbf59d24466361e | JavaScript | curioussavage/terminal-todo | /dist/test-view.js | UTF-8 | 833 | 2.546875 | 3 | [] | no_license | 'use strict';
var blessedoo = require('blessedoo')();
var context = {
doStuff: function doStuff() {
console.log('ham');
},
doStuff2: function doStuff2() {
console.log('meow');
}
};
function rows() {
return [['title', 'description', 'due'], ['hello', 'htis is the description', '2016-10-06'], ['hell... | true |
9713f636df465efd7896a1c8ea5ef8b0939aac57 | JavaScript | Ryuzaki051/CursoTitulacion | /Semana 2/js/script.js | UTF-8 | 3,434 | 3.234375 | 3 | [] | no_license | //var equipos=["pumas","atlate","America"]; //Manejo de arreglos
var opciones=["Piedra","Papel","Tijeras"];
var maximo=2; var minimo=0;
function rango(minimo,maximo){
var numero=Math.floor(Math.random()*(maximo-minimo+1)+minimo);
return numero;
}
var opcionMaquina=rango(0,2);
function resultado(result){
document.w... | true |
5e19acfeb84517ce017953a390263c83b25d1b21 | JavaScript | rodoard/flickr-search | /src/flickr_search/components.test.js | UTF-8 | 682 | 2.703125 | 3 | [] | no_license | import Components from './components'
import {template} from '../__utils__/helpers'
describe('Components', () => {
it("returns object with elements from document", ()=>{
document.body.innerHTML = template()
const components = Components(document)
const actualKeys = Object.keys(components).sort()
... | true |
d842db2679deaee35cc86eff94d1daaea74c05e7 | JavaScript | MartinVollenweider/interaktiveMedien_II_Javascript | /01_variablen/01_01_variablen_beispiele/01_01_02_Variablen_Objekte/js/control.js | UTF-8 | 164 | 2.84375 | 3 | [] | no_license | // unterusuche die verschiedenen Eigenschaften eines Bild-Objekts
// bspw. src, alt, width ...
let bild = document.querySelector('#bild');
console.log(bild.src);
| true |
5075529d05a5c0b12a1f1e179a839d37c8afc81f | JavaScript | 18613109040/vb-new | /client/utils/form.js | UTF-8 | 1,015 | 2.59375 | 3 | [] | no_license |
import fetch from 'isomorphic-fetch'
import {storage} from "./tools"
module.exports = (url,data,callback)=>{
var headers = new Headers();
headers.append('token',storage.get("token"))
return (function(url,data){
let formData = new FormData();
for (var key in data){
formData.append(key, ... | true |
222b1a07de1a085c82df03fcaea515c962683045 | JavaScript | beplaya/bulldozerserver | /public/js/game/objects/basic_object.js | UTF-8 | 3,131 | 2.625 | 3 | [
"MIT"
] | permissive | function BasicObject(id) {
this.id = id;
this.position = new Point(0,0);
this.speed = .1;
this.drag = 0;
this.hitRadius = 10;
this.target;
this.drawer = new BasicObjectDrawer(this, "#fff");
this.vector = new Vector();
this.dragOffset = 5;
this.oobDrag = -.00001;
this.setTar... | true |
7743e4ec1935fd42a3a66023807fdb999bccb5a5 | JavaScript | MosesDhiraviam/whe-whe-cash_register-app | /src/components/App.js | UTF-8 | 1,636 | 2.53125 | 3 | [] | no_license | import React from 'react'
import "../assets/css/App.css"
import Header from "./header"
import NumberList from "./numberlist"
import ResultOutput from "./resultOutput"
import CashComponent from "./CashComponent"
import Modal from "./modal"
import {useState} from "react";
const App = () => {
const [marks,setMarks]... | true |
8464f905c05f823303721f39b785c67338a35773 | JavaScript | christopherc1331/Custom-Ipsum | /src/zenOfPython.js | UTF-8 | 872 | 2.84375 | 3 | [] | no_license | export const zenOfPython = `Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicali... | true |
268f2b525b0b6425b9ca6fff175cb4837dd62c6a | JavaScript | Ranran318/web_publish_202002 | /b_coding/k_jquery/js/src/zoom.js | UTF-8 | 2,740 | 2.53125 | 3 | [] | no_license | (function($){
var url = '../img/gallery/';
var galleryImg = {
"big" : ['gallery_01.jpg', 'gallery_02.jpg', 'gallery_03.jpg', 'gallery_04.jpg'],
"thum" : ['gallery_01.jpg', 'gallery_02.jpg', 'gallery_03.jpg', 'gallery_04.jpg'],
"thumAlt" : ['gallery_01설명', 'gallery_02설명', 'gallery_03설명','gallery_04설명']
... | true |
e7413188026fbc2fabdc0b6f5004c70b0871ed15 | JavaScript | Neelam618/react-demo | /src/components/UseMemo.js | UTF-8 | 697 | 2.90625 | 3 | [] | no_license | import React, { useMemo, useState } from 'react'
export default function UseMemo() {
const [count, setCount] = useState(0)
const [item, setItem] = useState(10)
const multiplyCountMemo = useMemo(function multiplyCount() {
console.warn("multiplyCount function called")
return count * 10
}... | true |
4c3c7fe3bb45b301a4ce3e6fa6285872ac7593e9 | JavaScript | jdbence/FE-Nanodegree | /project3/js/explosion.js | UTF-8 | 1,287 | 3.171875 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* @description Key entity
* @constructor
* @param {int} row - The initial row
* @param {int} col - The initial column
*/
var Explosion = function Explosion(row, col) {
this.stars = [];
this.addStars(row, col, 10);
};
(function Prototype() {
/**
* @description Adds the stars
* @param {int}... | true |
204168fd1f6ade17a936f3a912e8bbb361e07b80 | JavaScript | spatools/grunt-msdeploypack | /lib/zip.js | UTF-8 | 1,509 | 2.828125 | 3 | [
"MIT"
] | permissive | var fs = require("fs");
var path = require("path");
var JSZip = require("jszip");
var xml = require("./xml");
function createFolder(rootFolder, dest) {
if (dest === "." || dest === "..") {
return rootFolder;
}
var zipFolder = rootFolder,
parts = path.normalize(dest).split(/\/\\/);
parts.forEach(function (... | true |
535bed56165dfda616133f40ebe6f19da974fa29 | JavaScript | silvanacuadra/Presentacion | /main.js | UTF-8 | 1,032 | 2.765625 | 3 | [] | no_license | const expand = document.querySelector("#expand");
const close = document.querySelector("#close");
const nav = document.querySelector("#nav-responsive");
const lista = document.querySelectorAll(".expand-nav");
const filtros = document.querySelectorAll(".filter");
const work = document.querySelectorAll(".one-work");
// ... | true |
dd021f31c917b1f9019ca9a965452fedb445bf0e | JavaScript | VNY04/Dice-Game | /dice.js | UTF-8 | 1,917 | 3.78125 | 4 | [] | no_license | function selectWinner(playerOne, playerTwo) {
if (playerOne > playerTwo) {
document.getElementById("header").innerHTML = "<h1>Player 1 is the Winner!!</h1>"
} else if (playerOne < playerTwo) {
document.getElementById("header").innerHTML = "<h1>Player 2 is the Winner!!</h1>"
} else {
... | true |
f417819bead02a004dae5f8de80fc9c8cc47c97a | JavaScript | jjuanrivvera/tf-critics-discord-bot | /src/commands/moderation/warn.command.js | UTF-8 | 1,110 | 2.546875 | 3 | [] | no_license | const { MemberHelper } = require('../../helpers');
module.exports = {
name: "Warn",
command: "warn",
description: "Warn a user",
usage: "warn <user> <reason>",
example: "warn @Alex For breaking the rules",
cooldown: 7,
requireArgs: 2,
accessibility: "mod",
clientPermissions: [
"SEND_... | true |
01bc1658473b7caded8ef9be65e0890356453a05 | JavaScript | FranDallasta/CursoIngresoJS | /3-InstruccionSwitch/jsInstruccionSwitch-09.js | UTF-8 | 1,174 | 3.140625 | 3 | [] | no_license | function mostrar()
{
let destino = document.getElementById("txtIdDestino").value;
let estacion = document.getElementById("txtIdEstacion").value;
const tarifaBase = 15000;
let tarifaFinal;
switch (destino) {
case "Bariloche":
if (estacion == "Invierno")
{
tarifaFinal = tarifaBase * 1.2;
}
else i... | true |
46d2d957590825182f9cc18f9a8248d2cd67dfdc | JavaScript | rickt25/covid-tracker | /js/script.js | UTF-8 | 1,283 | 3.234375 | 3 | [] | no_license | const total = document.getElementById('total-cases')
const positive = document.getElementById('positive')
const recover = document.getElementById('recover')
const death = document.getElementById('death')
const date = document.getElementById('date')
window.addEventListener('load', () => {
const preload = document.g... | true |
5494dec648822a80396051db499934de680f9063 | JavaScript | candycode/loco | /apps/locoplay-scripts/test30-arrays.js | UTF-8 | 1,052 | 3.109375 | 3 | [] | no_license | // Native array test
var p = Loco.console.println;
try {
var timer = Loco.sys.timer();
var SIZE = 10000;
var i = 0;
var jsArray = new Array( SIZE );
// double precision array
var cppArray = Loco.ctx.create( "Float64Array", {align:8,size:SIZE} );
p();
p( "Initializing javascript array with for loop" );
timer.start()... | true |
32d98e937f02075466f2cdc06936e19a7d324b2b | JavaScript | filipjakov/bootleg-promise | /lib/promise.js | UTF-8 | 2,416 | 3.046875 | 3 | [
"MIT"
] | permissive | const states = {
pending: 'Pending',
resolved: 'Resolved',
rejected: 'Rejected'
};
class BootlegPromise {
constructor(executor) {
// Async support
const laterCalls = [];
const callLater = getMember => cb => new BootlegPromise(resolve => laterCalls.push(() => resolve(getMember()(cb))));
// ... | true |
9a29c843ea314bf083b54bc9df8e17aaf79441f0 | JavaScript | snorthway/newPortfolio | /newPortfolio/static/js/gba_cities.js | UTF-8 | 2,622 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | d3.csv(csv_url, function(csv){
// make numbers slightly easier to deal with
for (var i=0; i<csv.length; i++){
csv[i].latitude = Math.round(csv[i].latitude*100)/100;
csv[i].longitude = Math.round(csv[i].longitude*100)/100;
}
var distanceMatrixCities = findDistanceMatrix(csv);
// append the data to csv inf... | true |
1bfed10bb28f6d440c2c034a808fae63dc5bd2d2 | JavaScript | ruanyl/hsl-app | /modules/utils/immutableUtils.js | UTF-8 | 678 | 2.671875 | 3 | [] | no_license | const _getField = (state, field) => state.get(field)
const _setField = (state, field, value) => state.set(field, value)
const _incField = (state, field) => state.set(field, state.get(field) + 1)
const _decField = (state, field) => state.set(field, state.get(field) - 1)
export const setField = field => value => state =... | true |
3f8e7cc60e96295256ceeb4d9c9e7aa74185de12 | JavaScript | mergerocks/media-scout | /src/utils/sort.js | UTF-8 | 681 | 2.9375 | 3 | [] | no_license | import { parse, compareAsc, compareDesc, parseISO } from 'date-fns';
export const sortByDate = (a, b, direction = 'asc', format) => {
const forSort = (value) => (format ? parse(value, format, new Date()) : parseISO(value));
console.log(a, b);
if (direction === 'asc') return compareAsc(forSort(a), forSort(b));
... | true |
8c75b20e912cde2f8dbd466f5ca202247412308a | JavaScript | blrobin2/exercism | /javascript/list-ops/list-ops.js | UTF-8 | 1,348 | 3.109375 | 3 | [] | no_license | module.exports = class List {
constructor(values = []) {
this.values = values;
}
append(list) {
for (let i = 0; i < list.values.length; i++) {
this.values[this.values.length] = list.values[i];
}
return this;
}
concat(list) {
return this.append(list);
}
filter(func) {
for (... | true |
9c27480eb48e965b810186e13404e094262ec064 | JavaScript | Vadim-SV/Londoners | /src/containers/App.js | UTF-8 | 1,389 | 2.546875 | 3 | [] | no_license | import React,{Component} from 'react';
import {connect} from 'react-redux';
import CardList from '../components/CardList';
import SearchBox from '../components/SearchBox';
import Scroll from '../components/Scroll';
import './App.css';
import {setSearchField} from '../actions';
const mapStateToProps =(state) => {
r... | true |
51c759a974fc5358dbf4f5bb673ff3af64d8117e | JavaScript | harrypatrick442/x-chat | /public/PmsOpenHistory.js | UTF-8 | 1,005 | 2.53125 | 3 | [] | no_license | function PmsOpenHistory(params){
var LIST_USERS = 'listUsers';
var PMS_OPEN_HISTORY='PmsOpenHistory_';
var id = PMS_OPEN_HISTORY+userMeId;
var userMeId = params.userMeId;
var settings = new Settings(id);
var set = new Set({getEntryId:getEntryId});
var tabPortal = new TabPortal({id:id});
this.add= functi... | true |
7c3d7a3f194ff1d9f79d9db7e4a4e63d0e69a75e | JavaScript | irvinlim/paranoid | /sample-app/static/auth.js | UTF-8 | 1,118 | 2.65625 | 3 | [] | no_license | const BASE_URL = window.location.origin;
const APP_NAME = 'Fakebook';
function startAuthFlow() {
// Prepare query string parameters
const params = new URLSearchParams();
params.set('app_name', APP_NAME);
params.set('origin', BASE_URL);
params.set('register_callback', '/auth/paranoid/register');
params.set(... | true |
aa1b5c18be99c0e4a7a5c1cc7d7cb5bc3e07dbd5 | JavaScript | dangvantu99CM/BaiTap111 | /NetBeansProjects/Project_Student/public_html/js/Validation.js | UTF-8 | 6,367 | 3.0625 | 3 | [] | no_license | // Dat gia tri can xu ly logic nho nhat la 1 ki tu
const MIN_LENGTH = 1;
// lon nhat la 255 ki tu
const MAX_LENGTH = 255;
// 1 mang luu tat ca cac truong can validation
let validationFields = [];
// 1 doi tuong validation >> luu cac truong can validation trong 1 doi tuong validation
//moi key trong doi tuong validation... | true |
c54cef58c98dc905d3b10f456c518d87c06e2dc2 | JavaScript | kaseyle/daydream | /public/js/riddle_1.js | UTF-8 | 2,008 | 3.453125 | 3 | [
"Apache-2.0"
] | permissive | var riddles = [
"Name four days of the week that start with the letter T.",
"A magician holding an egg above a concrete floor claims he can drop it two feet without breaking it. How?",
"A boy is locked in a room with only a piano and and a calendar. What does he eat, and how does he escape?",
"From what heavy seven... | true |
e4ce3b146ed5b6c2352a54620a4b00e9518970d3 | JavaScript | EylonKoenig/tactical_score_web | /src/components/leadingboard/Players.js | UTF-8 | 3,739 | 2.578125 | 3 | [] | no_license | import React, {useEffect, useState} from "react";
import api from "../../server-api/api";
const PlayersLeaderboard = () => {
const [players, setPlayers] = useState([]);
const [bestPlayers, setBestPlayers] = useState(false);
useEffect(() => {
const getPlayers = async () => {
let playe... | true |
a2d34876618d32cd95341669ef215b1b0d3b0aad | JavaScript | felipeafbruno/Exercicios-JS | /fundamentos/usandoVarLet.js | UTF-8 | 595 | 4.09375 | 4 | [] | no_license | /*
Variáveis declaradas com a palavra chave "var" possuem escopo global e de função.
*/
var valor = 10;
{
var valor = 20;
console.log('Dentro: ', valor);
}
console.log('Fora: ', valor);
/*
Variáveis declaradas com a palavra chave "let" possuem o escopo global, de função e de bloco;
Variáveis declar... | true |
f53abdfc125055146614ed0283247ea7027e3a06 | JavaScript | thinkful-ei-heron/Alex-Larry_MorningDrills | /minMax.js | UTF-8 | 547 | 3.984375 | 4 | [] | no_license | function max(numbers) {
let i = 0;
let maxNumber = numbers[i];
while(i < numbers.length) {
if(numbers[i] > maxNumber) {
maxNumber = numbers[i];
}
i++;
}
return maxNumber;
}
function min(numbers) {
let i = 0;
let minNumber = numbers[i];
while(i < numbers.length) {
if(numbers[i] < m... | true |
c5a1f1d8f9cbad2b681cee1f1d1482904c83b756 | JavaScript | tanikawa04/chord_helper | /test/chord_helper_test.js | UTF-8 | 2,517 | 2.53125 | 3 | [] | no_license | 'use strict';
import assert from 'assert';
import ChordHelper, {ChordParseError} from '../src/chord_helper';
describe('ChordHelper', () => {
describe('config: {includesBass: true, autoVoicing: false, lowerBound: 60}', () => {
before(() => {
ChordHelper.setConfig({
includesBass:... | true |
2bd96e1ec781eef45ee2029e374cc891d0028ac3 | JavaScript | DrMabuse23/sir-trevor-js | /src/formatters/base.js | UTF-8 | 3,620 | 2.515625 | 3 | [
"MIT"
] | permissive | /* Our base formatters */
(function () {
var Bold = SirTrevor.Formatter.extend({
title : "bold",
cmd : "bold",
keyCode : 66,
text : "B"
});
//var InlineH1 = SirTrevor.Formatter.extend({
// title : "h1",
// cmd : "formatInline",
// text ... | true |
9b98a2fd29fab5f596064452ce48c252862eb85d | JavaScript | jiangnan8/test_demo | /node/简单文件写入.js | UTF-8 | 411 | 3.125 | 3 | [] | no_license | /*
fs.writeFile(file, data[, options], callback)
fs.writeFileSync(file, data[, options])
- file 要操作文件的路径
- data 要写入的数据
- options 选项,可以对写入进行一定设置
-callback 写入完成 后执行的函数
*/
var fs = require('fs')
fs.writeFile('./hello3.txt', "这是通过writeFile写入的内容", function(err){
if(!err) {
console.log('写入成功')
}
}) | true |
eff64b987765f353470d5c66fa5d10b48047efe6 | JavaScript | Garajluc/aoc2019 | /index.js | UTF-8 | 1,097 | 2.78125 | 3 | [] | no_license | var express = require("express");
var server = express();
var base = require('./public/base');
var { day1 } = require('./public/day1/script.js');
var { day2 } = require('./public/day2/script.js');
server.get('/day1', (req, res) => {
const getData = base.getInput('/day1/input.txt', '\n');
const resultOne = day... | true |
81e7a0681bbadd86c22a759db503fd59061f67d0 | JavaScript | cchacons/domo-domination | /js/main.js | UTF-8 | 3,430 | 3.109375 | 3 | [] | no_license | var container, camera, scene, renderer, particles, geometry, material, i, sprite, size;
var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
var phrasesArray = ["Domo says: Relax", "Domo says: <inset witty comment here>", "Domo says: fuck that shit", "Domo say... | true |
dc30475b1d07385e67575678bb80b7124cba4ef2 | JavaScript | josephkane/gauntlet-jazz | /javascripts/gauntlet.js | UTF-8 | 1,051 | 3.046875 | 3 | [] | no_license | "use strict";
var Gauntlet = (function(gauntlet) {
let stillFighting = false;
let player = null;
let enemy = null;
gauntlet.getPlayer = () => player;
gauntlet.setPlayer = function(playerData) {
player = Gauntlet.Character.constructCharacter(playerData);
stillFighting = player && enemy;
};
gauntl... | true |
989de0d2f005f5f571560f27dd23b12b20bfc33c | JavaScript | carlospatinos/capabilityMonitor | /files/nodeApp/public/javascripts/global.js | UTF-8 | 3,445 | 3.015625 | 3 | [
"MIT"
] | permissive | // Userlist data array for filling in info box
var schedules = [];
var unwantedPrice = 2700;
// DOM Ready =============================================================
$(document).ready(function() {
// Populate the user table on initial page load
populateTable();
$('#schedules table tbody').on('click', '... | true |
8d57a6edcaf32f9b85ed27c442fbf5fc87955ab9 | JavaScript | jhars/To_Do_OOP | /scripts.js | UTF-8 | 1,419 | 2.734375 | 3 | [] | no_license | $(function(){
var ToDo = function (task, taskInfo, date){
this.task = task;
this.taskInfo = taskInfo;
this.date = date;
}
ToDo.all = [];
ToDo.prototype.saveArray = function() {
ToDo.all.push(this);
}
ToDo.prototype.renderTemplate = function() {
var $todo = $(toDoTemplate(this));
this.index = ToDo.all.ind... | true |
6f02756eee5be855148bbc359dc077414d3929b1 | JavaScript | connected-msims/battleship | /backend/engine/board.js | UTF-8 | 315 | 3.0625 | 3 | [] | no_license | const boardSquareTypes = [0, 1, 'Empty', 'PartOfShip'];
class board {
constructor(sideLength = 10) {
this.boardSquares = [];
for (let i = 0; i < sideLength; i++) {
let row = [];
for (let j = 0; j < sideLength; j++) {
row.push(0);
}
this.boardSquares.push(row);
}
}
} | true |
c1f5d2932eebf1b21f51888315e26a0f58da0c33 | JavaScript | mariyan250/SoftwareUniversity | /JS Advanced/06. DOM Manipulation/06. Time-Converter/solution.js | UTF-8 | 1,689 | 3.203125 | 3 | [] | no_license | function attachEventsListeners() {
const menu = document.querySelector('main');
const clickHandler = (e) => {
let days = "";
let hours = "";
let minutes = "";
let seconds = "";
switch (e.target.id) {
case 'daysBtn': {
const value = document.q... | true |
a0beb71307069c5780b8a2fbfbd9313ea0d54bcb | JavaScript | jonnycrunch/ipfs-provider | /src/providers/http-client.js | UTF-8 | 1,357 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict'
const PROVIDERS = require('../constants/providers')
// 1. Try user specified API address
// 2. Try current origin
// 3. Try multiaddr from defaultApiAddress
async function tryHttpClient ({ httpClient, apiAddress, defaultApiAddress, location, connectionTest }) {
// Explicit custom apiAddress provided. O... | true |
63a589a49e9b35deac71708684ae1f804fa0187e | JavaScript | vexler/First | /animate-script.js | UTF-8 | 1,916 | 2.6875 | 3 | [] | no_license | function animateWaypoint(classEl, destroy, visible, posStart) {
var classElIn = document.getElementsByClassName(classEl), hideEle = classElIn;
if (visible === 'hidden'){
$(classElIn).css('opacity','0');
}
var waypoint = new Waypoint({
element: classElIn,
handler: function (dir... | true |
33293e37a0d2aa99fd81392b885d677e7fba0228 | JavaScript | VTheodore/JavaScript-Fundamentals | /03. EXC- Syntax Operators And LF/p02AreaAndPerimeter.js | UTF-8 | 205 | 3.53125 | 4 | [] | no_license | function printAreaAndPerimeter(a, b) {
console.log(a * b) // Area
console.log(2 * (a + b)) // Perimeter
}
printAreaAndPerimeter(2, 2)
printAreaAndPerimeter(1, 3)
printAreaAndPerimeter(2.5, 3.14)
| true |
c809f0fed45002fa76abe2ca7368fed6db917992 | JavaScript | scitechnj/Web-Review | /MvcApplication8/Scripts/Person.js | UTF-8 | 512 | 2.703125 | 3 | [] | no_license | $(function() {
$("button").click(function() {
$("#addPersonModal").modal();
});
$("#addPerson").click(function() {
var form = $("form");
var text = form.serialize();
form.find("input").val('');
$.post('/person/add', text, function(result) {
var html = "<... | true |
0e083d1bbd9b7a62c1360aa69f538dc206b8f007 | JavaScript | sszachnowski/manageris | /js/main.js | UTF-8 | 2,119 | 2.84375 | 3 | [] | no_license | "use strict"
requirejs([
"constructors/AddNewLine",
"constructors/Pert",
"constructors/SumEstimatedTime",
"objects/taskRowElements",
"functions/doCalculation",
"functions/inputIntegers",
"functions/removeLastLine"
], function(AddNewLine,
Pert,
SumEstimatedTime,
taskRowElements,
doCalculation,
inputIn... | true |
052fff0bc5b7050b3e9380c3b8c23158a3b511b9 | JavaScript | MLH-Fellowship/AirFop-Dasboard | /src/store/actions/userActions.js | UTF-8 | 3,630 | 2.546875 | 3 | [] | no_license | import {decryptJWT, setCookies, clearCookies} from "../helpers/jwt";
export const login = (credentials) => {
return (dispatch, getState) => {
let user = {
email: credentials.email,
password: credentials.password
};
fetch('/sessions', {
method: 'POST',
... | true |
511a9f95eca9269a7230ec36950e63782904b82e | JavaScript | wang1024it/SSM_Git | /LogisticsSystemSSM/target/LogisticsSystemSSM/Content/js/mycustom.js | UTF-8 | 14,820 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* 目录
* showModalNoKB 显示Modal,禁用esc和点击背景关闭
* setUrl 子窗体页面跳转
* backPage 返回上一层页面
* editTableToJsonString 将可编辑bsgird的值转为json 字符串
* editTableAddRow bsgird增加编辑列表 新的一编辑行
* editTableRemoveRow bsgird去... | true |
dcacd896eaef9acf0383ac66eb43d70674edf475 | JavaScript | ikidaima/Gridnine_System | /client/src/store/reducers/flightsIsFilteredReducer.js | UTF-8 | 662 | 2.84375 | 3 | [] | no_license | import { FILTER_FLIGHTS, SORT_FLIGHTS } from "../../constants/typeOfActions";
import filterFlights from "../../lib/filterFlights";
import sortFunction from "../../lib/sortFunction";
const initState = [];
const flightsIsFilteredReducer = (state = initState, action) => {
switch (action.type) {
case FILTER_FLIGHTS... | true |
98e47d007d08b6f0990afed745d080cf8f333411 | JavaScript | BendikOlsen/WebDev-Course | /JS/chapter 12/movieDBexercise.js | UTF-8 | 885 | 3.421875 | 3 | [
"MIT"
] | permissive | var movies = [
{
title: "The Punisher",
genre: "Action",
releaseYear: 1998,
rating: 4.5,
watched: true,
},
{
title: "BraveHeart",
genre: "Drama",
releaseYear: 1998,
rating: 5,
watched: true,
},
{
title: "Los Piotes del mar",
genre: ... | true |
f986a08ea23f524973da7c4931a3dfbfceb43c0c | JavaScript | ignaciojachun/instagram-tracker | /app/js/views/photo/PhotoListView.js | UTF-8 | 1,918 | 2.578125 | 3 | [] | no_license | define([
'jquery',
'underscore',
'backbone',
'views/photo/PhotoView',
'text!templates/photo.html',
'text!templates/pagination.html',
], function($,_,Backbone, PhotoView, PhotoGridTemplate, PaginationTemplate){
var PhotoListView = Backbone.View.extend({
tagName: 'ul',
... | true |
e29ca37113dfcb4da6c38cc2c62679e0fce761ea | JavaScript | myh-js/pub | /index/index.js | UTF-8 | 3,386 | 2.71875 | 3 | [] | no_license | window.onload=function() {
setInterval("document.getElementById('time').innerHTML='北京时间:'+new Date().toLocaleString();", 1000);
}
var xmlhttp;
function loadajax(url,func){
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsof... | true |
27e56a48b6c8500c1c990022d8033653c5636a0b | JavaScript | LazerLab/Facebook_Data_Collection_Demo | /js/fbdemo.js | UTF-8 | 821 | 3.421875 | 3 | [] | no_license | //create a data storage variable
var result = null;
function initialize() { //start study
$("td").click(function() { //when person clicks a cell in the table
VSFB.request("me", $(this).text(), function(data) { //request data for participant ('me'), for the cell $(this).text() (i.e. photos, hometown)
... | true |
2e392a6cdbe25b33629ea31d82f7cefb20832880 | JavaScript | eJayYoung/auto-translate-converter | /lib/combine-excels.js | UTF-8 | 2,664 | 2.828125 | 3 | [
"MIT"
] | permissive | /**
* @name combine excels
* @author changming.zy<changming.zy@alibaba-inc.com>
*/
const fs = require('fs');
const path = require('path');
const xlsx = require('node-xlsx');
const RESULT_EXCEL_NAME = 'i18n-combined.xlsx';
const XLSX_EXT_NAME = '.xlsx';
const XLSX_HEADER = [
'AppName',
'English',
'Key',
'Sim... | true |
8b3d963fe46ac00987096bbfced7f28e6a1dfc19 | JavaScript | Jendoliver/web-seguros | /js/validation.js | UTF-8 | 1,759 | 2.625 | 3 | [] | no_license | /* global $ */
$(document).ready(init);
function init()
{
$("#send").click(validateForm);
}
function validateForm()
{
$("#contactform").validate(
{
focusCleanup: false,
rules:
{
contactname:
{
required: true,
maxlength: 50
... | true |
9f7448400f4108052edeff155bfb3f46ce562786 | JavaScript | jimuyouyou/node-interview-questions | /code-demo/factory.js | UTF-8 | 405 | 4 | 4 | [] | no_license | function Person() { this.name = 'Person1'; }
function Animal() { this.name = 'Animal1'; }
function Factory() {}
Factory.prototype.getInstance = function(className) {
return eval('new ' + className + '()');
}
var factory = new Factory();
var obj1 = factory.getInstance('Person');
var obj2 = factory.getInstan... | true |
226a1ff2b1571897cffc735964ec2e8d8f838101 | JavaScript | Darkchaos2/Botty-Rewrite | /commands/Say.js | UTF-8 | 568 | 2.734375 | 3 | [] | no_license | let Command = require("./command.js");
class Say extends Command {
constructor(text){
super("say", "Repeats what ever you say as Botty.", ['message'], false, true);
}
action(params, msg, client) {
// If no role has been given, remind user how to use command
if(params.length < 1) {
msg.channel.send(this.ge... | true |
b89b9961f7b6b31857dd471b36cf81aa84860075 | JavaScript | abudd1094/audio-library-catalog | /routes/api/tracks.js | UTF-8 | 4,325 | 2.5625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const auth = require('../../middleware/auth');
const { check, validationResult } = require('express-validator/check');
// Load Models
const Track = require('../../models/Track');
const Artist = require('../../models/Artist');
const Album = require('... | true |
afbe9c2e74a68792476d48a97fe123641a725f7a | JavaScript | noodeshere/car | /synchronousBallMovement-master/sketch.js | UTF-8 | 580 | 2.890625 | 3 | [] | no_license | var database;
var gameState=0
var playerCount=0
var allPlayers;
var car1,car2,car3,car4,cars
function setup(){
database = firebase.database();
console.log(database);
createCanvas(windowWidth,windowHeight);
form=new Form()
form.display()
player=new Player()
game=new Game()
game.getState()
player.getCount()
car1=... | true |
a66010d78dbfb10597c6e2c9f535116bb4b6816d | JavaScript | uk-gov-mirror/nhsconnect.prm-gp2gp-dashboard | /src/components/common/FormComponents/Autosuggest/__tests__/index.test.js | UTF-8 | 8,360 | 2.53125 | 3 | [] | no_license | import React from "react";
import { render } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { Autosuggest } from "../";
describe("Autosuggest component", () => {
const inputLabelText = "Enter value";
it("updates input value with text that the user has inputted", () => ... | true |
cc5a37c1e7d40b088d4dee47463dadfb41a7c1cc | JavaScript | benjamn/recast | /example/to-while | UTF-8 | 2,240 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
// This script converts for and do-while loops into equivalent while loops.
// Note that for-in statements are left unmodified, as they do not have a
// simple analogy to while loops. Also note that labeled continue statements
// are not correctly handled at this point, and will trigger an assertio... | true |
d13a1528e2d89c82c7d15d9ee27838ca426ea1fa | JavaScript | julqq/frontend-challenge | /js/main.js | UTF-8 | 4,341 | 2.734375 | 3 | [] | no_license | const url = "https://br.ongame.net/api/challenge/items/";
const data = async () => {
let arr = [];
let data = await fetch(url)
.then((response) => response.json())
.then((json) => json);
data.forEach((element) => {
arr.push(element);
});
return arr;
};
async function renderHtml() {
const rewardList = docum... | true |
31bf6c7a7e27239c4bd2762b3f229a94d71d85e1 | JavaScript | ross259/expensify-app | /server/controllers/expense_controller.js | UTF-8 | 1,423 | 2.59375 | 3 | [] | no_license | const { mongoose } = require('../db/db');
const Expense = require('../models/expense');
module.exports = {
getExpense(req, res, next) {
// const getExpense = Expense.findById(req.params.id)
const getExpense = Expense.findOne({_id:req.params.id})
.then((result) => {
if (result) {
console.log('GET RESU... | true |
cec3eaba42a07643aff200bd4f4b8029ac00b9e5 | JavaScript | efekanefos/Patika-React-Homeworks | /homework1/src/App.js | UTF-8 | 1,144 | 2.546875 | 3 | [] | no_license | import "./App.css";
import Card from "./components/Card/Card";
import food2 from "./assets/food2.jpg"; // Tell webpack this JS file uses this image
function App() {
const recipeAuthor = "Kodluyoruz";
const recipeName = "Adana Kebap";
const recipeItem = {
title: "Adana Kebap",
date: "30 Nisan 2021, Cuma",... | true |
e6f14c05131ca64e03c4234723d2867903a44719 | JavaScript | coffeedzic/calculator | /src/components/Calculator.js | UTF-8 | 1,197 | 2.71875 | 3 | [] | no_license | import React, {useState} from 'react'
import Display from './Display'
import Buttons from './Buttons'
import '../styles/Calculator.css'
const Calculator = () => {
const [result, setResult] = useState(0)
const [evalString, setEvalString] = useState('')
const calculate = (val) => {
if(val ... | true |
910f653bd4feeca6f3aaab06eaa52abfcec29eab | JavaScript | dawsonhammdev/Sprint-Challenge-Lambda-Eats-starter | /src/Form.js | UTF-8 | 5,494 | 3.09375 | 3 | [] | no_license | import React, {useState, useEffect} from "react";
import axios from "axios";
import * as yup from "yup";
import {Link} from "react-router-dom"
const formSchema = yup.object().shape({
name: yup.string().required("please input a name").min(2, "name must be more than 2 characters"),
size: yup.string().required("P... | true |
cd467876daac59c147f439246974df99c6a79049 | JavaScript | earamosb8/React-PlatziVideo | /src/index.js | UTF-8 | 608 | 2.59375 | 3 | [] | no_license | // este es nuestro punto de entrada
// es el primer archivo que va a ser detectado en la aplicacion
import React from 'react';
//React Dom es la libreria que funciona al mismo tiempo con react para empujar todo
//lo que nosotros hagamos con react hacia el navegador
// 'reac-dom' es la dependecia que instalamos
import R... | true |
4a3b98694506093b4507d7d9194e53a77f65d2b9 | JavaScript | ox-it/sakai | /gradebook/app/ui/src/webapp/js/scoringAgent/integration.js | UTF-8 | 6,739 | 2.71875 | 3 | [
"LicenseRef-scancode-generic-cla",
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /*
Description
Encoding the request URL
Params
url
the request URL
Return
the encoded URL
*/
function encodeUrl(url) {
if (url.indexOf("?") > 0) {
encodedParams = "?";
parts = url.split("?");
params = parts[1].split("&");
for (i = 0; i < params.length; i++) {
if (i > 0) {
encodedParam... | true |
6190e597fc7ff0c7418bbb9a1fba9d4b409dc959 | JavaScript | kulanah/3dscene-creator | /src/components/ShapeAddition.js | UTF-8 | 2,187 | 2.921875 | 3 | [
"MIT"
] | permissive | import React from 'react';
class ShapeAddition extends React.Component{
constructor(props){
super(props);
this.submitAddition = this.submitAddition.bind(this);
}
serializeForm(htmlForm){
let data = [];
for (let i = 0; i < htmlForm.length; ++i){
if (htmlForm[i].type === 'number'){
... | true |
92d0ef1e8d57a9b76c82ae7c8285151949fccfda | JavaScript | wil0420/Ejercicios | /Sheldon/main.test.js | UTF-8 | 120 | 2.53125 | 3 | [] | no_license | const calcular = require('./main');
test('Si el número es 3 retorna true', () => {
expect(calcular(3)).toBe(1);
});
| true |
483ff302c74941b0f9cd1a1d423bfc3902d74f0d | JavaScript | csconly/blackjack | /src/components/PlayerHand.js | UTF-8 | 3,329 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import '../styles/blackjack.css';
import * as Constants from '../js/constants';
class PlayerHand extends Component {
constructor(props) {
super(props);
this.state = {
pHand: [],
pHand1: [],
pHand2: [],
split: ... | true |
92d56e890da9204756c12f98a459aea9dc0e9f7c | JavaScript | liu9856866814/jsDemo | /WEEK5/day4/js/2-拖拽鼠标丢失问题.js | UTF-8 | 3,517 | 3.5 | 4 | [] | no_license | /*
* 拖拽鼠标丢失原因:
* 我们写的拖拽并不是鼠标真的拖着盒子走,而是鼠标走鼠标的,盒子不断的跟随鼠标.
* 在鼠标移动的过程中,不断计算盒子应该出现的位置. 这个计算是需要时间的,
* 如果在计算的一段时间内,再次移动了鼠标,因为上一次还没计算完,盒子还没到达上一次的位置,此时移动鼠标就会出现盒子跟不上鼠标了.
* 元素没跟上鼠标,再移动鼠标就不会触发元素的onmousemove事件,也就不会再跟随鼠标了.
*
* 当鼠标丢失元素后,再松开鼠标时,触发的就不是元素的onmouseup事件了.而我们在元素的onmouseup事件函数中移除元素的onmousemove的
* 操作没执行,导致元素的onmousem... | true |
f0c64ea426df603f6b897444b072c4bca77a4f74 | JavaScript | Elizapp/Elizapp.github.io | /Lab10-Inheritance/test.js | UTF-8 | 902 | 3.90625 | 4 | [] | no_license | describe("String.filter", function () {
it("The function accepts an array of strings that specifies a list of banned words. The function returns the string after removing all the banned words",
function () {
assert.equal("This house is nice!", "This house is not nice!".filter("not"));
})... | true |
64836aec23a08d63ab7c4cbc6a3ea5e6aa4270b6 | JavaScript | vzteca/calculator | /script.js | UTF-8 | 4,555 | 3.28125 | 3 | [] | no_license | const add = (x, y) => {
return x + y;
};
const subtract = (x, y) => {
return x - y;
};
const multiply = (x, y) => {
return x * y;
};
const divide = (x, y) => {
return x / y;
};
const percentage = (x, y, operator) => {
if (y == null) return x / 100;
else
switch (operator) {
case "add":
... | true |