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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f500721d0c87b1e9863568f9e04fa5a4bec0d40a | JavaScript | leencoln/leencoln | /test.js | UTF-8 | 5,936 | 2.875 | 3 | [] | no_license | import 'mocha';
import chai from 'chai';
import _l from './build/leencoln.js'
let expect = chai.expect;
mocha.setup({
ui: 'bdd',
reporter: 'html'
});
describe('argument type "number"', function() {
describe('nDecimalPoint', function() {
it("should assign decimal point number", function() {
... | true |
410e4a1bd7150c281558194e2eb21e309086442c | JavaScript | Enishowk/AdventOfCode | /2020/day8/part1.js | UTF-8 | 556 | 3.328125 | 3 | [] | no_license | const inputs = require('fs')
.readFileSync(`${__dirname}/input.txt`, 'utf8')
.split(/\r?\n/);
let x = 0;
let accumulator = 0;
const actions = [];
while (true) {
if (actions.includes(x)) {
break;
}
const line = inputs[x];
const [instruction, number] = line.split(' ');
actions.push... | true |
3428b9731a8733682665d5e7f7114dd1659df893 | JavaScript | joycesantossouza/uri | /URI2473.js | UTF-8 | 459 | 3.40625 | 3 | [] | no_license | var input = require("fs").readFileSync("/dev/stdin", "utf8");
var lines = input.split("\n");
var aposta = lines.shift().split(" ");
var sorteio = lines.shift().split(" ");
const result = aposta.filter(item => {
return sorteio.includes(item);
}).length;
if (result === 3) console.log("terno");
else if (result === 4)... | true |
04682cccd4f3651a7b37f954f7fe7c6759e13403 | JavaScript | alexandrufulop/mws-restaurant-stage-3 | /app/src/js/restaurant_info.js | UTF-8 | 19,263 | 3.09375 | 3 | [] | no_license | let restaurant;
var map;
/**
* Initialize Google map, called from HTML.
*/
window.initMap = () => {
self.map = new google.maps.Map(document.getElementById('map'), {
title: 'A map with the location of the restaurants', //added google maps title a11y
zoom: 16,
center: self.restaurant.latlng... | true |
ee308538614f1f244b7e95c3ac8b9c10635a4722 | JavaScript | andrevar/my-codewars-katas-solutions | /4 kyu/Adding_Big_Numbers.js | UTF-8 | 1,121 | 3.546875 | 4 | [] | no_license | function add(a, b) {
var arrA = a.split('').reverse();
var arrB = b.split('').reverse();
function sumStr(x, y) {
var arrX = [];
var arrY = [];
if (x.length > y.length) {
while(x.length > y.length) {
y.push("0");
}
} else if(x.length < y.length){
x.pus... | true |
e3bde2bc3699973a3fec53b13dd61539e2753ba3 | JavaScript | x331/Scheduler_LearnMERN | /src/components/places-list.component.js | UTF-8 | 1,959 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
const Place = props => (
<tr>
<td>{props.place.username}</td>
<td>{props.place.description}</td>
<td>{props.place.duration}</td>
<td>{props.place.date.substring(0,10)}</td>
<td>
<Li... | true |
edcfd98bce2373eb652977b6b82e5a1356013c8c | JavaScript | jpts/grain-rot-calc | /parse.js | UTF-8 | 4,669 | 3.03125 | 3 | [
"MIT"
] | permissive | const urlFile = 'urls.json'
const outFile = 'output.json'
const jsonfile = require('jsonfile');
const csv = require('csvtojson');
const _ = require('lodash');
const fs = require('fs');
const request = require('request');
const ndjson = require('ndjson');
// These were estimated by looking at the three sample
// dat s... | true |
1e804784e0afcdc9930c997bc4d95f43a9efe62b | JavaScript | sndsabin/get-nepali-number | /test.js | UTF-8 | 532 | 2.921875 | 3 | [
"MIT"
] | permissive | 'use strict';
var assert = require('assert');
var getNepaliNumber = require('./');
it('should convert english number 100 to Nepali correctly', function () {
assert.strictEqual(getNepaliNumber(100), '१००');
});
it('should convert numbers with decimal correctly', function () {
assert.strictEqual(getNepaliNumber(200... | true |
61f1629b31eb5d63c8a77385d82af1d7bce9e4a1 | JavaScript | gjjones/tracks-player | /public/scripts/reducers/reducer.js | UTF-8 | 1,960 | 2.734375 | 3 | [] | no_license | import {
UPDATE_ELLAPSED,
TOGGLE_PAUSE,
PREV_TRACK,
NEXT_TRACK,
SET_TRACKS
} from '../actions/actions';
const prevTrackBuffer = 3000;
const initialState = {
playing: false,
currentIndex: 0,
currentProgress: 0,
tracksList: [
{
name: 'apple',
type: 'timed',
duration: 7 * 1000
... | true |
275195791a2967b9d1c4c9b7cd996b9ee6b4062e | JavaScript | xiaoqiang730730/front-end-test | /js/js-super/zhi.js | UTF-8 | 545 | 3.953125 | 4 | [] | no_license | // function test (num) {
// // 创建一个内存副本
// 按值传递 string,number,boolen
// num = num +1;
// return num;
// }
// var num = 1;
// console.log(test(1));
// console.log(num);
//
function test(obj){
// 按引用传递 object array
obj.age = 20;
console.log('内部', obj);
}
var obj = {
name:'xiaoqiang'
}
test(obj);
console.log(o... | true |
8677d928de1f8c261b12b38404c7193f1d60ef95 | JavaScript | DataCollectiveTeam/Data-Collective | /src/components/Modals/EditUserModal.jsx | UTF-8 | 3,789 | 2.625 | 3 | [] | no_license | import React, { useContext, useState } from 'react';
import './Modals.css'
import axios from 'axios';
import { DataContext } from '../../DataContext';
import { Redirect } from 'react-router-dom';
const EditUserModal = ({user, setEditUserModal}) => {
//get function to update current user from DataContext
c... | true |
1ce80ee143d4aeedd3659f538289f9e99831b685 | JavaScript | IShubhamj/datastructures | /Numbers/Reverse/Solution2.js | UTF-8 | 255 | 3.28125 | 3 | [] | no_license | function reverseInt(n) {
const reversed = n.toString().split("").reverse().join("");
return parseInt(reversed) * Math.sign(n);
}
console.log(reverseInt(500));
console.log(reverseInt(789));
console.log(reverseInt(-500));
console.log(reverseInt(-678));
| true |
25be8464ff1fa7c784bed8339de9eb8cd93cc36e | JavaScript | JongheonLee94/react-native-learning | /ch11/app/Toolbar.js | UTF-8 | 1,693 | 2.859375 | 3 | [] | no_license | //11.5
// import React from 'react'
// import {
// View,
// Text
// } from 'react-native'
// class ToolBar extends React.Component {
// render () {
// return (
// <View style={{ flex: 1 }}>
// <Text>Hello from Toolbar</Text>
// </View>
// )
// }
// }
// export default ToolBar
//11.... | true |
d3bdbb66f993fb42dece5645d3108f38322e6abd | JavaScript | haanj/backstoryApp | /dev/services/generator_service.js | UTF-8 | 462 | 2.53125 | 3 | [] | no_license | // This module may eventually handle the calls to the API when the API is built out.
// Meanwhile, it holds placeholder generator code.
module.exports = function(app) {
app.factory('GeneratorService', [function() {
var myService = {};
var backstory = [];
// retrieves story from service
myService... | true |
33050764a7e37ec3bfe0c895fb5d782672ee1aaa | JavaScript | edoyle182/githubRepoSearchApp | /script.js | UTF-8 | 2,207 | 3.125 | 3 | [] | no_license | 'use strict';
const githubURL = 'https://api.github.com/';
const apiKey = 'f4c8fce3fc1013ad2e9b4d15374ca2c28f671c58';
function formatQueryParams(params) {
const queryItems = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`);
return queryItems.join('&');
}
// Displ... | true |
505ef56a9265449ae819be95fecd212c30296a0c | JavaScript | Lionking93/TaskList | /src/components/Task.js | UTF-8 | 1,618 | 2.65625 | 3 | [] | no_license | import React from 'react'
import '../stylesheets/task.css'
const Task = ({ task, handleDrop }) => {
let taskContents = ""
const dragStart = (event) => {
event.dataTransfer.setData('text/plain', task.id)
event.dataTransfer.effectAllowed = 'move'
event.dataTransfer.setDragImage(... | true |
99f8ea2bec986ef6053fb8d6e9ab14ac32ac9a6c | JavaScript | CSOSAQ/VALIDARTARJETA | /js/app.js | UTF-8 | 980 | 3.796875 | 4 | [] | no_license | var numbertarjet= prompt("Ingrese el número de su tarjeta");
function isValidCrad(numbertarjet){
var newarr =[];
var sum =0;
var sumimp=0;
for(i=0; i< numbertarjet.length; i++){
newarr.push(numbertarjet[i]);
}
newarr.reverse();
// console.log(newarr); 3,2,1
for(j=1;j< newar... | true |
e828858facfa8e0a3c805fd9363cd3960a5c9b91 | JavaScript | charlotteshih/dsa-drills | /arrays.js | UTF-8 | 2,770 | 3.390625 | 3 | [] | no_license | function urlify(str) {
let newStr = [];
for (let i = 0; i < str.length; i++) {
if (str[i] === " ") {
newStr.push("%20");
} else {
newStr.push(str[i]);
}
}
return newStr.join("");
}
// console.log(urlify("foo bar"));
function lessThanFiveBigot(arr) {
let newArr = [];
for (let i = 0;... | true |
15808e21ec222902b42f462134b7731cd21e63e3 | JavaScript | seanwarman/json-builder | /JsonFormBuilder.js | UTF-8 | 5,706 | 2.671875 | 3 | [] | no_license | module.exports = JsonFormBuilder = function(type) {
this.sanitiseString = (value) => {
return JSON.stringify(
typeof value === 'string' ?
value.replace(/'/g, '"')
:
value
).slice(1,-1)
}
// This double sanitises the whole json overall
// so that it saves to a mysql db. The extra... | true |
d8e60895c3ec5fefa84c8ac080bfa33e18cc39da | JavaScript | hamzahejja/lodash-recreated | /src/functions/array.js | UTF-8 | 13,158 | 3.9375 | 4 | [
"MIT"
] | permissive | /**
* According to the lodash documentation, _.difference(array, [values]) creates an array of array values
* not included in the other given arrays using SameValueZero for equality comparisons.
* The order and references of result values are determined by the first array.
* @param {Array} array - The array to ins... | true |
57c6140089c936fc7ff73b51729b4c585590a549 | JavaScript | ChaoticWyrme/c-square | /routes/organization.js | UTF-8 | 1,719 | 2.546875 | 3 | [] | no_license | // ./routes/organization.js
// /data/organization
const express = require('express');
const sqlite = require('sqlite');
var dbPromise = sqlite.open('database.sqlite')
var router = express.Router();
var db = require('../db.js');
(async () => {
db = db(await dbPromise.catch(err => console.error(err)));
})();
router.g... | true |
b69452a6557ec7e27ce02c03fb542d9e549058c1 | JavaScript | codex-team/hawk.workers | /migrations/20200511174200-daily-events-grouping-timestamp-goes-utc.js | UTF-8 | 5,368 | 2.859375 | 3 | [] | no_license | /* global Db, MongoClient */
const terminal = require('../lib/utils/terminal');
/**
* This migration updates the groupingTimestamp fields in dailyEvents collections.
*
* The problem:
* The previous version of grouper has midnight-timestamps that have been got using local setHours(0,0,0,0) method
* that is actua... | true |
37e3980d2efa962ce92121c56976c2af7ee3149b | JavaScript | luismasg/interview-codingchallenge-fsjs | /src/server/server.js | UTF-8 | 7,388 | 2.6875 | 3 | [] | no_license | // server.js
var frontEndPort = 8080;
// BASE SETUP
// =============================================================================
var mongoose = require('mongoose');
var List = require('./models/list');
var Item = require('./models/item');
var _ = require('lodash');
var cors = require('cors')
mongoose.connect(... | true |
1e5e79f843f0e4e9a999e16d225b848456ebf725 | JavaScript | FREEqueenC/klasa | /src/lib/extensions/KlasaGuild.js | UTF-8 | 1,033 | 2.546875 | 3 | [
"MIT"
] | permissive | const { Structures } = require('discord.js');
module.exports = Structures.extend('Guild', Guild => {
/**
* Klasa's Extended Guild
* @extends external:Guild
*/
class KlasaGuild extends Guild {
/**
* @typedef {external:GuildJSON} KlasaGuildJSON
* @property {ConfigurationJSON} configs The per guild confi... | true |
cb6f28961cf46188962658c552e135d626cb8d59 | JavaScript | brianneisler/stutter | /src/lang/isSet.js | UTF-8 | 431 | 2.859375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import { anyIsSet } from './util'
import defn from './defn'
/**
* Checks if `any` is classified as a `Set` object.
*
* @function
* @since v0.1.0
* @category lang
* @param {*} any The value to check.
* @returns {boolean} Returns `true` if `any` is a set, else `false`.
* @example
*
* isSet(new Set())
* // => ... | true |
3f9c836ad2ec8f8cdf06681abdd8ebe70e79598e | JavaScript | rthames62/Javascript-Toy-Problems | /basic/check-palindrome.js | UTF-8 | 651 | 4.375 | 4 | [] | no_license | // Return true if the given string is a palindrome. Otherwise, return false.
// A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
// We'll pass strings with varying formats, such as "racecar", "RaceCar", and "race CAR" among others.
fu... | true |
e97f28300edf7482c8b917e057fbdf6e4c5f10b6 | JavaScript | LamVT3/helios | /public/js/helpers.js | UTF-8 | 2,153 | 3.078125 | 3 | [] | no_license | /**
* Created by phongvh on 4/19/2017.
*/
function formatMoney(number) {
if (!number) return number;
number = number.toString().replace(/[^\d\.]/g, '');
number = number.replace(/(\.)(\d*)(\.)/, '$1$2');
if (number.indexOf('.') !== -1) {
var part = number.split('.');
number = part[0].r... | true |
135ee63ee37a1ff07fca0574d1c892ddbde340ce | JavaScript | kameliashaharova/PhotoShare | /application/models/Posts.js | UTF-8 | 1,681 | 2.625 | 3 | [
"MIT"
] | permissive | var db = require("../config/database");
const PostModel = {};
PostModel.create = (title, description, photoPath, thumbnail, fk_userId) => {
let baseSQL =
"INSERT INTO posts (title, description, photopath, thumbnail, created, fk_userid) VALUES (?,?,?,?, now(),?);";
return db
.execute(baseSQL, [title, descri... | true |
b62cc889b2bd9f0bb88f407d84f3dadf12fbfc98 | JavaScript | sejalp7/javascript-code-challenges | /js-concepts/sudoku_challenge.js | UTF-8 | 2,029 | 3.65625 | 4 | [] | no_license | const sudokuArr = [[], [], [], [], [], [], [], [], []];
const possible_value = [1, 2, 3, 4, 5, 6, 7, 8, 9];
function appear_only_onc_constriant(board) {
for (let r = 0; r < 9; r++) {
for (let c = 0; c < 9; c++) {
let row_element = board[r];
let column_element = get_column(board, c);
let updated ... | true |
d41ba56f87aeffffadb10fe693017fc4a54212bd | JavaScript | joshualevan/task-test | /src/components/List.js | UTF-8 | 2,561 | 2.75 | 3 | [] | no_license | import React, { useState, useRef, useEffect } from 'react'
import { completions } from '../data'
export default function List({ list, lists, setLists, setUpdateStorage, updateStorage }) {
const [editing, setEditing] = useState(false)
const [complete, setComplete] = useState(false)
const editNameRef = use... | true |
fa4c2fd7f36c9b877512dd3dad896c48e4c36c80 | JavaScript | monikaem/react_udemy | /hooks/Proj_4_countClicksAndDisplay_hooks/App.js | UTF-8 | 2,134 | 3.328125 | 3 | [] | no_license | const Counter = (props) => {
const [count, setCount] = React.useState(0)
const [result, setResult] = React.useState(props.result)
const handleMathClick = (type, number = 1) => {
if (type === 'subtract') {
setCount(count + 1);
setResult(result - number);
} else if (typ... | true |
293df2f419156dc16024a5b06b3de6c03515b718 | JavaScript | harrisonlingren/CME308 | /progressR1.js | UTF-8 | 751 | 3.484375 | 3 | [] | no_license | function passLength() {
var length1 = document.getElementById('pass1').value.length;
var length2 = document.getElementById('pass2').value.length;
if (length1 < 8 || length1 > 10 ) {
document.getElementById('passLength').innerHTML = "Your password does not meet the password requirements.";
} else {
document.g... | true |
084c29edeab3f3070fd9e4a07ea1b6bcf32fc015 | JavaScript | LHM0105/HTML5 | /PlaneGame/面向对象版PlaneGame/js/Bullet.js | UTF-8 | 1,326 | 3.4375 | 3 | [] | no_license | //子弹的类
class Bullet{
constructor(me,i){
this.create(me);
this.move(i);
}
//创建子弹,初始位置是飞机顶点
create(me){
//传入我方飞机对象以便获取我方飞机位置
this.el = document.createElement('img');
this.el.src = 'images/bullet.png';
this.el.className = 'bullet';
document.body.appendChild(this.el);
//指定子弹位置
this.el.styl... | true |
22519ed8967dd00269f5738ebb5b74a1ea89c12a | JavaScript | melen16/multimedia | /labs/lab6/script.js | UTF-8 | 877 | 2.875 | 3 | [] | no_license | $("#button").click(function() {
var enterWord;
element = document.getElementById('insertName');
if (element != null) {
enterWord = element.value;
}
else {
enterWord = null;
}
console.log(enterWord);
$.ajax({
url: 'https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?',
... | true |
f9392065f35291277a6598644a005bec8c01d851 | JavaScript | drgoshm/TelegramContests | /src/js/previewRender.js | UTF-8 | 3,883 | 2.65625 | 3 | [
"MIT"
] | permissive | /* previewRender.js */
// eslint-disable-next-line no-unused-vars
const PreviewRender = function(canvas, chart, dpr, anim, params) {
let width = canvas.width, height = canvas.height, yArea = height;
this.XScale = 0;
this.YScale = 0;
this.iBegin = 0;
this.iEnd = 0;
this.piemode = false;
const ctx = canvas.getCo... | true |
9dc6926c6412b7faab49d767c876e2ab6faf3d9f | JavaScript | dagreatcode/OnlyDungeons2 | /client/src/components/Spellbook/BookOfSpells/BookOfSpells.jsx | UTF-8 | 1,737 | 2.609375 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect, useContext } from "react";
import API from "../../../utils/API";
export default function BookOfSpells() {
const [spells, setSpells] = useState([]);
const [page, setPage] = useState(0);
const [loading, setLoading] = useState(true)
const spellBook = function () {
API.ge... | true |
db93910efadec5878178aa69f7b5bdcca4164b9d | JavaScript | Gitorious-backup/ui3 | /js/test/components/comments-test.js | UTF-8 | 5,047 | 2.5625 | 3 | [] | no_license | /*global buster, assert, dome, gts*/
buster.testCase("Comments", {
"renderForm": {
"renders comment div": function () {
var div = gts.comments.renderComment({
body: "<h2>Hey</h2>",
createdAt: "2013-01-01T23:10:15+02:00",
updatedAt: "2013-01-01T23:1... | true |
e23ee245054a935dfa4f934a3d0ceba9856bfbf4 | JavaScript | dutiyesh/devtodo | /app/src/components/TodoList.js | UTF-8 | 1,027 | 2.5625 | 3 | [
"MIT"
] | permissive | import React from 'react';
import PropTypes from 'prop-types';
import TodoItem from './TodoItem';
const propTypes = {
// Callback fired on todo checkbox toggle event.
toggleTodo: PropTypes.func.isRequired,
// Callback fired on todo text update event.
updateTodo: PropTypes.func.isRequired,
// Callback fired ... | true |
79e8bf1085b2ecd392aeb8de148212d83be68140 | JavaScript | wi34rd/tracalorie | /src/js/tracalorie-view.js | UTF-8 | 1,967 | 3.203125 | 3 | [
"ISC"
] | permissive | class TracalorieView {
constructor() {
this._listeners = {};
this._addFoodForm = document.getElementById('add-food-form');
this._foodInput = document.getElementById('food-input');
this._caloriesInput = document.getElementById('calories-input');
this._totalCalories = document... | true |
d3d39e9ab1ec3de0eac35097e4d9544d6177154e | JavaScript | chokkoazul/cursoNode | /02-fundamentos/let-var.js | UTF-8 | 196 | 3.078125 | 3 | [] | no_license | let nombre = 'Wolverine';
if (true){
let nombre = 'Magneto';
}
nombre = 'aaja';
console.log(nombre);
let i = 'Hola mundo';
for(let i=0;i<5;i++){
console.log(`i=${i}`);
}
console.log(i); | true |
04e93ffdae778ecda8cad619d46cd3087512c0f5 | JavaScript | abrina69/StudGangBot | /commands/setnickname.js | UTF-8 | 1,084 | 2.609375 | 3 | [
"MIT"
] | permissive | const Discord = require("discord.js");
module.exports = {
name: "nick",
category: "General",
aliases: ["setnick","setnickname"],
description: "Set a users nickname via a command.",
usage: ["<mention> <nickname>"],
reqPermissions: ['MANAGE_NICKNAMES'],
cooldown: 5,
sped: true,
execute(bot, message, ar... | true |
4eb3544d76dcd250331eca612eb9b6372b76e025 | JavaScript | janesessive/moon-calendar | /src/lib/Translator.js | UTF-8 | 6,078 | 2.6875 | 3 | [] | no_license | export const translateSign = (name) => {
var data = [];
data['Mesha']='Овен';
data['Vrushabha']='Телец';
data['Mithuna']='Близнецы';
data['Karkataka']='Рак';
data['Simha']='Лев';
data['Kanya']='Дева';
data['Tula']='Весы';
data['Vrushchika']='Скорпион';
... | true |
94f94cfe772767d382dd23b981fb37a1224366ba | JavaScript | AkashKumarSingh11032001/JavaScript-CWM | /JavaScript-ControlFlow/Ex10-ShowStar.js | UTF-8 | 223 | 3.265625 | 3 | [
"MIT"
] | permissive | function ShowStar(rows) {
for(let i = 0; i<=rows ; i++){
let pattern = '';
for(let j = 0; j<i; j++){
pattern += '* ';
}
console.log(i + " " + pattern);
}
}
ShowStar(10); | true |
1a8cbfb188dc5c09be0478e55569cc9c3bfcf8a1 | JavaScript | gaoli-praise/Lucky-Draw | /index.js | UTF-8 | 1,521 | 2.796875 | 3 | [] | no_license | window.onload = function() {
var $ = function(id) {
return document.getElementById(id);
}
var contaner = $('contaner');
var divs = contaner.getElementsByTagName('div');
var one = $('one');
var two = $('two');
var three = $('three');
var four = $('four');
var five = $('five');... | true |
299e22f89d392ec2c95681f86bf5ec8c0a19da10 | JavaScript | ronaldscruz/typescript-devdojo | /02_oo/02_classes.js | UTF-8 | 2,551 | 3.125 | 3 | [] | no_license | var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] =... | true |
05248e79e48f9b7a4f9a86f1bf86d287b854a426 | JavaScript | BlueStoneQ/BBQ | /war2022/jsWriteByHand/data-handle/18-urlQueryParse.js | UTF-8 | 1,428 | 3.53125 | 4 | [] | no_license | /**
* url的参数解析
* 2022-6-16
* https://juejin.cn/post/6946136940164939813#heading-49
*/
const parseParam = function(url) {
// defend
const resObj = {};
// 分割出参数 - 为数组
const query = url.split('?')[1]; // 这里如果为了找到更准确的分割点? - 可以使用/.+\?(.+)$/ + match
const queryList = query.split('&');
// 参数按照键值对挂在对象上 - 注意:... | true |
83589e2ac60fc3c9ac414da7fe305a65a902582f | JavaScript | alhambraa/Sh0t-0n | /js/process.js | UTF-8 | 1,762 | 2.84375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | var app = new function() {
this.el = document.getElementById('comments');
this.comments = ['Aliquam principes deterruisset cum et, vel an eius equidem. Id quando legimus inermis eum, cibo consul democritum cum te, cu cum suas laudem graeci. Bonorum gloriatur signiferumque an pro.',
'Lorem Ip... | true |
f04fd2c5952e95d6f03f23a0ac543ddf876e8031 | JavaScript | Torof/aavegotchi-contracts | /scripts/testCollateralTypes.js | UTF-8 | 2,417 | 2.75 | 3 | [
"MIT"
] | permissive |
const collaterals = [
{
name: 'GHST',
kovanAddress: '',
mainnetAddress: '',
hardhatAddress: '',
mumbaiAddress: '',
primaryColor: '#FF7D00',
secondaryColor: '#F9D792',
cheekColor: '#F4AF24',
svgId: 0,
eyeShapeSvgId: 16,
modifiers: [0, 0, -1, 0, 0, 0],
conversionRate: 1... | true |
6d0963cc626f718af9626e6e2875899e494ab3b9 | JavaScript | bridgar/ArtGallery | /gallery.js | UTF-8 | 13,841 | 2.8125 | 3 | [] | no_license | import {InputManager} from './inputManager.js';
import * as Geom from './geomUtils.js';
let guardRadius = 8;
let cuttableVertexRadius = 10;
export let TRIANGLE = 0;
export let VEE = 1;
export let COMB = 2;
export let SPIRAL = 3;
export let OCTAGON = 4;
export let WEIRD = 5;
export let VERTEXMODE = 0;
export let EDG... | true |
191708456fea41044fd6f555390d3b1a3b3f9b25 | JavaScript | lapd87/SoftUniJavaScriptFundamentals | /04ArraysAndMatrices/_010EqualNeighbours.js | UTF-8 | 776 | 3.4375 | 3 | [
"MIT"
] | permissive | function equals(input) {
let counter = 0;
for (let row = 0; row < input.length; row++) {
for (let col = 0; col < input[row].length - 1; col++) {
if (input[row][col] === input[row][col + 1]) {
counter++;
}
}
}
for (let row = 0; row < input.length... | true |
3901b7a7d1cf2188fc7143b46e118fe5849e8dc0 | JavaScript | skinth/nodeschool-tutorials | /functional-javascript/filter.js | UTF-8 | 504 | 3.734375 | 4 | [] | no_license | /*
Task: Use Array#filter to write a function called getShortMessages.
getShortMessages takes an array of objects with '.message' properties and returns an array of messages that are less than < 50 characters long.
The function should return an array containing the messages themselves, without their containing object.... | true |
77f355674f4f6003763ee1886b6c9cace7c7500a | JavaScript | JieYin2017/DropDown_Selection | /main.js | UTF-8 | 2,420 | 3.015625 | 3 | [] | no_license | window.onload = initAll;
var xhr = false;
var tree = new PrefixTree();
var choicesArray = new Array();
function initAll() {
document.getElementById("searchField").onfocus = searchSuggest;
document.getElementById("searchField").onblur = function () {
setTimeout(function () { document.getElementById("popups"... | true |
1453a6dc6f680699b43975d4fe437bf655148dd8 | JavaScript | GusLem/incodde-selecao-frontend | /src/components/UsuarioPartialForm.js | UTF-8 | 3,578 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import ReactDatePicker, { registerLocale } from 'react-datepicker';
import pt from "date-fns/locale/pt";
registerLocale("pt", pt);
class UsuarioPartialForm extends Component {
isRegister = () => {
//Se o usuário estiver logado e for administrado, ele pode
//concede... | true |
2bc8f311a6ac4d906f0fd1572d7849a86e90e0b6 | JavaScript | kamilabandeira/mega_hack_women | /routes/login.js | UTF-8 | 1,672 | 2.59375 | 3 | [] | no_license | const express = require("express")
const router = express.Router()
const mongoose = require("mongoose")
require("../models/Usuario")
const Usuario = mongoose.model("usuarios")
router.get("/", (req, res) => {
res.render("entrar/index")
})
router.get("/sair", (req, res) => {
... | true |
237716a8b28056fd75517f3c401bf63419f7ed0f | JavaScript | abdulhannanali/p5-paintredux | /actions/index.js | UTF-8 | 648 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
* Actions for painting
*/
import drawingTypes from "./drawingTypes"
const {
DRAW_SQUARE,
DRAW_CIRCLE,
DRAW_RECTANGLE
} = drawingTypes
export function circle (x, y, radius, color="black") {
return {
type: DRAW_CIRCLE,
x,
y,
radius,
color
}
}
export function rectangle (x, y, length... | true |
6b6bfba24125902c2b1527a91119669bead65dcd | JavaScript | YBFACC/MyLeetCode | /JS/18-四数之和-medium.js | UTF-8 | 1,177 | 3.515625 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=18 lang=javascript
*
* [18] 四数之和
*/
// @lc code=start
/**
* 自己--套15题的方法--性能好
* @param {number[]} nums
* @param {number} target
* @return {number[][]}
*/
var fourSum = function(nums, target) {
if (nums.length < 4) return []
let res = []
nums.sort((a, b) => a - b)
for (let i ... | true |
5ba80066c200b734ac82b0755795e7be31fa1576 | JavaScript | mummybot/tpbc | /tools/watch/watch.js | UTF-8 | 566 | 2.75 | 3 | [
"MIT"
] | permissive | module.exports = function (fileName, config) {
var curExtension,
include = (config.include || []).join(),
exclude = (config.exclude || []).join();
// Is a file
if (fileName.indexOf('.') !== -1) {
curExtension = fileName.split('.')[1];
if (include.indexOf(curExtension) === -1) {
// Is not... | true |
d0b258184954840518577ccaa23cebdb115a26b4 | JavaScript | ghostxbh/pomelo-sms | /pomelo-sms-admin/src/main/resources/static/common/js/base.js | UTF-8 | 19,013 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* Created by HANZO on 2016/6/17.
*/
/**
* popover(弹出框)2秒后定时消失
* showPopover("#tableName","表名已存在");
* @param target
* @param msg
*/
function showPopover(msg, targetId) {
var target;
if (targetId instanceof jQuery) {
target = targetId;
} else {
target = $(targetId);
}
targe... | true |
bd9984133f0fea1d295f60a265d19d18fd6e6b7c | JavaScript | abbasalkabbi/first-app-vuex | /src/store/index.js | UTF-8 | 685 | 2.578125 | 3 | [] | no_license | import { createStore } from "vuex";
const url='https://official-joke-api.appspot.com/random_joke';
export default createStore({
state: {
currentjoke: "This is firs joke",
alljokes: [],
},
mutations: {
setCurrentJoke(state, payload) {
state.currentjoke = payload;
state.alljokes.push(payl... | true |
69eebf768c664fcd92cb97cf5ba0ab4f174bf389 | JavaScript | Revortni/chatboxRN | /server/testserver.js | UTF-8 | 645 | 2.703125 | 3 | [
"MIT"
] | permissive | let userdb = require('./database/UserDatabase');
let msgdb = require('./database/MsgDatabase');
// async function run(){
// try{
// let data = await userdb.connect();
// return Promise.resolve(data);
// } catch(err){
// return Promise.reject(err);
// }
// }
// run().then((x)=>consol... | true |
1adc537e13e20881044dff1b30e38bf5e413807a | JavaScript | yisacc/ecommerce | /controllers/categoryController.js | UTF-8 | 1,598 | 2.578125 | 3 | [] | no_license | const mongoose =require('mongoose');
const { CategorySchema } =require('../models/categoryModel');
const Category = mongoose.model('Categories', CategorySchema);
exports.addNewCategory = (req, res, next) => {
let newCategory = new Category({
_id: new mongoose.Types.ObjectId(),
category_name: req.body.catego... | true |
6689d672b66b67dd69e8f0e800c209fda04648ad | JavaScript | asadadi786/expense-tracker-react | /src/Context/GlobalState.js | UTF-8 | 1,491 | 2.875 | 3 | [] | no_license | import React, { createContext, useReducer } from 'react';
import AppReducer from './AppReducer';
//initial state
const initialState = {
transactions: [
{ id: 1, text: 'Gift', amount: -100 },
{ id: 2, text: 'Salary', amount: 1000 },
{ id: 3, text: 'Game', amount: -50 },
{ id: 4, tex... | true |
f529732fba673099efb2537b14cb66269b07676a | JavaScript | noob2017/fend-project-memory-game | /js/app.js | UTF-8 | 6,779 | 3.4375 | 3 | [] | no_license | // DONE! :D
// Special thanks to illee // FEND for lots of help in Slack! <3
////////////// GLOBAL VARIABLES ///////////////////////
let cards = document.querySelectorAll('.card');
let openCards = [];
let restart = document.querySelector('.restart');
let moves = 0;
let deck = document.querySelector('.deck');
let t... | true |
5066f749794c0f569b00474d8a015018e939bd67 | JavaScript | daltonehret3/GildedRose-Refactoring-Kata | /js-jest/src/helpers/BackstagePasses.js | UTF-8 | 386 | 2.625 | 3 | [
"MIT"
] | permissive | const handleBackstagePass = (item) => {
if(item.sellIn <= 0){
item.quality = 0
} else if(item.sellIn <= 5){
item.quality = item.quality + 3
}else if(item.sellIn <= 10){
item.quality = item.quality + 2;
}else {
item.quality ++;
}
item.sellIn --;
... | true |
a435764b7fe22368d55d69940ba485efad632d8c | JavaScript | YlanaA/js-assessment-diceroller | /main.js | UTF-8 | 1,115 | 3.46875 | 3 | [] | no_license | // console.log("hello");
let dieRollsButton = document.querySelector("#die-rolls");
let showAllRolls = document.querySelector("#show-all-rolls");
let totalBox = document.querySelector("#total-box");
let numberBox = document.querySelector("#number-box");
let allRolls = document.querySelector("#lists");
let rollResults ... | true |
77b8ffc134f75b971165dc45b5098573421895f0 | JavaScript | Ksiner/Wiki | /assets/scripts/mainpage.js | UTF-8 | 372 | 2.78125 | 3 | [] | no_license | var server = "http://localhost:8080";
function init() {
}
function getMain() {
let xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
alert( xmlhttp.responseText );
}
};
debugger;
xmlhttp.open( "GET... | true |
55e3cca54e478521a8539fb8ef9353c52289b738 | JavaScript | sopandobhal/personalShopperApi | /index.js | UTF-8 | 1,348 | 3.046875 | 3 | [] | no_license | var express = require("express");
var bodyParser = require("body-parser");
var app = express();
app.use(bodyParser.json());
var grocery = [];
function createNewItem(itemName,itemQty) {
this.id = grocery.length;
this.name = itemName;
this.qty = itemQty;
}
function addNewItem(item){
var numOfItems = grocery.lengt... | true |
dbcb010a4d024554b35da2f4c0bd0fd030fba378 | JavaScript | lizzkats/core-algorithms | /spec/factorial.js | UTF-8 | 705 | 2.96875 | 3 | [
"MIT"
] | permissive | 'use strict'
import {expect} from 'chai'
import factorial from '../src/factorial'
describe('factorial', () => {
it('exists', () => {
expect(factorial).to.be.a('function')
})
it('should take a number and return the factorial of that number', () => {
expect(factorial(5)).to.equal(120)
expect(factoria... | true |
4e7048632a72378bddcb95735ff21c6ef8349067 | JavaScript | jcabiles/WellsFargoStatements | /bulk_download.js | UTF-8 | 1,017 | 2.84375 | 3 | [] | no_license | /* Create functions to facilitate bulk downloads */
function parseWFData(str) {
str = str.substr(24);
str = str.substr(0, str.length - 24);
str = str.replace(/\\"/g, '"');
return JSON.parse(str);
}
var lastResponse = "";
var lastXHR;
function handleResponse(xhr) {
if (xhr.responseURL.indexOf('edocs/documents... | true |
5948aa03d82c1476525f98486e8333d683363e99 | JavaScript | masha007555/PRO-C23-B-SUPPLY-MISSION---2 | /sketch.js | UTF-8 | 2,807 | 2.765625 | 3 | [] | no_license | var helicopterIMG, helicopterSprite, packageSprite,packageIMG;
var packageBody,ground,ground1,ground2,ground3,ground4,back,backImg;
var people,peopleImg;
var zombie,zombieImg;
var zombie2,zombie2Img;
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
funct... | true |
0225fa423cc7474112d9840c0e2ef92c39170840 | JavaScript | alanrahi/jsi-gravity | /spec/callBack_spec.js | UTF-8 | 310 | 2.671875 | 3 | [] | no_license |
var fns = require('../callBack');
list1 = [
"b",
"b",
"b"
]
list2 = [
"baaaa",
"baaaa",
"baaaa"
]
function thing(list1) {
return list1 + "aaaa";
}
describe("each", function() {
it("should run callback for each element of the array", function() {
expect(fns.each(list1, thing)).toEqual(list2);})
}) | true |
a8e130cd72aaf817b3227c0df921abd2af6150a2 | JavaScript | MaticBernik/Patronage | /patronazna_sluzba_project/patronazna_sluzba_app/static/script/ajax_story12.js | UTF-8 | 3,900 | 2.8125 | 3 | [] | no_license | $(function () {
// ajax za obisk glede na role
$(document).ready(function(){
$.ajax({
type: "POST",
url: "/nurseList/",
data: {
'search_nurse' : String($("#search_nurse").val()),
'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val... | true |
4f0df3844e0c7024ff433094c4789fa443e58dd5 | JavaScript | xira25/projet-mjean_gfadi | /src/app/services/DataExtract.js | UTF-8 | 4,106 | 2.734375 | 3 | [] | no_license | // Ce Service englobe les requêtes de type GET envers la food API.
function DataExtract($http) {
var $ctrl = this;
// Récupérer une blague concernant la nourriture
$ctrl.getJoke = function getJoke() {
return $http({
method: 'GET',
url: 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/f... | true |
e9293753bccfc5725dbe238e90f0886b4edbfe08 | JavaScript | PubNubDevelopers/PubNubDucks | /PubNubFunctions/filter-and-translate/function-prefilter.js | UTF-8 | 3,467 | 3.21875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
PubNub Functions Pirate Duck Bot
Copyright 2019, Mark D. F. Williams, All rights reserved
Part of the PubNub Pirate Duck Chat Demo project.
Shows two possible interceptions. One is a bad word filter, the other a translation filter. For ducks.
Install as a "Before publish or subscribe message" t... | true |
c21f9ee8108171d61cef4f2bc0cd6e68a7c4be2d | JavaScript | wolfgang98/nextjs-trs9uq | /lib/api.js | UTF-8 | 928 | 2.578125 | 3 | [] | no_license | const API_URL = 'http://94.16.111.141:1337';
async function fetchAPI(query, { variables } = {}) {
const res = await fetch(`${API_URL}/graphql`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query,
variables,
}),
})
const json = a... | true |
61853f120deb5c5563dd51f47e1a27c388910d4f | JavaScript | cloneforyou/content-review-lookup | /dist/carnage-test/Spectrum.js | UTF-8 | 8,685 | 2.5625 | 3 | [
"CC-BY-4.0"
] | permissive | /**
* @name Spectrum
* @version v0.6
* @author Ultimate Dark Carnage
**/
(function($, mw){
"use strict";
window.dev = Object.assign({}, window.dev);
if ("spectrum" in window.dev) return;
// Utility object
var Util = {};
// Clamp function
var clamp = Util.clamp... | true |
c05f2626528cab0e91e898a4c3eec33ec8ef244b | JavaScript | tvdstorm/waebric | /implementations/javascript/vanilla/parser/syntactic/WaebricPredicateParser.js | UTF-8 | 7,334 | 3.375 | 3 | [] | no_license | /**
* Waebric Predicate Parser
*
* @author Nickolas Heirbaut [nickolas.heirbaut@dejasmijn.be]
*/
function WaebricPredicateParser(){
this.currentToken;
this.expressionParser = new WaebricExpressionParser();
/**
* Parses the input to {Embedding}
* Updates currentToken of the parent parser
*
* @param ... | true |
75e0f7292ffb9291be96d7b02e4ab6a2204b1375 | JavaScript | LorDB1998/SEDCv5_JS | /homework/submissions/Violeta Zabeva/hw03_expLevelUp/domasnawizard.js | UTF-8 | 607 | 3.609375 | 4 | [] | no_license |
function willLevelUp(currentExp,neededExp,winExp){
var levelUp = currentExp+winExp;
var answer;
if (levelUp<neededExp){
var expNeeded = neededExp - levelUp;
answer= "You didn't reach to next level ,you need "+expNeeded+" more to be able to learn new spells.";
}
else {
... | true |
b1183968689c34f4a648cd43f3d80f5739580be6 | JavaScript | besseddrest/exercises | /data-structures-algorithms-js/ch03/videoRental.js | UTF-8 | 4,029 | 3.484375 | 3 | [] | no_license | function List() {
this.listSize = 0;
this.pos = 0;
this.dataStore = [];
this.clear = clear;
this.find = find;
this.toString = toString;
this.insert = insert;
this.append = append;
this.remove = remove;
this.front = front;
this.end = end;
this.prev = prev;
this.next = next;
this.length = leng... | true |
4940e23e996b40b1e4c0d4f015f2b4366e8c8201 | JavaScript | Iiridayn/iiridayn.info | /www/js/wishlist.js | UTF-8 | 1,978 | 2.765625 | 3 | [] | no_license | function ajax(method, url, handler, sync) {
sync = typeof sync !== 'undefined' ? sync : true;
xhr = new XMLHttpRequest();
xhr.open(method, url, sync);
xhr.onload = handler;
xhr.send();
//console.log(xhr.status);
//console.log(xhr.responseText)
}
// onload
(function () {
var ids = [];
var className = 'purchas... | true |
795cbb878f2e1907f39af79489762c5e4f78fa4d | JavaScript | miguelrk/tum-mw-bachelorarbeit | /03-entwicklungsphase/Code/xml-visualizer.js | UTF-8 | 5,223 | 2.734375 | 3 | [] | no_license | "use strict"; // Prohibit use of undeclared variables
window.addEventListener('load', () => {
console.log("Page loaded succesfully.");
let visualizationString;
let visualizationJson;
let visualizationXml;
function loadJson(event) {
let target = event.target.id;
let jsonFile = event.t... | true |
86858939494b51f51c884e667811158c034b1406 | JavaScript | DemoJLU/blog | /src/main/resources/static/js/common/map.js | UTF-8 | 2,233 | 3.5625 | 4 | [
"MIT"
] | permissive | var Map = function (){
/************基础变量**************/
var hashmap = {};
var keys = [];
var vals = [];
var entrys = [];
var size = 0;
var index = {};
var Entry = function(key,value){
var entryKey = key;
var entryValue = value;
this.getKey = function (){
return entryKey... | true |
aa5b974ce4ad183e60f29113bfe13ed9b2e6e088 | JavaScript | Xananax/skywalker | /lib/regex.js | UTF-8 | 345 | 2.859375 | 3 | [
"MIT"
] | permissive | var RegexEscape = function(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};
RegexEscape.start = /^\//;
RegexEscape.end = /\/([gis]{1,3}?)$/;
var strToRegex = function(s){
s = s.replace(RegexEscape.start,'');
var m;
if(m = s.match(RegexEscape.end)){
m = m[1];
s = s.replace(RegexEscape.end,'');
}
... | true |
be439a22afa29b7f4f783689440debe1ac817583 | JavaScript | PopeOnARope/redux-food-app | /reducers/index.js | UTF-8 | 582 | 2.640625 | 3 | [] | no_license | import { clone } from 'lodash'
let initialState = {'foo': 'bar'}
export default (state=initialState, action) => {
console.log('reducer listening', state, action)
var _state = clone(state)
switch(action.type) {
case "RECIEVE_ITEMS":
for (var item of action.items) {
item.key = item.id
}
... | true |
156717d9527ee80d844b34ea13634dd870718ffc | JavaScript | YanceyOfficial/leetcode-trip | /src/leetcode/javascript/easy/703.数据流中的第-k-大元素.js | UTF-8 | 2,429 | 3.90625 | 4 | [
"MIT"
] | permissive | /*
* @lc app=leetcode.cn id=703 lang=javascript
*
* [703] 数据流中的第 K 大元素
*/
// @lc code=start
/**
* @param {number} k
* @param {number[]} nums
*/
var KthLargest = function (k, nums) {
this.k = k
this.heap = new MinHeap()
for (const x of nums) {
this.add(x)
}
}
/**
* @param {number} val
* @return {n... | true |
51816d6f5b3a323ad8280c90251ca71929d0badd | JavaScript | surdu/github-news-pics | /assets/js/addPicture.js | UTF-8 | 1,934 | 2.84375 | 3 | [] | no_license | chrome.storage.sync.get({iconSize: 30}, function(options) {
var newsNode = document.querySelector(".news");
if (newsNode) {
var firstEntries = document.querySelectorAll(".news .alert.simple");
addPictureToNodes(firstEntries);
var observer = new MutationObserver(function(mutations) {
for (var f = 0; f < mu... | true |
de9b3f8db4876f8e18d11b4064dd5297d765a35a | JavaScript | jonathancowling/piemdb-with-nfr-tests | /academy-2020-piemdb/app/components/GlobalComponents/GlobalTextSanitisers/GlobalPriceSanitiser.jsx | UTF-8 | 1,526 | 2.859375 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
export const splitPrice = (price) => {
// remove the currency from the start of the price
const number = price.replace(price[0], '');
return number;
};
export const checkValidDecimalOnPrice = (price) => {
const number = splitPrice(price);
// ch... | true |
4d4545414264c6f2d89192ef581be897fcdd77ad | JavaScript | onion124567/pokers | /assets/scripts/PokerUtil.js | UTF-8 | 15,900 | 3.234375 | 3 | [] | no_license | let pokerWeight = [4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3, 5, 16, 17, 18];//主5为18
let LEFT_WIN = -1;
let RIGHT_WIN = 1;
export default class PokerUtil {
static testLogic = (testArray) => {
let gamehost = Math.random() * 4;
let roundhost = Math.random() * 4;
gamehost = parseInt(gamehost) +... | true |
d30b6dd0158af5e123741ca3122aa0bc11b747c5 | JavaScript | Irian3x3/dyno-bot-master | /dyno-bot-master/Dyno-premium/src/commands/Misc/Rps.js | UTF-8 | 1,751 | 2.765625 | 3 | [
"MIT",
"CC-BY-NC-ND-4.0"
] | permissive | 'use strict';
const Command = Loader.require('./core/structures/Command');
const utils = Loader.require('./core/utils');
class Rps extends Command {
constructor(...args) {
super(...args);
this.aliases = ['rps'];
this.group = 'Misc';
this.description = 'Rock Paper Scissors with the bot.';
this... | true |
fa69a7056e6f24b1cc3a6404d3166edc60d20355 | JavaScript | BrunaSSS/logica | /exercicios_obrigatorios/exercicio5_ifbasico.js | UTF-8 | 396 | 4.1875 | 4 | [] | no_license | /* Escreva um programa para ler 3 valores inteiros (considere que não serão lidos valores iguais)
e escrevê-los em ordem crescente */
var n1, n2, n3, user;
user = require("readline-sync")
n1 = user.questionInt("Digite o primeiro valor ")
n2 = user.questionInt("Digite o segundo valor ")
n3 = user.questionInt("Digite... | true |
66ad5db7b3eceb89931de0e08cdf2e480deeeebc | JavaScript | Shreyas-Mishra/React-Bootstrap-Elements | /react-comps/navs/src/Pages/Home/home.js | UTF-8 | 1,974 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import Nav from '../../nav1/nav1';
import { DISHES } from '../Home/dishes';
import { Card, CardImg } from 'react-bootstrap';
import SearchBox from '../../components/SearchBox'
class Home extends Component {
constructor(props) {
super(props);
this.state = {
... | true |
daba41528177f83baa565e3df590c70817ac4637 | JavaScript | arisuwais/challange | /game_suwit_jawa.js | UTF-8 | 843 | 3.640625 | 4 | [] | no_license | // menagkap pilihan player
var p = ('gajah', 'semut', 'orang');
// menagkap pilihan komputer
// membangkitkan bilangan random
var comp = Math.random();
if (comp < 0.34) {
p = 'gajah';
} else if (comp >= 0.34 && comp < 0.67) {
p = 'semut'
} else {
p = 'orang'
}
var hasil = '';
if (p == comp) {
hasil... | true |
47cd76b4703dae7dd9a6f332966255508af799ea | JavaScript | abadAfonsoJaime/github-releases | /src/components/ReleaseRow/ReleaseRow.js | UTF-8 | 1,421 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, { PropTypes } from 'react';
// Componentes
import ExternalLink from '../ExternalLink';
import FormattedDate from '../FormattedDate';
import GithubAvatar from '../GithubAvatar';
/**
* Muestra una release de un repositorio
*/
class ReleaseRow extends React.PureComponent {
/**
* Props del componente... | true |
c1dd9bc8359a51e62c29f70a92ad04af8abdce02 | JavaScript | webexpert1/datastructures | /reversestring/index.js | UTF-8 | 783 | 4.53125 | 5 | [] | no_license | // Create a function that reverses a string:
// 'Hi My name is Richard' should be
// drahciR si eman yM iH
// Soln 1
function reverse(str) {
if(!str || str.length < 2 || typeof str !== 'string') {
return 'Hey this is bad';
}
let array1 = str.split('');
let reverseArray = [];
for(let i = ar... | true |
3402ccc2f758a21f6d8dda735347531ca237c356 | JavaScript | huhu72/My-Macronutrients-Web | /Code/scripts/index.js | UTF-8 | 4,810 | 3.078125 | 3 | [] | no_license | var state = false;
var checked = false;
var name = document.getElementById("usename");
var welcome = document.getElementById("welcome");
var password, email, name, confirmPass, user, userID;
var database = firebase.database();
//Start of log in function
function signup() {
const gender = document.querySelectorAll('in... | true |
8647886fb01f2c8a444137277c069c4f2a907b8a | JavaScript | sakuwan/DSA | /src/algorithms/functional/deepEquals.js | UTF-8 | 2,461 | 3.546875 | 4 | [
"MIT"
] | permissive | /* === Deep equal ===
*
* Deep equality recursively walks through the properties of all objects, until
* all primitive components or strict equality comparisons are satisified.
*/
// NaN & +0/-0 equality
const is = ('is' in Object) ? Object.is : (lhs, rhs) => (
(lhs === rhs)
? (lhs !== 0 || 1 / lhs !== 1 / rh... | true |
6684204857c39ca1d48accc164d4645a9a3cb863 | JavaScript | cfrinka/exercicios_aulas | /CLASSES_L**/E4.js | UTF-8 | 767 | 3.421875 | 3 | [] | no_license | class Usuario {
constructor(nome, email, endereco, formaPagamento){
this.nome = nome;
this.email = email;
this.endereco = endereco;
}
}
class Motorista extends Usuario{
constructor(nome, email, endereco, placaCarro){
super(nome, email, endereco)
this.placaCarro = pla... | true |
cf63cb1b2f1865055343b72c8a967ae8dcf1e1fc | JavaScript | shubhamambastha/Interview-questions | /Array/Basics/reverse-the-array/index.js | UTF-8 | 390 | 3.859375 | 4 | [] | no_license | /**
* Approach 1:
* Note: Loop till the middle, and sway element to its opposite elements.
* Using temp variables
* Two pointer appraoch
*/
const solveA = (arr) => {
let i = 0; // first element
let j = arr.length - 1; // last element
while (i <= j) {
let temp1 = arr[i];
let temp2 = arr[j];
arr[i... | true |
c4b85e56e8ed3494411e678106df507b842bd8df | JavaScript | ChaseBradbury/When-Dreams-Die | /Ground.js | UTF-8 | 8,629 | 3.3125 | 3 | [] | no_license | /*Ground class:
* All parameters passed in are based on cellSize, very similar to platform
* x and y define what grid cell the ground's top left coordinate is.
* numBrick is the size of the ground in units of cellSize.
*/
function Ground(x, y, numBricks, numBricksY) {
//Initialize all parameters
this.x = x... | true |
9577dc97919d3dc838973612470e48b99ed704be | JavaScript | Liqiaomiao/node | /node-in-action/parallel_flow_control/index.js | UTF-8 | 1,642 | 3.625 | 4 | [
"MIT"
] | permissive | const fs = require('fs')
const tasks = []
const wordCounts = {} //{string:number}
const filesDir = './text'
let completedTasks = 0
function checkIfComplete() {
/*
when all tasks have completed,
list each word used in the files and
the number of times it was used
*/
completedTasks++
if (comp... | true |