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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c8b45c6677a62eda148f393e5c34223c368b1118 | JavaScript | khayliang/n-body-simulation | /src/utils/calculateGravity.js | UTF-8 | 322 | 2.625 | 3 | [] | no_license | import distanceBetween from './distanceBetween'
export default function calculateGravity(originObj, targetObj) {
const gravConstant = 0.0001
const dist = distanceBetween(originObj.getCoords(), targetObj.getCoords())
const force = gravConstant * ((originObj.getMass() * targetObj.getMass()) / dist)
return force
... | true |
5b01672e93a11d829761362a5adcef2f63d0e0fa | JavaScript | ashit1247/Login-Authentication | /assignment-frontend/src/Helpers/Stores/linkedStores.js | UTF-8 | 201 | 2.671875 | 3 | [] | no_license | export const linkedStores = () => {
// Create instances of all stores which need linking here
const stores = {};
//Link all the stores
return Object.keys(stores).map(key => stores[key]);
};
| true |
fea3c3d37571e00b4dc678a97b1a09e65050f6da | JavaScript | kimdang2/grocery-list | /client/src/Components/GroceryItem.jsx | UTF-8 | 428 | 2.640625 | 3 | [] | no_license | import React from "react";
const GroceryItem = ({grocery}) => {
return(
<li>
<span>{grocery.item}</span>
<span>{grocery.quantity}</span>
</li>
)
}
// const GroceryItem = (props) => {
// console.log('hi')
// console.log(props.grocery.item)
// return(
// <li>
// <span>{props.grocery.item}</span... | true |
5a20227f711259e28a0c7d85bb8e443714ea47bd | JavaScript | RavishVirani/Internet-Computing | /nodejs/http_server2.js | UTF-8 | 5,917 | 3.328125 | 3 | [] | no_license | /*
* Hand-on Node.js web server, modularized style
* This contains a list of simple node.js web server examples
* Test & run:
* 1. Uncomment each block,
* 2. Type and run: node http_server2.js
* 3. Open the provided URL in browser
*/
var http = require('http');
const port = 3000;
const host... | true |
b19debc6862b46691aa5c0244bb57e8fb12fb671 | JavaScript | muneebhdeveloper/mhm-recipe-search-app | /src/js/model.js | UTF-8 | 2,438 | 2.6875 | 3 | [] | no_license | import { async } from 'regenerator-runtime';
import { timeout, getJSON } from './helper.js';
import { API_URL, RESULT_PER_PAGE } from './config.js';
export const state = {
recipe: {},
search: {
query: '',
results: [],
currentPage: 1,
pagesCount: 1,
resultsPerPage: RESULT_PER_PAGE,
},
};
expo... | true |
7f73fdd7da9d6dc45e11560fd7b3b029141008e8 | JavaScript | madushan-sooriyarathne/world-weather | /src/js/views/searchView.js | UTF-8 | 1,090 | 2.59375 | 3 | [] | no_license | import { elements, clearUI, renderPaginationButtons } from "./base";
const addToSearchUI = item => {
const markup = `
<div class="search-result__card">
<h1 class="city">${item.name}, <span>${item.country}</span></h1>
<a href="#" class="btn btn__add search-add" id="${item.id}">Add</a>
</div>... | true |
cceca26fb42826c73dec7f10314e807948fd5de1 | JavaScript | iStanHua/vue3-app | /src/utils/camera.js | UTF-8 | 2,786 | 3.015625 | 3 | [] | no_license |
export default class Camera {
/**
* ๆๅๅคด
* @param {Number} options.width ๅฎฝๅบฆ
* @param {Number} options.height ้ซๅบฆ
* @param {Boolean} options.mirror ๆฏๅฆๆฏๆ้ๅญ
* @param {Object} options.targetCanvas canvasๅฏน่ฑก
* @param {Number} options.fps ๅธง/็ง
*
... | true |
ef6750b8359369564dc71f491ae292a0150bd506 | JavaScript | gestionarlaweb/ejemplosJavaScript | /json/datosJson.js | UTF-8 | 900 | 3.40625 | 3 | [] | no_license | var myObjetoJson = {
"nombre": "david",
"apellido": "rabassa"
};
var jsonString = JSON.stringify(myObjetoJson); // Paso a string myObjetoJson
var objetoDesdeJson = JSON.parse( jsonString); // Pasamos a string el json
function comprobar()
{
var nombre = document.form... | true |
4264659bf916216636152ced707fcd660928a4a0 | JavaScript | ionutss/Intel-Galileo-Node.JS-Server | /main.js | UTF-8 | 1,730 | 2.875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Set this to the ip address of your board (not 127.0.0.1)
var ipAddress = '192.168.0.102';
var mraa = require('mraa'); //require mraa
console.log('MRAA Version: ' + mraa.getVersion()); //write the mraa version to the console
// Start by loading in some data
var fs = require('fs');
//var five = require("johnny-fiv... | true |
341b48b9ecfdc3aeb423775bdc8dfa015913f638 | JavaScript | BrandonKarl/Exposhare-GraphQL | /helper/formatConversation.js | UTF-8 | 2,672 | 2.6875 | 3 | [] | no_license | export const formatConversation = (conversations) => {
if(conversations.rows === 0) {
return []
}
console.log(conversations.rows)
let conArr = []
let currentIndex = 0
let currentId = conversations.rows[0].id
conArr.push({
user1: {
firstname: conversations.rows[0].uo_first,
lastname: ... | true |
b8d5a8717b2da8442f8f452f7079a7f2eecb1ff5 | JavaScript | SnowLeopardMoonBear/learn-react | /mandalart/client/redux-reference.js | UTF-8 | 3,241 | 3.4375 | 3 | [] | no_license | // From https://velog.io/@velopert/Redux-3-๋ฆฌ๋์ค๋ฅผ-๋ฆฌ์กํธ์-ํจ๊ป-์ฌ์ฉํ๊ธฐ-nvjltahf5e
// redux๋ฅผ react์ ํจ๊ป ์ฐ๊ธฐ ์ํด ์๋ ์ปดํฌ๋ํธ์ ๋ํด์ฃผ๋ ์ปจํ
์ด๋ ์ปดํฌ๋ํธ์
๋๋ค.
// 1. store์ ๊ฐ์ด ๋ณํ๋ฉด -> ๋ณํ ๊ฐ์ ๋ฐ์์์ -> ์๋ ์ปดํฌ๋ํธ์ props๋ก ๋ฃ์ด์ค๋๋ค
// 2. store์์ ๋ด๋ ค๋ณด๋ธ ๋ด์ฅํจ์ dispatch์ reducer๋ฅผ props๋ก ๋ฐ์ ์ state๋ฅผ dispatchํ๋ ํจ์๋ฅผ ๋ง๋ค๊ณ ,
// ๊ทธ ํจ์๋ฅผ ์๋ ์ปดํฌ๋ํธ์ prop๋ก ๋ฃ์ด์ค๋๋ค
import React, { C... | true |
a7dd3b6ce86a5844d77c0c19bc801563a31e7731 | JavaScript | msmailcode/FreeCodeCamp | /Intermediate-Algorithm-Scripting/Roman Numeral Converter.js | UTF-8 | 706 | 3.171875 | 3 | [] | no_license | function convertToRoman(num) {
var copy = num;
var th = Math.floor(num / 1000);
num = num - th * 1000;
var hu = Math.floor(num / 100);
num = num - hu * 100;
var te = Math.floor(num / 10);
num = num - te * 10;
var on = num;
var ona = [0,'I','II','III','IV','V','VI','VII','VIII','IX'];
console.log(ona... | true |
1a8c5280de9c05beb24e64744af3bcc7249bcde3 | JavaScript | LeeCherry731/Homework_codecamp_7 | /javaScript Advanced/เธเนเธญเธเธตเน 1/dist/7.dev.js | UTF-8 | 431 | 3.625 | 4 | [] | no_license | "use strict";
var n = prompt("Enter [6,8,16] : ");
array = JSON.parse(n);
var gcd = function gcd(a, b, c) {
var min = a < b ? a : b;
for (var i = min; i >= 1; i--) {
if (a % i === 0 && b % i === 0 && c % i === 0) {
return i;
}
}
};
var fn = function fn(n) {
// console.log(n[0])
return gcd(n[... | true |
35dd4a770252f66b004c41d6479e08724cfe8246 | JavaScript | stphncrt/React_Chat | /src/helper/Functions.js | UTF-8 | 268 | 2.71875 | 3 | [] | no_license | import { format, parseISO, isValid } from "date-fns";
export function DateFormatting(date) {
return isValid(date) ? format(parseISO(date), "mm/dd/yyyy") : date;
}
export function capitalizeFirstLetter(data) {
return data.charAt(0).toUpperCase() + data.slice(1);
}
| true |
fe37d104273f13c1094bcb52cceb2506887ee184 | JavaScript | SyPhamWSC/tank-nodejs | /src/scripts/es6/bullet-drawer.js | UTF-8 | 890 | 2.953125 | 3 | [] | no_license | 'use strict';
class BulletDrawer {
constructor(theContext, BulletSize) {
this.context = theContext;
this.img = new Image();
this.img.src = "RESOURCE/Image/bullet.png";
this.BulletSize = BulletSize;
this.curBrickArr = [];
this.preBrickArr = [];
}
setNewBulletD... | true |
c686ed23494d15e01750270a55e84c56aa29d82f | JavaScript | lxm6938/igme230 | /fall2018final/fall2018final.js | UTF-8 | 768 | 2.875 | 3 | [] | no_license | $(document).ready(() => {
$('.list').css("display", "none") //hiding submenus on load
let article0 = ("article0.txt") //loading article0 on load
$('article').load(article0)
})
$('.top').on('click', function(){ //when a menu is clicked
$(this).next().slideToggle() //slide the submenu out
})
$("input[... | true |
9243b01d5f0457efa5fad13865e2d83c837c0feb | JavaScript | AnonymousICT/ecommerce-store | /src/Context.js | UTF-8 | 574 | 2.5625 | 3 | [] | no_license | import React, {useState, useEffect} from "react"
const Context = React.createContext()
function ContextProvdier({children}) {
const[allPhotos, setAllPhotos] = useState([])
const url ="https://raw.githubusercontent.com/bobziroll/scrimba-react-bootcamp-images/master/images.json"
useEffect(()=>{
fe... | true |
9e31d8a0794306f6e3a64f66e326ebce408eec36 | JavaScript | andrewbird2/donation_portal | /static/js/credit_card.js | UTF-8 | 2,073 | 2.578125 | 3 | [] | no_license |
jQuery(function ($) {
var $form = $('#id_pledge_form');
/* Fancy restrictive input formatting via jQuery.payment library*/
$('input[name=cardNumber]').payment('formatCardNumber');
$('input[name=cardCVC]').payment('formatCardCVC');
$('input[name=cardExpiry]').payment('formatCardExpiry');
jQue... | true |
054bd4d260798556cbd7091a8b995e59df68da1c | JavaScript | brudolce/codewars | /4-kyu/Codewars style ranking system.js | UTF-8 | 972 | 3.03125 | 3 | [] | no_license | var User = class {
constructor() {
this.rank = -8;
this.progress = 0;
this.HIGHEST = 8;
}
rank() {
return this.rank;
}
progress() {
return this.progress;
}
incProgress(ranking) {
if (ranking == 0 || ranking > this.HIGHEST || ranking < -this.HIGHEST)
throw new RangeError("rank... | true |
6c1bae6a06b28b6debefacd05771de6c0201ab97 | JavaScript | ronbarrantes/leetcode | /OLD/study2020/isValidBST.js | UTF-8 | 1,067 | 3.453125 | 3 | [] | no_license | /* eslint-disable no-mixed-spaces-and-tabs */
const validate = (list) => {
for(let i = 0; i < list.length - 1; i++){
if (list[i] >= list[i+1])
return false
}
return true
}
const divide = (root, stack, list) => {
if (!root)
return true
stack.push(root.val)
if (!root.left || !root.right && root.val){
... | true |
00268c0bf61c4f6efb443e821805deb8f80ad9fe | JavaScript | joardar-aditya/RabbitMQBasics | /consumer.js | UTF-8 | 1,445 | 3.234375 | 3 | [] | no_license | //The library requiring the The 'Advanced Message Queuing Protocol (AMQP) -: (amqp.org)
/** The Protocol in short is a communication protocol for business messages between applications */
const amqp = require("amqplib");
//Calling the function
connect();
async function connect() {
try{
//STEP 1-: Establish the... | true |
913377648e5dd175b096f6310257a0c556c1e401 | JavaScript | KKKlaus/Web-Developer | /work/react-services/chat/src/UsersList.jsx | UTF-8 | 363 | 2.609375 | 3 | [] | no_license | import React from 'react';
const formatUser = function(name) {
return (
<li key={name}>
<span className="username">{name}</span>
</li>
);
};
const UsersList = ({ users }) => {
return (
<ul className="users">
{ Object.values(users).map( name => { return formatUser(name) } ) }
... | true |
b7469aec3d5efe2b50fa1ddcf9d21ad5dcd93354 | JavaScript | devdigital/churl | /src/browser/pager.test.js | UTF-8 | 1,320 | 2.625 | 3 | [
"MIT"
] | permissive | import pager from './pager'
describe('pager', () => {
it('should throw if delegate is undefined', async () => {
await expect(pager()()()).rejects.toHaveProperty(
'message',
'page delegate must be specified.'
)
})
it('should throw if delegate is null', async () => {
await expect(pager()()... | true |
dfc7d44dfb16ae604e25ba8df1fa94d46f82d80c | JavaScript | josedavms13/Pokedex | /src/services/fetchByName.js | UTF-8 | 240 | 2.90625 | 3 | [] | no_license |
function fetchByName (name){
const baseUrl = `https://pokeapi.co/api/v2/pokemon/`
const urlName = name.toLowerCase().trim();
return fetch(baseUrl+urlName)
.then(res=> res.json());
}
export default fetchByName | true |
654e0e3b4ddf356c108068e9684b58dc2675af61 | JavaScript | amilytom/netcollectapicloud | /controllers/user.js | UTF-8 | 11,260 | 2.53125 | 3 | [] | no_license | // ๅผๅ
ฅๅ
ฌๅ
ฑๆนๆณ
const Common = require("../utils/common");
// ๅผๅ
ฅuser่กจ็model
const UserModel = require("../models/user");
// ๅผๅ
ฅgroup่กจ็model
const GroupModel = require("../models/group");
// ๅผๅ
ฅๅธธ้
const Constant = require("../constant/constant");
// ๅผๅ
ฅdateformatๅ
const dateFormat = require("dateformat");
const Sequelize = requ... | true |
dc4c3d5e3f9e3035049f03535954fd740ec93177 | JavaScript | jcheong9/Outfit-Doesfit | /public/js/comparison.js | UTF-8 | 6,705 | 3.234375 | 3 | [] | no_license | // Waiting for the document to load and run the function
$(document).ready(function() {
//varibles used to store the data in arrays
var currentSelection = 0;
var arrayClothSelection = [];
var arrayCurrentObj = [];
var arrayBrandObj = [];
//variable referencing the firebase database
var starCountRef = fire... | true |
d880885239d398a89dc326e45bd315bec0e551b1 | JavaScript | firewa1kwithme/tryJS | /4_MissingInteger.js | UTF-8 | 558 | 3.28125 | 3 | [] | no_license | function solution(A) {
A.sort();
var uniqueA = new Set();
var B = [];
for (let i = 0; i < A.length; i++){
if (A[i] > 0) {
uniqueA.add(A[i]);
}
}
for (let j=1; j <= uniqueA.size+1; j++){
B.push(j);
}
for (let k = 0; k <= uniqueA.size; k++) {
if (!uniqueA.has(B[k])) {
return B[... | true |
8f33f05435fc28bece381a909d9771626accd4b6 | JavaScript | goatslacker/akira | /lib/core/any.js | UTF-8 | 184 | 2.84375 | 3 | [
"MIT"
] | permissive | function any(f, a) {
if (arguments.length == 1) return function (a) { return any(f, a) }
var i = 0, l = a.length
for (i; i < l; i += 1) if (f(a[i])) return true
return false
}
| true |
7df8661867bed42693de2ed900cc0eb6eed220f9 | JavaScript | rex-cms/content-js | /content.js | UTF-8 | 9,006 | 3.015625 | 3 | [
"MIT"
] | permissive | (function() {
// Create local references to array methods we'll want to use later.
var array = [];
var slice = array.slice;
document.addEventListener("DOMContentLoaded", function(event) {
if (renderOnLoad.length) {
renderOnLoad.forEach(function(view) {
onRender(view[0], view[1]);
}... | true |
4cc01df689bfcecf14add8f123179b45bfdc7d18 | JavaScript | Open-EO/openeo-js-commons | /src/processSchema.js | UTF-8 | 4,135 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | const ProcessUtils = require('./processUtils');
const ProcessDataType = require('./processDataType');
const Utils = require('./utils');
/**
* Wrapper class for the process schemas (i.e. from parameters or return value).
*
* @class
*/
class ProcessSchema {
/**
* Constructs a new process schema based on the op... | true |
34b0e1f7bc0cc695fe0efedb4e8d70c9e7f00109 | JavaScript | mordecai23/Projet-TER-JeuDeMots | /View/js/countDown.js | UTF-8 | 1,614 | 2.859375 | 3 | [] | no_license | /**
* Fonction qui met un compte ร rebours de 3secondes avant le dรฉbut d'une partie
*/
function loadingGame() {
document.getElementById("beginCountDown").innerHTML = `
<h2 class="mt-5 mb-3 text-center">Veuillez patienter ...</h2>
`;
let timeleftBegin = 3;
let beforeTimer = setInterval(function(){
i... | true |
4b5e57550cf47152dc2a4268d5791f09eb13b703 | JavaScript | banglatoriq/shopping-cart.io | /shopCart.js | UTF-8 | 2,682 | 3.421875 | 3 | [] | no_license | // first item
const addItem = document.getElementById("plusBtn");
addItem.addEventListener("click",function(){
const inputItem1 = document.getElementById("input").value++;
const firstItem = document.getElementById("price").innerText;
const firstItemNum = parseFloat(firstItem);
const addItemOne = firstI... | true |
7a5701d5b3397d57d13a90c536d82e92f2018341 | JavaScript | Glemakk/JS-test | /js/tasksOf2module.js | UTF-8 | 16,080 | 3.828125 | 4 | [] | no_license | // const fruits = ['ัะฑะปะพะบะพ', 'ัะปะธะฒะฐ', 'ะณัััะฐ', 'ะฐะฟะตะปััะธะฝ'];
// // ะะธัะธ ะบะพะด ะฝะธะถะต ััะพะน ัััะพะบะธ
// const firstElement = fruits[0];
// const secondElement = fruits[1];
// const lastElement = fruits[3];
// if (fruits.includes(fruits[0])) {
// return 'ะญัะพ ะฒะตัะฝัะบ ัะปะธะฒะฐ!';
// }
// console.log(fruits);
// console.log(first... | true |
c8d351ab707c206322e6f8aa7efe756048e55603 | JavaScript | fongvang/MEAN_Counter | /app.js | UTF-8 | 1,347 | 2.78125 | 3 | [] | no_license | var express = require('express');
var app = express();
var session = require('express-session');
app.use(express.static(__dirname + "/static/images"));
app.use(express.static(__dirname + "/static/style"));
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(session({
secret: "Hey, this... | true |
3e17a188afe153abee9ab36189c9174497c79e40 | JavaScript | erminiomendes/lotide | /head.js | UTF-8 | 181 | 2.875 | 3 | [] | no_license |
const head = function(x){
return x[0];
};
module.exports = head;
// TEST CODE
// assertEqual(head([3,2]), 5);
// assertEqual(head(["Hello", "Lighthouse", "Labs"]), "Hello"); | true |
4ee4a12820f1a96496263fd1a31887130b6b5f31 | JavaScript | polaris327/Visual-Builder | /src/js/components/PageListComponent/PageListComponent.js | UTF-8 | 2,819 | 2.546875 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
export default class PageListComponent extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
pageId: PropTypes.string.isRequired,
onDragOver :PropTypes.func,
onDragEnd :PropTypes.func,
onDragExit... | true |
668c8f661d2d268492a257f6fa4b636ab6343e52 | JavaScript | umangmathur92/R-Earth | /public/scripts/signup.js | UTF-8 | 1,923 | 2.765625 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
setNavbarScrollAnimation();
$('#signup-form').submit(function(event) {
//TODO - VALIDATION
const username = $('#username-sign-up').val();
const password = $('#password_sign_up').val();
const name = $('#name').val();
const confirmation = $('#repeat_password').... | true |
6aade909f25ff26d58310fd8f74b39e427458d8c | JavaScript | redDragonLH/ldle | /leetcode/algorithm/1688count-of-matches-in-tournament.js | UTF-8 | 1,234 | 4.125 | 4 | [] | no_license | /**
* 1688. ๆฏ่ตไธญ็้
ๅฏนๆฌกๆฐ
*
* ็ปไฝ ไธไธชๆดๆฐ n ๏ผ่กจ็คบๆฏ่ตไธญ็้ไผๆฐใๆฏ่ต้ตๅพชไธ็ง็ฌ็น็่ตๅถ๏ผ
* * ๅฆๆๅฝๅ้ไผๆฐๆฏ ๅถๆฐ ๏ผ้ฃไนๆฏๆฏ้ไผ้ฝไผไธๅฆไธๆฏ้ไผ้
ๅฏนใๆปๅ
ฑ่ฟ่ก n / 2 ๅบๆฏ่ต๏ผไธไบง็ n / 2 ๆฏ้ไผ่ฟๅ
ฅไธไธ่ฝฎใ
* * ๅฆๆๅฝๅ้ไผๆฐไธบ ๅฅๆฐ ๏ผ้ฃไนๅฐไผ้ๆบ่ฝฎ็ฉบๅนถๆ็บงไธๆฏ้ไผ๏ผๅ
ถไฝ็้ไผ้
ๅฏนใๆปๅ
ฑ่ฟ่ก (n - 1) / 2 ๅบๆฏ่ต๏ผไธไบง็ (n - 1) / 2 + 1 ๆฏ้ไผ่ฟๅ
ฅไธไธ่ฝฎใ
*
* ่ฟๅๅจๆฏ่ตไธญ่ฟ่ก็้
ๅฏนๆฌกๆฐ๏ผ็ดๅฐๅณๅบ่ท่้ไผไธบๆญขใ
*/
/**
* ๅจๆฏไธๅบๆฏ่ตไธญ๏ผ่พ็้ไผๆ ๆณๆ็บง๏ผไธไธไผๅๅๅ ๅ็ปญ็ๆฏ่ตใ็ฑไบๆๅๅชๅณๅบไธไธช่ท่้ไผ๏ผๅ ๆญคๅฐฑๆ n-... | true |
0e8997a4ef09e4e5d873d95623bdc7d1cf1bf02d | JavaScript | julsam/VineEditor | /main/vine-editor-settings.js | UTF-8 | 6,787 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
// Imports
const electron_is = require("electron-is");
let _settings;
let _fs;
if (electron_is.main()) {
_settings = require("electron-settings");
_fs = require("fs");
} else if (electron_is.renderer()) {
_settings = ("electron").remote.require("electron-settings");
_fs = remote.require("... | true |
1543952c22c7630e673e93e74bf5c48bdce1adc1 | JavaScript | w7yuu/lint-md | /rules/helper/string.js | UTF-8 | 897 | 3.171875 | 3 | [
"MIT"
] | permissive | const isChinese = s => {
return /^[\u4e00-\u9fa5]{1}$/.test(s);
};
const isAlphabet = s => {
return /^[a-zA-Z]{1}$/.test(s);
};
const isNumber = s => {
return /^[0-9]{1}$/.test(s);
};
/**
* ๅฐๅญ็ฌฆๆ ๅฐๆๆ ่ฎฐๅญ็ฌฆ
* @param s
* @returns {string}
*/
const stringType = s => {
return isNumber(s) ? 'N' :
isAlphabet(s)... | true |
61f89c4b0690af38bb29bd74ec96e4fed1ed3dfc | JavaScript | ahsanaj/javascript-course | /class_03/homework/arrays/yourtopchoices.js | UTF-8 | 1,028 | 4.1875 | 4 | [] | no_license | // Your top choices
// Create an array to hold your top five choices of something (dogs, books, presidents, whatever). If you choose movies, the right top choice is "Satantango".
// For each choice, log to the screen a string like: "My #1 choice is blue."
// Bonus: Change it to log "My 1st choice, "My 2nd choice", "My... | true |
89f9e7c7ca4be932f6399d4c6c6c7e4a1adc24e0 | JavaScript | anhbaotran99/C4EJS100-TranAnhBao | /C4EJS100-TranAnhBao/Session-2/homework-4/index.js | UTF-8 | 144 | 3.890625 | 4 | [] | no_license | let n = prompt("Enter a number");
let result = 1;
for(let i=1; i<=n; i++)
{
result *= i;
}
alert("The factorial of " + n + " is " + result); | true |
a3e11a6b25c7a6734550e8a497da388a82f7f7ce | JavaScript | hashgraph/hedera-improvement-proposal | /scripts/validateHIP.js | UTF-8 | 5,716 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | const fs = require('fs');
const readline = require('readline');
const regexs = require('../assets/regex');
const errs = [];
/**
* Validates a hip's headers by looking for enclosing '---' substrings and calls functions that validate the contents.
*
* @async
* @function captureHeaderValidation
* @param {string} hip... | true |
77a1482e6ce83175783de148131e190a676574b0 | JavaScript | frizzant/bulma-framebox | /framebox.js | UTF-8 | 6,091 | 3.140625 | 3 | [
"MIT"
] | permissive | framebox = () => {
// --- Variables + Objects
// ---
let rotationInterval = false;
let currentItemIndex = 0;
let theFrameboxContainer = document.getElementById('framebox-container');
let framebox = {
container: theFrameboxContainer,
items: theFrameboxContainer.querySelectorAll('.framebox... | true |
5a808c1a75793364ae11a5b5af88eccbf0ca2a4c | JavaScript | iFixit/node-markup | /src/utils.js | UTF-8 | 1,165 | 3.0625 | 3 | [
"MIT"
] | permissive | const isNode = typeof window == "undefined";
/**
* Just like parseInt, but fixed to base-10
*/
function Int(str) {
return parseInt(str, 10);
}
/**
* Cycles through an object and changes all numeric fields to ints
* where necessary. 'context' is used for exception reporting and can be
* left unset upon invocati... | true |
7281ef5fe28803334b8f2e9d99c4be0ff83c398b | JavaScript | leadingtw273/Chaotic-Encryption | /aesDefultTest.js | UTF-8 | 1,367 | 2.734375 | 3 | [] | no_license | const AES = require('./models/aes256_model');
let aes = new AES('sha256', 'aes256');
let input = Buffer.from(['0xff', '0xee', '0xdd', '0xcc', '0xbb', '0xaa', '0x99', '0x88', '0x77', '0x66', '0x55', '0x44', '0x33', '0x22', '0x11', '0x00']);
let key = Buffer.from(['0x00', '0x11', '0x22', '0x33', '0x44', '0x55', '0x66',... | true |
ca029acc8f0811e0a5f76ff3b7e73f9a340aa7ff | JavaScript | tforster/webproducer | /src/Config.js | UTF-8 | 1,465 | 2.9375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | ("use strict");
// System dependencies (Built in modules)
const fs = require("fs");
// Third party dependencies (Typically found in public NPM packages)
const YAML = require("yaml");
/**
* Implements a simple configuration processor that parses YAML into returnable properties.
* @class Config
*/
class Config {
... | true |
f61664d344aeda5a3b77888933048e60ac6853d1 | JavaScript | fahredof/weather-app | /client/src/utils/parseData.js | UTF-8 | 629 | 2.5625 | 3 | [] | no_license | function parseData(data) {
if (!data.error)
return ({
city: data.name,
temp: `${(data.main.temp - 273.15).toFixed(0)}ยฐC`,
image: `https://openweathermap.org/img/wn/${data.weather[0].icon}@2x.png`,
wind: `Wind ${data.wind.speed} m/s`,
overcast: data... | true |
69ccf62532e2afb8f461ec3e89747c876bdc9114 | JavaScript | DavideL90/snack-bar | /Es 5/main.js | UTF-8 | 2,597 | 3.71875 | 4 | [] | no_license | alert("Inizia il gioco!");
var computerScore = 0;
var playerScore = 0;
var conversionValues = ["sasso", "carta", "forbici"]; //Array per convertire i valori del pc
//Creo un ciclo per simulare le tre giocate
for (var i = 0; i < 3; i++) {
var computerGame = Math.floor((Math.random() * 3)); //Genero un numero casuale d... | true |
9cc1ae894c0634372a068460d2d425f2fb20803e | JavaScript | mapbox/expression-jamsession | /src/expression-to-formula.js | UTF-8 | 1,947 | 3.390625 | 3 | [
"BSD-2-Clause"
] | permissive | import expressionOperators from './expression-operators';
const insertSpaceAfter = /("(?:[^\\"]|\\.)*")|[:,]/g;
function stringifyLiteralArray(arr) {
const items = arr.map(item => {
if (Array.isArray(item)) return stringifyLiteralArray(item);
return JSON.stringify(item);
});
return `[${items.join(', ')}... | true |
658609f40ef7032b0b80e478f2ded3ba339f3c9d | JavaScript | sayam-naqvi/chapter-1-67 | /app4 chp14-16.js | UTF-8 | 1,091 | 3.65625 | 4 | [] | no_license | var color = ["red","white","yellow","black","pink"];
document.write(color + "<br>");
// var a = prompt("Enter any color you want to add in the beginning");
// color.unshift(a);
// document.write(color + "<br>");
// var b = prompt("Enter any color you want to add in the end");
// color.push(b);
// document.write... | true |
1fb9aa66778261690a119b330449963233fd23c9 | JavaScript | haijunjunjun/marketing | /marketing/src/main/resources/static/js/yjg.js | UTF-8 | 1,374 | 2.671875 | 3 | [] | no_license | function yunjiagongToast(msg) {
if (msg == "") {
return;
}
var msgStr = msg.toString();
var len = 0;
var str = '<div class="yz_toastRem" id="yzToastRem">' + msgStr + "</div>";
//toastๅผนๅบๆก(rem็ๆฌ)--็ๅฏๅผบ
for (var i = 0; i < msgStr.length; i++) { //้ๅๅญ็ฌฆไธฒ้ฟๅบฆ
if (msgStr.charCodeAt(i... | true |
64eeb3168adac4c6ab67ed7b3d8674261f89269d | JavaScript | Noderiety/node300 | /objectcreate.js | UTF-8 | 311 | 2.703125 | 3 | [] | no_license | let argv = require('yargs').argv;
let util = require('util')
function foo(options) {
options = Object.create(options)
options.value = options.value || true
console.log(options.value, options.a)
}
console.log(argv.value, argv.a)
foo(argv)
console.log(argv.value, argv.a)
console.log('do something else')
| true |
52ef52b5b5c488a6ebc57e90263c505aded0a7c0 | JavaScript | emi1994/CursoIngresoJS | /1-EntradaSalida/jsEntradaSalida-7.js | UTF-8 | 1,662 | 3.875 | 4 | [] | no_license | /*Debemos lograr tomar Los numeros por ID ,
transformarlos a enteros (parseInt),realizar la operaciรณn correcta y
mostrar el resulto por medio de "ALERT"
ej.: "la Resta es 750"*/
function restar()
{
var primerNumero;
var segundoNumero;
var resultadoResta;
primerNumero = document.getElementById('numeroUno').va... | true |
55d10dae701e6aa0a439bea433f2c671d9481054 | JavaScript | robpolisena/lotide | /middle.js | UTF-8 | 594 | 3.21875 | 3 | [] | no_license | const assertArraysEqual = require('./assertArraysEqual');
const middle = function(array) {
let newArray = [];
if (array.length < 3) {
assertArraysEqual(array, newArray);
return newArray;
}
if (array.length > 2 && array.length % 2 === 1) {
newArray.push(array[(array.length - 1) / 2]);
asser... | true |
33758764153bcc03e4cd8f82c3e9cb1d93f3251e | JavaScript | franzenzenhofer/blanka | /js/temp/main.js | UTF-8 | 2,803 | 2.859375 | 3 | [] | no_license | (function() {
var draw, gotStream, loop_id, musicAnalyzer, pause;
CanvasRenderingContext2D.prototype.fillCircle = function(x, y, radius) {
this.beginPath();
this.arc(x, y, radius, 0, 2 * Math.PI);
return this.fill();
};
CanvasRenderingContext2D.prototype.strokeCircle = function(x, y, radius) {
... | true |
c106a2faab7144fa9ebdac9e4ccf390424f7dc60 | JavaScript | yaotusa/webpack-demo | /src/common/Loading.js | UTF-8 | 784 | 2.59375 | 3 | [] | no_license | import React, { Component} from "react"
export default class Loading extends Component{
render(){
if (this.props.error) {
console.error(this.props.error.message)
// When the loader has errored
return <div>Error! <button onClick={ this.props.retry }>Retry</button></div>
... | true |
b372c4cdf11e838465c520bf5e38466b46615ed3 | JavaScript | XccelerateTech/melodywong | /55-sharelink/sharelink/src/Profile.js | UTF-8 | 2,752 | 2.828125 | 3 | [] | no_license | import React, { Component } from 'react';
import faker from 'faker';
import {Button, Modal, Form} from 'semantic-ui-react'
class Profile extends Component {
constructor(props){
super(props);
this.state={
number: this.props.number,
open: false,
name: null,
... | true |
c2a0f99d163660597ad59bac1a5f6fdf054f4750 | JavaScript | lukaspkrr/CarRental | /back/servidor/app/controllers/contatos.js | UTF-8 | 2,627 | 2.765625 | 3 | [
"MIT"
] | permissive | module.exports = function(app){
let api = {};
//-----Callbacks de Email-----//
//Salva um novo Email de um Cliente.
api.salvarEmail = (req, res) => {
const knex = app.connection.conexaoKnex();
const { id_cliente, email } = req.body;
const contatoEmail = { id_cliente, em... | true |
e2f3a0d91f05a6f8b9ad43cd6101f7973c25510b | JavaScript | wdluft/frontend-mentor-intro-component-with-sign-up-form-solution | /app.js | UTF-8 | 1,621 | 3.328125 | 3 | [] | no_license | const form = document.querySelector('#signupForm');
const inputs = document.querySelectorAll('input');
const firstName = document.querySelector('#firstname');
const lastName = document.querySelector('#lastname');
const email = document.querySelector('#email');
const password = document.querySelector('#password');
func... | true |
d4e05b8bb20197086042456c847e4c781dcc6ec1 | JavaScript | Yonerfy/Opdracht | /Javascript-4/app-4.js | UTF-8 | 803 | 4.03125 | 4 | [] | no_license | const age = 26;
const totalAmount = 100;
const name = "Abraham";
// Deel 1: 50% korting
if (age >= 18 && age <= 25) {
console.log("Je bent 18 jaar en je hebt een korting van 50%.");
} else {
console.log("Je hebt geen korting.");
}
// Deel 2: Ludieke actie!
if (name === "Abraham" || name === "Sarah") {
con... | true |
f001f0c027c3df1d520a96a7a01916da34a73fbc | JavaScript | MrVereshchagin/homeworks | /first/script.js | UTF-8 | 1,711 | 3.359375 | 3 | [] | no_license | "use strict"
const body = document.body;
const heroes = [
{name: "Sarah", surname: "Connor", id: "911911"},
{name: "John", surname: "Connor", id: "811811"},
{name: "Kyle", surname: "Reese", id: "711711"},
{name: "Miles", surname: "Dyson", id: "611611"},
{name: "Marcus", surname: "Wright", id: "511... | true |
e2affa66faa036638a2aaca3b63c5bd8d18b07b1 | JavaScript | junajan/market-watch | /server/lib/spreads/spreads.socket.js | UTF-8 | 941 | 2.53125 | 3 | [] | no_license | const spreadsModelFactory = require('./spreads.model');
class SpreadsSocket {
constructor(app, io) {
this.app = app;
this.io = io;
this.config = this.app.get('config');
this.cache = this.app.get('cache');
this.spreads = spreadsModelFactory(this.config, this.cache);
}
registerHandlers (client) {
this._... | true |
e0a76b1547cafe2a29c5352c138142d3e7fa5f0f | JavaScript | PlatziMaster-TalentPlace-App/HPM-DEVARS-FALCONMASTERS-BACKEND | /routes/coaches.js | UTF-8 | 1,920 | 2.546875 | 3 | [] | no_license | const express = require('express');
const CoachesService = require('../services/coaches');
function coachesApi(app) {
const router = express.Router();
app.use('/api/coaches', router);
const coachesService = new CoachesService();
router.get('/', async function (req, res, next) {
const { enabled, page, lim... | true |
db9f17caef7da713fcff888ca547ffb68a72895f | JavaScript | AliSinaSaemi/javascript-practices | /background-slider/script.js | UTF-8 | 716 | 3.1875 | 3 | [] | no_license | let slider = document.querySelector(".background");
let buttons = document.querySelectorAll(".btn");
let counter = 1;
const images = [
"img/img-1.jpg",
"img/img-2.jpg",
"img/img-3.jpg",
"img/img-4.jpg",
];
slider.style.backgroundImage = `url(img/img-${counter}.jpg)`;
buttons.forEach(function (button) {
but... | true |
e20346eefd011a25c75668deb2585a050e411a92 | JavaScript | klajdishark/cw-project-radar | /src/server/controllers/authController.js | UTF-8 | 5,741 | 2.6875 | 3 | [
"MIT"
] | permissive | const crypto = require('crypto')
const { promisify } = require('util')
const jwt = require('jsonwebtoken')
const User = require('./../models/userModel')
const catchAsync = require('./../utils/catchAsync')
const AppError = require('./../utils/AppError')
/***************************/
/* */
/* JW... | true |
cc9841c9f2ce0d9fb5411a244123b5a83376e7ab | JavaScript | RawBoeuf/caliphBot | /main.js | UTF-8 | 803 | 2.671875 | 3 | [] | no_license | const Discord = require('discord.js');
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })
const prefix = '$';
client.commands = new Discord.Collection();
client.events = new Discord.Collection();
['command_handler', 'event_handler'].forEach(handler =>{
require(`./handlers/${han... | true |
8e9f64ee574a8a4fc0f5b719165613008dd70bf7 | JavaScript | WebMobik/admin-panel | /src/components/editor-text/editor-text.js | UTF-8 | 1,147 | 2.984375 | 3 | [] | no_license | export default class EditorText {
constructor(elem, virtualElem) {
this.elem = elem;
this.virtualElem = virtualElem;
this.elem.addEventListener('click', () => this.onClick());
this.elem.addEventListener('blur', () => this.onBlur());
this.elem.addEventListener('keypress', (e)... | true |
194835a761293f7b48843cd86332920b92bdec01 | JavaScript | prokizzle/react-dog-breeds | /src/dogBreeds/DogBreeds.js | UTF-8 | 2,037 | 2.53125 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import axios from "axios";
import styled from "styled-components";
import Breed from "./Breed";
const DogBreeds = () => {
const [breeds, setBreeds] = useState([]);
const [filterTerm, setFilterTerm] = useState("");
useEffect(() => {
const fetchBreeds = async... | true |
0766bdeda598939b21f540ecb87b518f1791ce94 | JavaScript | DanB-Web/mirko-next-shop | /pages/index-2b.js | UTF-8 | 839 | 2.796875 | 3 | [] | no_license | /*
Option 2b - Fetch data client side using API routes
*/
import Head from 'next/head'
import { useState, useEffect } from 'react'
import Title from '../components/Title'
const HomePage = () => {
const [products, setProducts] = useState([])
useEffect(() => {
(async () => {
const response = await fetch... | true |
ead352dab8be4b1ecd33e1fbb563989ed8e11585 | JavaScript | doutori/storybook-webcomponents | /src/countup-button.js | UTF-8 | 733 | 2.6875 | 3 | [] | no_license | import { LitElement, html } from '@polymer/lit-element';
class CountupButton extends LitElement {
static get properties() {
return {
val: { type: Number },
increment: { type: Number },
};
}
constructor() {
super();
this.increment = 1;
this.val = 0;
}
render() {
return ht... | true |
863f67d814f7fb79bf1241d89a4b0449409a3830 | JavaScript | tjwudi/Momenove | /app/scripts/app.js | UTF-8 | 4,254 | 2.71875 | 3 | [] | no_license | $(function() {
/**
* Image Cache
*
* @class ImageCache
*/
function ImageCache() {
if (!('momenove-img-cache' in localStorage)) {
localStorage['momenove-img-cache'] = '';
localStorage['momenove-img-url'] = '';
}
}
/**
* Download image and replace the cached version
*
... | true |
07a734a2609621a05eefc9333f57c13ed5887495 | JavaScript | Kenzie-Academy-Brasil-Developers/noturno-entrega-s1-tabela-multiplicacao-willdevkenzie | /src/tabelaDeMultiplicacao.js | UTF-8 | 221 | 3.453125 | 3 | [] | no_license | function multiply(n){
let x = [];
for (let i = 0; i <= n; i++){
x[i] = [];
for (let y = 0; y <= n; y++){
x[i] [y] = i * y
}
}
console.table (x)
}multiply (15)
| true |
25179ce7bbb08e46690f22c7aa7cacfd91a18436 | JavaScript | allenharborth9835/week-12-employee-tracker | /server.js | UTF-8 | 2,137 | 3.09375 | 3 | [
"Unlicense"
] | permissive | const db = require("./db/connection");
let inquirer = require("inquirer");
const {getTable, createDepartment, createRole, createEmployee, changeEmployeeRole} = require("./utils/routes")
//sql statements to create the table for the different views
const employees = `SELECT employees.id, employees.first_name, employee... | true |
40c9c83bbfab0f557201c58a98f140d426f214ea | JavaScript | codedread/kthoom | /code/metadata/metadata-editor.js | UTF-8 | 10,589 | 2.8125 | 3 | [
"MIT"
] | permissive | import { Book } from '../book.js';
import { BookMetadata, createComicBookXmlFromMetadata } from './book-metadata.js';
import { Key, assert, getElem } from '../common/helpers.js';
import { Zipper } from '../bitjs/archive/compress.js';
import { config } from '../config.js';
// TODO: Always show all buttons on the metada... | true |
0d5577790ca2ef89abe78f2ea0eb6980fd95b2f9 | JavaScript | shlee322/slack-backho-bot | /modules/mma/module.js | UTF-8 | 3,345 | 2.78125 | 3 | [
"MIT"
] | permissive | var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('mma_data.db');
var bot = null;
exports.init = function(bot_obj) {
bot = bot_obj;
db.serialize(function() {
db.run("CREATE TABLE IF NOT EXISTS mma_data (user_id TEXT PRIMARY KEY NOT NULL, start_date INTEGER, end_date INTEGER)");... | true |
1ad35a8b93edce64ad26182d3d6eae930fe7336b | JavaScript | omariosouto/circuloader | /src/index.js | UTF-8 | 1,076 | 2.84375 | 3 | [
"MIT"
] | permissive | (function() {
'use strict';
function _convertLoaderValue(value, type) {
if(type === 'percentToSvg') {
return 251.2 * value / 100
}
if(type === 'svgToPercent') {
return value * 100 / 251.2
}
}
function _numberToPercent(value, max) {
return value * 100 / max
}
function _percentToNumber(value, ma... | true |
e82b4ab67a13eae7a158824ef3159856431582ad | JavaScript | AdamKlevfors/DIT355-Distributed-Systems-Development- | /validator/src/validators/dataFormatValidator.js | UTF-8 | 995 | 3.140625 | 3 | [] | no_license | const ValidData = require('../models/ValidData');
var validateDataFormat = function (newData) {
try {
var parsedNewData = JSON.parse(newData);
// Object.keys is JS method to read the keys of what has been parsed to be further used to validate if the properties
// are equal to what we wan... | true |
5d6604f68365e12d2e8b511eaa09c8994c17ee80 | JavaScript | AlanTas/MSR2021 | /files/65104042.js | UTF-8 | 971 | 2.671875 | 3 | [] | no_license | var customers=["customer1","customer2"];
var currentIndex=0;
private function main()
{
if(customers[currentIndex]){
function1().done(function(data) {
console.log("a");
function2().done(function(data) {
console.log("b");
function3().done(function(data) {
console.log("c... | true |
696dd2e75c3ad8d29285b51896b768c482d8f24a | JavaScript | eshamie/senior-enrichment | /app/reducers/students.jsx | UTF-8 | 2,593 | 2.859375 | 3 | [] | no_license | import axios from 'axios';
/*--------- ACTIONS --------*/
const GET_STUDENTS = 'GET_STUDENTS';
const GET_STUDENT = 'GET_STUDENT';
const REMOVE_STUDENT = 'REMOVE_STUDENT';
const UPDATE_STUDENT = 'UPDATE_STUDENT';
/*--------- ACTION CREATORS --------*/
//adding a newly created student to state
export function getStu... | true |
9897995049820b07766f61ebfc1aa10deaffc9a9 | JavaScript | MaedaMaeda-SHINTA6/IoT_Sharing | /html/signalingServer.js | UTF-8 | 2,011 | 2.796875 | 3 | [] | no_license | var BROADCAST_ID = '_broadcast_';
// signalingServerใฎไฝๆใใใผใ็ชๅทใฎๆๅฎ
var srv = require('http').Server();
var io = require('socket.io')(srv);
var port = 9001;
srv.listen(port);
console.log('signaling server started on port:' + port);
// ใฝใฑใใใใตใผใใผใซๆฅ็ถใใใใจใใๅบฆใซๅผใณๅบใใใ้ขๆฐ
io.on('connection', function(socket) {
socket.on('... | true |
3105337b7a6f6bd5a08fe953b1e2a8d99731fc94 | JavaScript | Fhardin27/My-GitPages-Site | /p5/My practice/snake/snake.js | UTF-8 | 4,042 | 3.671875 | 4 | [] | no_license | var snake; //the snake
var snakeColor; //random color of the snake
var direction; //the current direction the snake is moving
var foodBlock;
let currentSize = 20; //starting size of the snakes bits, may get smaller if gets really long
function setup() {
frameRate(20);
snake = [];
foodBlock = new Snakefood();
c... | true |
fd66986656fde8e5548b3ce8d1facf66b1344272 | JavaScript | LoginALee/FundamentosJs | /clase14.js | UTF-8 | 833 | 3.90625 | 4 | [] | no_license | var sacha = {
nombre: 'Sacha',
apellido: 'Morales',
edad: 28,
peso: 75
};
const INCREMENTO_PESO = 0.3;
const DIAS_DEL_AรO = 365;
const META = sacha.peso - 3;
var dias = 0;
console.log(`Al inicio del aรฑo ${sacha.nombre} pesa ${sacha.peso}kg`);
const aumentarPeso = (persona) =>
persona.peso += INCR... | true |
6891990acea91df60a288df108c6a7d7b2b98e9b | JavaScript | jerrydixon1/knowledgebowl-serverless | /routes/user/controller.js | UTF-8 | 3,782 | 2.875 | 3 | [] | no_license | 'use strict';
const _ = require('lodash');
const User = require('models/user');
class UserController {
/**
* List users, excluding logged in account
* @param request
* @param response
* @return {Promise.<void>}
*/
static async list (request, response) {
try {
const users = await User.whe... | true |
a22602679bfc3b8c0211045774abd5111aba023d | JavaScript | shreyasichauhan19/310-chat-bot | /app.js | UTF-8 | 3,007 | 3.421875 | 3 | [] | no_license |
//event listener for user input
document.addEventListener("DOMContentLoaded", function getInput() {//when page is fully loaded, call function getInput
var userField = document.getElementById("input");//identify text input field
addChat('', 'Hi! Thank you for choosing our store. How are you doing today?');
... | true |
7de950efe349fb5758fe87085699a0657e355cbf | JavaScript | testdouble/testdouble.js | /src/value/double.js | UTF-8 | 973 | 2.609375 | 3 | [
"MIT"
] | permissive | import _ from '../wrap/lodash'
export default class Double {
static create (name, real, parent, fakeCreator) {
const double = new Double(name, real, parent)
if (fakeCreator) double.fake = fakeCreator(double)
return double
}
constructor (name, real, parent) {
this.name = name
this.real = real... | true |
9f8c3c4b61d2aa1a16a3793fc988ec23a670b068 | JavaScript | Eirsteir/Expence-Tracker | /client/src/components/TotalExpences/TotalExpences.test.js | UTF-8 | 4,077 | 2.8125 | 3 | [] | no_license | import { shallow } from "enzyme";
import React from "react";
import TotalExpences from "./TotalExpences.js";
const today = new Date();
const yesterday = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate() - 1
);
const lastWeek = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate() ... | true |
4e2d510cad3eb6f2deca4707f95f547aa3a3809f | JavaScript | andresbonett/platzi-rank-bot | /commands/fetchUserDataPlatzi.js | UTF-8 | 2,499 | 2.953125 | 3 | [
"MIT"
] | permissive | const axios = require('axios')
const PLATZI_URL = 'https://platzi.com'
// Request
// const fetchUserDataPlatzi = require('./fetchUserDataPlatzi')
// const { status, error, data } = await fetchUserDataPlatzi(userPlatzi)
// Logs:
// fetchUserDataPlatzi() // user: undefined
// fetchUserDataPlatzi('@404') // 404
// fetch... | true |
c5a972eaf1d1245ced60ea472833b2d6d5e070f6 | JavaScript | pranavambre/quadrant | /backend/resolvers/Mutation.js | UTF-8 | 886 | 2.59375 | 3 | [] | no_license | import { v4 as uuidv4 } from 'uuid';
const Mutation = {
createOption(parents, args, { db }) {
const option_classification = {
id: uuidv4(),
name:args.name,
type:args.type,
fabric:args.fabric
}
db.options.push(option_classification)
return option_classification
},
updat... | true |
e0f921a279ef29d22e7f5918639cf15cc4b796f9 | JavaScript | that-hatter/proj-euler-js | /euler035.js | UTF-8 | 507 | 3.640625 | 4 | [] | no_license | const util = require('./util.js');
function main() {
let count = 0;
util.sieve(1e6).forEach(prime => {
const arr = getRotations([String(prime)]).map(Number);
arr.shift();
if (arr.every(x => util.isPrime(x))) count++;
});
return count;
}
function getRotations (arr, i = 1) {
const str = arr[arr.length - 1];
... | true |
c776af1d74e1866d5c05f6f99c3ab4989950edd4 | JavaScript | martin-nikolov/Telerik-Academy | /Web Design & Development/3. JavaScript Fundamentals/07. Using Objects/04. Has object given Property/script.js | UTF-8 | 432 | 3.34375 | 3 | [
"MIT"
] | permissive | ๏ปฟtaskName = "4. Has object given Property";
function Main(bufferElement) {
var obj = {
name: "reference",
price: 15
};
WriteLine("Has property 'length': " + (hasProperty(obj, "length") ? "YES" : "NO"));
obj.length = "15";
WriteLine("Has property 'length': " + (hasProperty(obj, "... | true |
02a53db6fa51d106cdf1ad44092a477f3d8c8657 | JavaScript | zeelac/pfiffikuss | /sketches/Football/target.js | UTF-8 | 346 | 3.015625 | 3 | [] | no_license | var targets = [];
function Target(x, y) {
this.x = x;
this.y = y;
this.a = 80
this.b = 10
this.r = 50;
this.toDelete = false;
this.trigger = function() {
this.show();
}
this.show = function() {
fill(255);
rect(this.x, this.y, this.a, this.b);
}
this.erase = function() {
t... | true |
e8a0a6cf9cc944d7c0dc427c84c897b00868671f | JavaScript | MasayoshiSugimoto/functionalPong | /src/rectangle.test.js | UTF-8 | 239 | 2.78125 | 3 | [] | no_license | "use strict"
include('src/rectangle.js')
include('src/vector.js')
include('src/assert.js')
{ //Test all functions at once
const r = Rectangle(Vector(10, 20), Vector(11, 22))
assertEqual(10, r.left())
//assertEqual(20, r.top())
}
| true |
3e3ee8f0f5e85882bac5a7c3ad7708c89806612e | JavaScript | Navash914/Twice-Upon-A-Time | /www/js/plugins/CustomPageConditions.js | UTF-8 | 9,023 | 3.3125 | 3 | [] | no_license | /*:
-------------------------------------------------------------------------
@title Custom Page Conditions
@author Hime
@date Oct 24, 2015
-------------------------------------------------------------------------
@plugindesc Create your own page conditions for your events
@help
---------------------------------------... | true |
d0b52179a8b9166e06365f011bcc7cdeb62fa526 | JavaScript | qwop/userscript | /monolith/119/5046.user.js | UTF-8 | 2,533 | 2.8125 | 3 | [] | no_license |
// ==UserScript==
// @name TravianGM
// @author Thorsten Zoerner (me@thorsten-zoerner.com)
// @namespace http://travian.cyber-junk.de/welt4
// @description Deutsch: pro Rohstoff wird angezeigt wieviel minuten noch gebraucht wird um ein Gebiet/Gebรคude zu bauen. Hierzu die Maus รผber das Rohstoff-Icon b... | true |
c9838b0bff0ba775ba93c5628b7c1feb8fb74278 | JavaScript | Klimostat/Website | /charts/selectedStations.js | UTF-8 | 6,751 | 3.078125 | 3 | [] | no_license | /**
* api for the selected station cookie
* @type {Object}
*/
const selectedStationsCookie = {
/**
* the ids of the stations selected (cache)
*/
_ids: null,
/**
* returns the ids of the stations that are saved in the cookie or in the cache
* @return {null}
*/
getIds: functio... | true |
32d1577dc761dbcae696b3b1cb9faf59b333929c | JavaScript | Minakshi-Verma/Sprint-Challenge-Advanced-React | /client/src/App.js | UTF-8 | 898 | 2.59375 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
import PlayersList from './components/PlayersList';
import './App.css';
class App extends React.Component{
// constructor(props){
// super(props)
state ={
player: [],
}
// [darkMode, setDarkMode] = useDarkMode();
// toggleMode = () => {
// t... | true |
85385430967f0d04c0b6aa2db45d3acd7ce722bb | JavaScript | florianbokor/hfjavascriptprogger | /code.07.js | UTF-8 | 1,607 | 3.890625 | 4 | [] | no_license | /*
Seriรถse Typen
*/
/*
// Testen was das fรผr Typen sind
var test1 = "ijfgkjn";
var test2 = 124;
var test3 = true;
var test4 = {};
var test5 = [];
var test6;
var test7 = {"aopg": 129};
var test8 = ["idgji", 2312];
function test9() {
return "idjkjnรถv";
}
var test10 = null;
var test11 = 0/0;
var test12 = "99";
console... | true |
b799b4be972683829b108923408b1d03c1aec7e4 | JavaScript | pgwest/LDSCallings | /app/components/CurrentTableNames.js | UTF-8 | 3,145 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict';
import React from 'react';
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';
const styles = {};
styles.wrapper = {
// background: '#fffff',
color: '#28363D',
}
styles.border = {
// background: '#5B6F79',
border: '5px solid #5B6F79',
}
styles.headings = {
// backgr... | true |
6838e8f37d1993bae9460a225b8e23477444e675 | JavaScript | raadu/js-problem-solving | /Recursion/fibonacci.js | UTF-8 | 425 | 4.5 | 4 | [] | no_license | // Write a JavaScript program to get the first n Fibonacci numbers.
// The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, . . .
// Each subsequent number is the sum of the previous two.
// Use RECURSION
function fibonacci(n) {
if(n===0 || n===1) {
return n;
}
else {
... | true |