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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a968c3db23408607bb9eb52481fa262f51132506 | JavaScript | nicoPhil/dynamicBehavior | /v0/app.js | UTF-8 | 359 | 3.515625 | 4 | [] | no_license | // Fonction utilitaire
function log(text){
console.log(text);
}
// Methode qui sera modifiee
function sayHello(){
log('hello');
}
// On garde en mémoire
var savedFunc = sayHello;
// On redefinit la fonction
sayHello = function(){
// On ajoute un comportement
log('sayHello start');
// On remet le comportement ... | true |
09faadbea181312123b2554db3e984afbb02f5f1 | JavaScript | jmkingsf/4380VM | /Compiler/testFiles/tCodeTest4.js | UTF-8 | 308 | 2.78125 | 3 | [] | no_license | class cat{
public int msg[] = new int[5];
cat(){
//msg = new int[100];
null = this;
}
public int add(int x, int y)
{
return x + y;
}
}
void kxi2019 main()
{
cat cat = new cat();
int i = cat.add(1,-3);
cout << i;
cout << '\n';
return;
} | true |
52a4d515f4ace21f476261bc67d340063994dc43 | JavaScript | mansinga1/DeployServerProfile | /test.js | UTF-8 | 94 | 2.953125 | 3 | [] | no_license | let name = 'joe';
const myFunct = function(name) {
name = 'leslie';
console.log(name)
}
| true |
8634876fef46a75247e53e117591f9880f0301ee | JavaScript | Ninjaah/R3-Verkkokauppa | /Verkkokauppa/JS/getUser.js | UTF-8 | 984 | 2.9375 | 3 | [] | no_license | function getUser() {
var xmlreq = new XMLHttpRequest();
var status;
var email = document.getElementById("sposti").value;
var pw = document.getElementById("psw").value;
console.log(sposti);
console.log(psw);
var vars = "email="+email+"&password="+pw;
xmlreq.open("POST", "../php/get... | true |
4bb71fc9283edebb03ff6540e0ea866c88297e2d | JavaScript | zhengpj95/CodingInterviews | /src/test014-1.js | UTF-8 | 496 | 3.671875 | 4 | [
"MIT"
] | permissive | /**
* @param {number} n
* @return {number}
*/
var cuttingRope = function (n) {
if (n < 4) return n - 1;
let divide = Math.floor(n / 3);
let left = n % 3;
if (left == 0) return Math.pow(3, divide);
if (left == 1) return Math.pow(3, divide - 1) * 2 * 2;
if (left == 2) return Math.pow(3, divide) * 2;
// if (n =... | true |
f867e75ce557213dda602bbb3bab674f1897681f | JavaScript | aaroncymor/docker-personalsite | /personal-site/static/js/script.js | UTF-8 | 371 | 2.609375 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', (e)=>{
});
let burgerMenu = document.querySelector('.burger-menu');
burgerMenu.addEventListener('click', (e)=>{
burgerMenu.nextElementSibling.style.right = "0";
});
let closeMenu = document.querySelector('.close-menu');
closeMenu.addEventListener('click', (e)=>{
... | true |
c8225853b8047930fa32257018d27e46e955bbcd | JavaScript | jaqviolet/flux-capacitor | /packages/sample/frontend/src/ducks/events.js | UTF-8 | 750 | 2.6875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import { fetchJson } from '../communication/rest'
const EVENTS_LOADED = 'EVENTS_LOADED'
export default function eventsReducer (events = [], action) {
switch (action.type) {
case EVENTS_LOADED:
return action.payload
default:
return isRemoteEvent(action)
? addToArrayIfNotYetPresent(events... | true |
96fa032557cb16d5b7611793134befa8a50aaeac | JavaScript | rinaark/module11_homework | /Задание 2, 11 модуль.js | UTF-8 | 645 | 4.1875 | 4 | [] | no_license |
let numToCheck = 3;
let flag = "";
function primeNumber(numToCheck, flag){
for (let i = 2; i <= numToCheck - 1; i++){
if (((numToCheck % i) === 0) && (numToCheck !== i)){
flag = "Не является простым";
break;
}
else{
flag = "Является простым";
}
}
console.log(`${numToCheck} ${flag}`);
};
if ((numTo... | true |
e4a45b36c85839cb8bb71bcca80f81c3071c3b55 | JavaScript | sheikfarzand/hashbrown-cms | /src/Client/Views/Editors/FieldEditors/ContentReferenceEditor.js | UTF-8 | 3,203 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* An editor for referring to other Content
*
* @description Example:
* <pre>
* {
* "myContentReference": {
* "label": "My content reference",
* "tabId": "content",
* "schemaId": "contentReference",
* "config": {
* "allowedSchemas": [ "page", "... | true |
dcbd07b380d643e82514f44611db52908945d182 | JavaScript | heywc/nodeStudy | /part1/写文件/writeFile.js | UTF-8 | 306 | 2.828125 | 3 | [] | no_license | var fs = require('fs');
// 文件写入的回调函数只有一个error参数,写入错误error有值,反之error为null
fs.writeFile('写入文件.txt', '写一个写入文件',function(error) {
if (error) {
console.log(error);
} else {
console.log('写文件成功');
}
}) | true |
b1e1602ed78adb5c476dbc9a87e539441139150c | JavaScript | dubeyanuj639/helmet | /server.js | UTF-8 | 603 | 2.59375 | 3 | [] | no_license | const express = require('express')
var bodyParser = require('body-parser')
const helmet = require('helmet')
const app = express()
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(helmet())
app.listen(3000, (req, res) => {
console.log("Server Connected on port => 3000")
})
/* che... | true |
0a9cef642313a87329c4c2c61c7d7ae7d882ea51 | JavaScript | ak-abhishek/Note-Keeping-App | /app/scripts/main.js | UTF-8 | 2,346 | 2.53125 | 3 | [] | no_license | $(function(){
console.log('main.js');
function checkUser(email) {
$.toReturn;
$.ajax({
type: 'GET',
url: 'http://restful-api-.herokuapp.com/api/'+email[0]+'/users',
async: false,
success: function(data) {
console.log("Here's the item!", data);
$.toReturn = data;
}
... | true |
4a309e333a90c3f35352ee20c5d1e078f7b17e3f | JavaScript | TretyakVictor/Home-Site | /cms/utils/js/menu.js | UTF-8 | 1,072 | 2.625 | 3 | [] | no_license | function setCookie(name, value, path, expires, domain, secure) {
if (!name || value === undefined) return false;
var str = name + '=' + encodeURIComponent(value);
if (expires) str += '; expires=' + expires.toGMTString();
if (path) str += '; path=' + path;
if (domain) str += '; domain=' + domain;
if (s... | true |
609ee84177f2e5f3002f8bbe2b160b784af6a4b6 | JavaScript | illiesse/starwars | /js/personnage.js | UTF-8 | 3,372 | 2.9375 | 3 | [] | no_license | var dowload=document.getElementById("dowload");
dowload.addEventListener("click",function (){load()});
function load() {
fetch('http://swapi.co/api/people/')
.then(
function (response){
return response.json()
}
)
.then(
data=>{
// console.log(data)
var name = document.getElementById("name")... | true |
1f6b8fccb14f8bab07d84ab2f3f18ad59343d293 | JavaScript | Scure21/wikistack | /routes/wiki.js | UTF-8 | 2,570 | 2.609375 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const model = require('../models');
const Page = model.Page;
const User = model.User;
router.get('/', function(req, res, next){
Page.findAll({})
.then(function (pages){
res.render('index', {
pages: pages
});
})
.catch(next);
});... | true |
24efb3b7944029ae9cb79f9ff8eeb8436fce7b5b | JavaScript | kbbaldha/AccidentAnalysis | /WebContent/resources/scripts/controllers/trendAnalysisController.js | UTF-8 | 3,897 | 2.703125 | 3 | [
"MIT"
] | permissive |
myApp.controller('trendAnalysisController', function($scope,DataService) {
$scope.name = 'trendAnalysisController';
$scope.$parent.$watch('showDiv', function(value){
if(value == 4){
$scope.getData();
}
});
$scope.getData = function(data){
$scope.$parent.loader.loading = true;
DataS... | true |
b0cee199347ccdced6f148ea05065ba8895a8605 | JavaScript | mostafaElsouifi/NewYears-countdown | /script.js | UTF-8 | 935 | 3.859375 | 4 | [] | no_license | //Dom Elements
const daysEl = document.getElementById('days-c');
const hoursEl = document.getElementById('hours-c');
const minsEl = document.getElementById('mins-c');
const secondsEl = document.getElementById('sec-c');
const newYearCounter = ()=>{
const newYearDate = new Date('1 Jan 2022');
const cu... | true |
76d70c0a88f245cfe9d13f2fb340019d12507eaf | JavaScript | Koushikbiswasdev/mypro | /src/components/Channel.js | UTF-8 | 438 | 2.59375 | 3 | [] | no_license | import React from 'react';
class Channel extends React.Component{
constructor(){
super();
this.state={
message:'Sony live',msg:'Sony Max'
}
}
msgChange(){
console.log("msgOnChange");
this.setState({
msg:'Sony Ten Sports'
})
}
render(){
return (
<div>
{this.state.msg}
<br/>
{this.state... | true |
53ffe4d125350defe1cb0778137db5046e4f8baa | JavaScript | PrincessMooMoo/JS_Promise_Tutorial | /task1.js | UTF-8 | 693 | 4.4375 | 4 | [
"MIT"
] | permissive | // Task 1: Translate the story into code.
//Promise basics explained using my birthday
//This is showing the different parts of a Promise
const onMyBirthday = (isKayoSick) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (!isKayoSick) {
resolve(2);
... | true |
04fbcb2b38a7c937f31617b78cff2697968815a1 | JavaScript | PHPD01/syuan-php | /react-bootstrap-tutorial/src/components/testfoodpage.js | UTF-8 | 6,153 | 2.515625 | 3 | [] | no_license | // 連接後端資料,按照大均教法
// 測試接後端
import React, { useState, useEffect } from 'react';
import { Button } from 'react-bootstrap';
import '../components/css/Page2.css';
import carouselIMG from '../carouselIMG.jpg';
import emailbacktop from '../emailbacktop.png';
import upbacktop from '../upbacktop.png';
import {
BrowserRou... | true |
46e790dd36267956f92c19c37d36fbe477acd376 | JavaScript | glespinola/CursoIngresoJS | /5-InstruccionWhile/jsIteracionesWhile-04.js | UTF-8 | 426 | 3.75 | 4 | [] | no_license | /*
al presionar el botón
pedir un número entre 0 y 9 inclusive.*/
function mostrar()
{
let numeroIngresado;
numeroIngresado = parseInt(prompt("ingrese un número entre 0 y 9."));
while(numeroIngresado < 0 || numeroIngresado > 9 || isNaN(numeroIngresado)){
numeroIngresado = prompt("Numero no valido. Ingrese un nu... | true |
09ac09e1cf18258c3f75d4c034d7e0f9d857a353 | JavaScript | lfresnog/ExamenParcial | /src/app.js | UTF-8 | 1,939 | 2.75 | 3 | [
"MIT"
] | permissive | // let nfilm = result.url.match(/(\d+)/);
// urlstar = parseInt(urlstar);
import { fetchData } from './fetchdata';
import { GraphQLServer } from 'graphql-yoga';
// rickymorty entry point
const url = 'https://swapi.co/api/people/';
/**
* Main App
* @param data all Star Wars database
*/
const runApp = data => {... | true |
ff1184580ef79d2a8061cdd1b49cffb81c8748d2 | JavaScript | MrGreenWood12371/819253-sedona-25 | /js/script.js | UTF-8 | 391 | 2.609375 | 3 | [] | no_license | var popupButton = document.querySelector('.button-search');
var popup = document.querySelector('.hotel-popup');
popup.classList.add('shide');
popupButton.addEventListener('click', function(evt){
evt.preventDefault();
if(popup.classList.contains('shide')){
popup.classList.remove('shide');
popup.classList.add... | true |
fc160a75c8172d3ea7cc3085309b524872d624ab | JavaScript | erickmacena1/react-todo | /src/components/TodoForm.js | UTF-8 | 602 | 2.71875 | 3 | [
"MIT"
] | permissive | import React, { useState } from 'react'
function TodoForm(props) {
const [text, setText] = useState("");
function handleChange(event) {
let t = event.target.value;
setText(t);
}
function addItem(event) {
event.preventDefault();
if (!text) return;
props.onAdd... | true |
c1a98c08220fc7a05dc1a6a33134cc97b7e06fd3 | JavaScript | ImperfectWorld/jquery.plugin_tab.js | /jquery.plugin_tab.js | UTF-8 | 5,320 | 2.828125 | 3 | [] | no_license | /*
命名 : jquery.plugin_tab.js
描述 : Tab选项卡插件
功能描述 :
选项卡功能可以任意设置
可仅用制定Tab选项
可以绑定Tab事件触发函数
可以制定Tab切换动画显示效果
支持三种回调函数,方便Ajax异步交换数据
callBackStartEvent 单击tab选项卡时立即执行
callBackHideEvent 当显示的Tab选项内容完全隐藏式执行
callBackShowEvent 当单击Tab选项内容完全显示后执行
参数 :
tabList: String,指定Tab选项卡标题包含框的类名
contentList: String,指定Tab选项卡内容框... | true |
c374990f586f9f9e27d787185cc51cfe024cce27 | JavaScript | yalichen19/note-book | /es6/13. 增强的数组功能/13-3. [扩展]ArrayBuffer/test3.js | UTF-8 | 299 | 3.109375 | 3 | [] | no_license | const bf = new ArrayBuffer(10); //10个字节的内存
const arr1 = new Int8Array(bf);
const arr2 = new Int16Array(bf);
console.log(arr1 === arr2);
console.log(arr1.buffer === arr2.buffer);
arr1[0] = 10;
console.log(arr1)
console.log(arr2); | true |
be024666961fc58e7b9d5d855af9facead8705a9 | JavaScript | Abdify/js_practice | /sort.js | UTF-8 | 766 | 3.4375 | 3 | [] | no_license | function sorting(arr) {
//arr.sort((a, b) => (a-b));
for(let i=0;i<arr.length-1;i++){
for(let j=i+1;j<arr.length;j++){
if(arr[j]<arr[i]){
[arr[i], arr[j]] = [arr[j], arr[i]];
}
}
}
return arr;
}
console.log(sorting([6,4,0, 3,-2,1]))
var cars... | true |
4ba9b329391e98dfc66cfd9d72c8cbbd257a376d | JavaScript | manny10239/moshe-final | /server/fitApp/controller.js | UTF-8 | 1,584 | 2.90625 | 3 | [
"MIT"
] | permissive | const express = require('express');
const {FitnessApp, User} = require('./model');
const fitapp = new FitnessApp();
const app = express.Router();
app.get("/", (req, res) => {
res.send(fitapp);
});
// Create main user
app.post('/users', (req,res) => {
fitapp.login(req.body.name, req.body.age, req.body.height... | true |
7f74ab4148bffc718f897bcb9facaccf7122e0b2 | JavaScript | takemyoxygen/playground | /node/node-server-close/index.js | UTF-8 | 855 | 2.84375 | 3 | [
"MIT"
] | permissive | const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
function longRunningCleanUp() {
return new Promise((resolve, reject) => {
console.... | true |
b2a346124901794c06da6951e1e48b69017cf597 | JavaScript | AlexBachurin/tours-app | /src/App.js | UTF-8 | 1,325 | 2.984375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import './App.css';
import Loading from './Loading';
import Tours from './Tours';
const url = 'https://course-api.com/react-tours-project'
function App() {
const [loading, setLoading] = useState(false);
const [tours, setTours] = useState([]);
const fetchTours... | true |
304cbb148814b87fdb82389e2d24dc78c560d6d7 | JavaScript | WohligTechnology/andar-bahar | /config/serialport.js | UTF-8 | 3,216 | 2.578125 | 3 | [] | no_license | module.exports.serialport = {};
global.isCallApi = true;
global.currentCardId = "";
global.currentCardValue = "";
function callServe(cardName) {
if (isCallApi) {
global.isCallApi = false;
Player.serve({
card: cardName
}, function (err, data) {
global.isCallApi = tru... | true |
da56c60a17d6add4ca001de13db6b1c79c9c355f | JavaScript | StevieV1903/week8_day_1_homework | /Homework Questions.js | UTF-8 | 1,936 | 2.84375 | 3 | [] | no_license | // What is responsible for defining the routes of the games resource?
// The create router function () within the create_router.js file and app.use provides the starting point.
// What do you notice about the folder structure? Whats the client responsible for? Whats the server responsible for?
// The folder structure ... | true |
ebb17f69d5b53e76ac65488cc85673a44b780395 | JavaScript | ohadshap/Agora | /src/stores/Inventory.js | UTF-8 | 1,027 | 2.84375 | 3 | [] | no_license | import { observable, action, computed } from 'mobx'
import { Item } from './Item'
export class Inventory {
@observable items = []
@computed get numItems() {
let counter = 0
this.items.forEach(i => counter += i.quantity)
}
@action addItem = (name, price, quantity) => {
let... | true |
8f81adcfc056ee11f26bb49628d3dd6c9a4fd49f | JavaScript | ShubhamLala/Command_Line-NodeJs | /cpAndMov.js | UTF-8 | 1,447 | 2.90625 | 3 | [] | no_license | var fs = require("fs")
var x = process.argv.slice(2);
if(x.length== 4){
var file=x[3]+"\\"+x[1];
var newPath;
if(x[2][1]===':'){newPath = x[2]}
else{newPath=x[3]+"\\"+x[2]}
if(x[0]==="mov"){
var fileContent
try{
fileContent=fs.readFileSync(file);
... | true |
e30137a464c9cfe0098c6fa678ac5ed747649979 | JavaScript | iromashko/d3mastering | /modifying_elements/script.js | UTF-8 | 2,447 | 2.90625 | 3 | [] | no_license | let svg1 = d3.select('#svg1');
svg1.insert('text').text('Hello Wordl').attr('x', '5').attr('y', '20');
// let h1 = d3.select('h1').html();
// d3.select('h1').html('html')
// console.log(h1);
// let div1 = d3.select('#title');
// let divH1 = div1.append('h1').text('Append');
// console.log(divH1);
// const rectsD... | true |
901fedca4eb0a5015f2f4e6f602fec1b38a9089c | JavaScript | VdeVentura/ReactYoutube | /src/components/search_bar.js | UTF-8 | 995 | 2.859375 | 3 | [] | no_license | import React, { Component } from 'react';
//==============================================================================
// The code below is a "class component"
//==============================================================================
// Listening to the changes of the input and printing them in the log
cla... | true |
804fa29bb4de16ae70ef48864c20bc43dbb4d848 | JavaScript | mariastlouis/star-wars-api | /src/Card/Card.js | UTF-8 | 1,346 | 2.59375 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
import './Card.css';
import emptyStar from '../images/fav-star-empty.png';
import fullStar from '../images/fav-star-full.png';
const Card = ({name, info, favorite, category, addFavorite}) => {
const favoriteStar = favorite ?
<img src = { fullStar ... | true |
ed66de7795ed8abdccae8a3c19c5517ce8f3457b | JavaScript | QueryPark/qp-well-parser | /test/v1/index.test.js | UTF-8 | 6,643 | 2.625 | 3 | [
"MIT"
] | permissive | import test from 'ava'
import WellParser from '../../src'
const wellParser = WellParser('v1')
const wells = require('../wellData.json')
const standardWell = wellParser.valueOf()
test('valueOf returns the standard well', t => {
const msg = 'Standard Well should be returned'
const actual = standardWell
const ex... | true |
f0caa88487b1570d4d1a12eab16686ab8616df12 | JavaScript | Disda-coding/miniprog_shop | /pages/goods_list/goods_list.js | UTF-8 | 2,606 | 2.65625 | 3 | [] | no_license | // pages/goods_list/goods_list.js
import {request} from "../../request/index.js"
/**
* 用户上滑页面 滚动条触底 开始加载下一页数据
*
*/
Page({
/**
* 页面的初始数据
*/
data: {
tabs:[
{
id:0,
value:"综合",
isActive:true
},
{
id:1,
value:"销量",
isAc... | true |
233610106462e5bec4ce43572b96769be4a64127 | JavaScript | towc/simple-react-todo | /src/client/index.js | UTF-8 | 2,224 | 2.734375 | 3 | [
"MIT"
] | permissive | import React from 'react'
import ReactDOM from 'react-dom'
import TodoApp from './components/TodoApp'
var app = {
todos: [],
name: 'Test Todo',
setName: function( name ){
app.name = name;
},
addTodo: function( todoName, todoDesc ){
app.todos.push( new app.Todo( todoName, todoDesc ) );
},
tickTo... | true |
2782f804162988b405ebcfca0ffbe541eb5f255d | JavaScript | dewrivers/Weather-APP | /js/script.js | UTF-8 | 3,849 | 3.40625 | 3 | [] | no_license | // MOMENT FOR THE CURRENT DAY AND TIME
$("#currentDay").text(moment().format('MMMM Do YYYY, h:mm:ss a'));
var cityList = JSON.parse(localStorage.getItem("cityList")) || []
//EVENT LISTENER FOR SEARCH BUTTON
$(".search").on("click", function (event) {
event.preventDefault();
var city = $(".search-control").va... | true |
8db59f277e491fa28835e5940aeaa8d2038cf4bf | JavaScript | kamilabartnik/react_fun | /proj/src/Components/Pages/Items/ToDoListItems.js | UTF-8 | 879 | 2.671875 | 3 | [] | no_license | import * as React from 'react';
import { Component } from 'react';
import ToDoItemItem from './ToDoItemItem';
class ToDoListItem extends Component{
state = {
tasks: this.props.tasks,
draft: ''
}
updateDraft = event => {
this.setState({draft: event.target.value})
}
addToDo = () => {
const {t... | true |
fe375c42d5165b9c138751d38dd13bceaba70dd5 | JavaScript | RedFu01/bowling-game-kata-js | /test/Game.test.js | UTF-8 | 1,958 | 3.234375 | 3 | [] | no_license | import Game from '../dist/Game';
function rollSome(pins, repititions, game) {
for (let i = 0; i < repititions; i++) {
game.roll(pins)
}
}
describe('Game', () => {
it('should create a game', () => {
const game = new Game();
})
it('should work if we roll (Let\'s roll!)', () => {
... | true |
e64f6243b7443070160244b61aee8719596947e8 | JavaScript | DoskiAd/frontend | /src/js/reducers/register.js | UTF-8 | 529 | 2.703125 | 3 | [] | no_license | const defaultState = {
isDone: false,
isInProgress: false,
error: null
}
const register = (state=defaultState, action) => {
if(action.type === "SET_REG_DONE"){
return {...defaultState, isDone: true};
}
if(action.type === "SET_REG_IN_PROGRESS"){
return {...defaultState, isInProgress: true};
}
... | true |
b1d84ff7b9e8829f9c94e69a10126d9aae4f90fa | JavaScript | tapestry-pipeline/tapestry-cli | /src/utils/tapestryAscii.js | UTF-8 | 2,061 | 2.796875 | 3 | [] | no_license | const chalk = require('chalk');
function tapestryAscii() {
console.log(chalk.hex('#9579fd')(`,,,,,,,, `) + chalk.hex('#29abe2')(` ,╓╓╓╓╓╓╓╓`));
console.log(chalk.hex('#9579fd')(`▒ ,\`=,`));
console.log(chalk.hex('#9579fd')(` \`\`\`\`\`\`\``) + chalk.hex('#29abe2')(` ╔╜`)+ chalk.hex('#9579fd')(`,`) + ch... | true |
5fd5d78e7ab2b4a40a8033a8c7fe3fbd3e2ab208 | JavaScript | ataraFrieman/taskManager-client | /src/config/application/sessionStorage.js | UTF-8 | 213 | 2.6875 | 3 | [] | no_license |
export const setDataInSessionStorage = ( key , value ) => {
sessionStorage.setItem(key, JSON.stringify(value));
}
export const getDataFromSessionStorage = (key) => {
return sessionStorage.getItem(key);
} | true |
c74ada6ed85feb8b68020cf7fd486797e1d877fe | JavaScript | duanCoin/collection-calculate-camp | /practices/superposition_operation/own_elements_operation/subscript_is_even/is_exist_element.js | UTF-8 | 336 | 2.78125 | 3 | [] | no_license | 'use strict';
let _ = require('lodash');
var is_exist_element = function(collection,element){
let value = _.chain(collection)
.filter((item, index, items)=>index % 2 === 0)
.value();
return value.includes(3) || !value.includes(4);
};
module.exports = is_exist_element;
//.filter((item, index, items)=>(index... | true |
40bdcccd46ea488214ba79a8a436fae121c53c2f | JavaScript | dhruvgenix/SHOPHUB | /build/web/js/carttfunction.js | UTF-8 | 6,798 | 2.765625 | 3 | [
"MIT"
] | permissive | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
localStorage_datato_cart();
numitems();
function addtocart(pid,pname,pprice,status){
// alert("Ashish"+pid+" "+pname+" ... | true |
c82fe4dcd37a5ad27719bae52d5fcea099d0dc0d | JavaScript | MingNeo/react-demo | /src/pub-sub.js | UTF-8 | 2,654 | 2.765625 | 3 | [] | no_license | import propTypes from "prop-types";
import Rx from "rxjs";
class PubSub {
constructor() {
this.action$ = new Rx.Subject();
this.state$ = new Rx.BehaviorSubject({});
this.subject = new Rx.Subject();
}
/**
* 生成store
* @param {function} reducers reducer集合
* @param {object} initState 初始state
*/
createS... | true |
35d844b1255130b0c44ddea33016976678be3535 | JavaScript | priyaravi23/react-redux-todo | /src/redux/actions/action-utility.js | UTF-8 | 2,450 | 2.875 | 3 | [] | no_license | // write a function that generates an API based action when provided with a base action name
import {SAVE_TODO, UPDATE_TODO, DELETE_TODO, DELETE_ALL_TODOS, FETCH_TODOS} from "../action-types";
import {TODOS_URL} from "../../utils/constants";
function generateAPIAction(inputs) {
const {
url,
actionType,
... | true |
ac4e1b65a7674299ec8967df1b8017a8ee352c9c | JavaScript | martinmunillas/myAdmin | /src/server/apps/api/utils/middlewares/scopesValidationHandler.js | UTF-8 | 592 | 2.515625 | 3 | [] | no_license | import response from '../../network/response';
const scopesValidationHandler = (allowedScopes) => {
return (req, res, next) => {
if (!req.user || (req.user && !req.user.scopes)) {
response.error(req, res, 401, 'Unauthorized', 'Authorization Error');
}
const hasAcces = allowedScopes
.map((a... | true |
c72c8f1a0154c0b8e1d9d1ef2fb6aa73f04a5823 | JavaScript | fandsimple/chrome_copy | /js/export/dgstack.js | UTF-8 | 1,285 | 2.59375 | 3 | [] | no_license | function exportArticle() {
console.log('dgstack exportArticle');
var title = '# ' + $('h1.entry-title').text();
var content = $('article').html();
// 将图片链接进行替换
// var newContent = $(content);
// var imgList = newContent.find('img');
// var oldImgUrl = '';
// var newImgUrl = '';
// ... | true |
250ec7182f5244572204e35810461a6b52424eca | JavaScript | matt2yu/onboard | /frontend/actions/user_actions.js | UTF-8 | 402 | 2.515625 | 3 | [] | no_license | export const RECEIVE_USER = 'RECEIVE_USER';
export const receiveUser = user => ({
type: RECEIVE_USER,
user
});
export const requestUser = (userId) => dispatch => (
fetchUser(userId)
.then(user => {
dispatch(receiveUser(user))
}, err => (
console.log(err)
))
);
//APItuil
export const fetchUser = u... | true |
4e7d9e3f7b65c239c1f4f0e1e4c306aaa6f3aa5c | JavaScript | moshonskiy/bouncing-ball-game | /script.js | UTF-8 | 3,408 | 3.328125 | 3 | [] | no_license | const canv = document.getElementById("canvas");
const ctx = canv.getContext("2d");
canv.width = 1200;
canv.height = 800;
// game variables
const obstacleMinHeight = 50;
const obstacleMaxHeight = 120;
const obstacleMinWidth = 30;
const obstacleMaxWidth = 50;
const minGapBetweenObstacles = 200;
const maxGapBetweenObsta... | true |
7e0a3b5760129fbe7aebc9ae971f237c4c331aae | JavaScript | ResplendentRadishes/Murmillo | /server/db/db_populateCompetition.js | UTF-8 | 491 | 2.640625 | 3 | [] | no_license | var Promise = require('bluebird');
var Competition = require('./competition.js');
var problems = [];
const num = 100;
for (var i = 0; i < num; i++) {
problems.push(Math.floor(Math.random() * 3) + 1);
}
console.log('------------------- Populate Competition table ------------------- ');
Competition.sync()
.then(() ... | true |
36b55218efbf8ffbeb1a6eaf461d9f3172c8f448 | JavaScript | seiji13r/2018codingBootcampGit | /W18-Mongo-Mongoose/W18-183-20-Scraping-With-Mongoose/Unsolved/server.js | UTF-8 | 2,888 | 3.09375 | 3 | [
"MIT"
] | permissive | var express = require("express");
var logger = require("morgan");
var mongoose = require("mongoose");
// Our scraping tools
// Axios is a promised-based http library, similar to jQuery's Ajax method
// It works on the client and on the server
var axios = require("axios");
var cheerio = require("cheerio");
// Require ... | true |
55de988071bbb16e3b36a311f70ec92479b4847c | JavaScript | Indevem/ListReact | /ListReact/__tests__/InputListText-test.js | UTF-8 | 4,854 | 2.640625 | 3 | [] | no_license | import React from 'react';
import { Text } from 'react-native';
import InputListText from '../components/InputListText';
import renderer from 'react-test-renderer';
/** Тестирование рендера скрытого списка (SnapShot) при наличии в передаваемом
* списке четырёх элементов. Сгенерированный программой код сравнивается с ... | true |
b046d5e08f463ad7481f33b8a38f1a8b9bdd8225 | JavaScript | caseychester7414/fsw-120 | /week3/dj/src/Squares.js | UTF-8 | 2,363 | 2.921875 | 3 | [] | no_license | import React from 'react'
import Square from "./Square"
class Squares extends React.Component {
constructor(){
super()
this.state = {
colors: ['white', 'white', 'white', 'white'],
randomColors: ['blue', 'teal', 'orange', 'pink']
}
this.changeColor = this.changeColor... | true |
6606592da2c3aff5d230d689adc573807fec24d2 | JavaScript | TSejal/Angular-Employee-Management-System | /employee/js/app.js | UTF-8 | 1,369 | 2.625 | 3 | [] | no_license | var myApp = angular.module('empApp', []);
myApp.controller('EmpListCtrl', function($scope, $http){
console.log("EmpListCtrl loaded...");
$scope.employee = {name: '', phone: ''};
$scope.employess = [];
function _init(){
_getEmployees();
};
_init();
fu... | true |
d88d15a7a0ac19d4fe0001dea107a3244e876e1a | JavaScript | krish064/PersonsSelectionReact | /src/reducers/person-reducer.js | UTF-8 | 924 | 3.078125 | 3 | [] | no_license | const initialState = [
{
name: "Person1",
age: "25",
isSelected: false,
},
{
name: "Person2",
age: "26",
isSelected: false,
},
{
name: "Person3",
age: "27",
isSelected: false,
},
];
const personReducer = (state = initialState, action) => {
switch (ac... | true |
5ed4be0746e2305102c0e910fe58d3dca7d6eb30 | JavaScript | gonghaima/leetcode | /src/rules/maxProfitIII/index.js | UTF-8 | 1,364 | 3.078125 | 3 | [] | no_license | /**
* @param {number[]} prices
* @return {number}
*/
/*********************************************************************************************************************
* Runtime: 108 ms, faster than 75.94% of JavaScript online submissions for Best Time to Buy and Sell Stock III. *
* Memory Usage: 49.5 MB,... | true |
f370f29b2ba726d9657ea5c6724bc705cd19b184 | JavaScript | drewmoore/asteroid-tracker | /services/nasa.js | UTF-8 | 948 | 2.8125 | 3 | [] | no_license | // Module for handling requests and responses to and from NASA.
const moment = require('moment');
const fetch = require('isomorphic-fetch');
// Set common values to be used by all future endpoints.
const baseUrl = 'https://api.nasa.gov/neo/rest/v1';
const apiKey = process.env.NASA_KEY;
class Nasa {
static get neo... | true |
1178e9b253c5f0e627ccb8e783ffb2be17c3f3d7 | JavaScript | TharaniSripirahas/react | /src/component/project.jsx | UTF-8 | 3,854 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import '../App.css'
export default class project extends Component {
//datava store panni vaikkira idam than state
state = {
Data:[], //backend la erunthu edutha datava store pani vaikiraku data enda state ka use panram
projectName:'',
... | true |
d0b932faa6eeb230846f1764650a6761c4b28955 | JavaScript | jrmkim50/SmashItAlarm | /app/components/SettingsScreen/Feedback.js | UTF-8 | 2,611 | 2.546875 | 3 | [] | no_license | import React, { useState } from 'react';
import { View, Text, StyleSheet, TextInput, Button } from 'react-native';
import { JSON_BIN } from '../../config';
import { sleep } from '../../utils/utils';
export default function Feedback({ setLoading }) {
const [feedBack, setFeedBack] = useState("");
const [error, s... | true |
bfa648d41b527d68fa9927dee5db05c5b638d812 | JavaScript | toddmerrill/nodekata | /test/functionaljavascript/basic-filter-test.js | UTF-8 | 1,776 | 2.625 | 3 | [] | no_license | var assert = require('chai').assert;
var getShortMessages = require('../../src/functionaljavascript/basic-filter');
describe('basic filter', function () {
it('converts a for loop to map', function () {
var input =
[ {message: 'Tempor quis esse consequat sunt ea eiusmod.'},
{messa... | true |
47c44fe8a9363066d8ed55f19a1cc1b1eb3145a6 | JavaScript | SpaceValley/crm-front | /src/utils/api/candidate.js | UTF-8 | 11,729 | 2.671875 | 3 | [] | no_license | const URL = "http://softdeal.beget.tech/api";
const getToken = () => localStorage.getItem("token");
/**
* Fetches candidate's profile from an api by id
*
* @param {Number} id candidate id
* @returns {Promise} Promise object represents operation result
*/
export const getCandidateProfile = id => {
const token = ... | true |
6d97201a4671664d957c33c128576c747a744bc0 | JavaScript | ExCiteS/geokey-airquality | /geokey_airquality/static/js/admin.ui.airquality.js | UTF-8 | 7,900 | 2.609375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var project;
var loader = $('#loader');
var categories = $('#categories');
var projectLoadedEvent = new Event('project-loaded');
// Displays an error message
function error(message) {
var modal = $('#modal-error');
modal.find('.modal-body p').text... | true |
155be7ddd09551b8f671f2cddfb89faff9e36071 | JavaScript | VimLeSai/react-big-calendar | /test/utils/DayEventLayout.test.js | UTF-8 | 2,892 | 2.5625 | 3 | [
"MIT"
] | permissive | import { getStyledEvents } from '../../src/utils/DayEventLayout'
import { getSlotMetrics } from '../../src/utils/TimeSlots'
import dates from '../../src/utils/dates'
describe('getStyledEvents', () => {
const d = (...args) => new Date(2015, 3, 1, ...args)
const min = dates.startOf(d(), 'day')
const max = dates.en... | true |
89bf93cd0252c54117d436994e3131f393495aca | JavaScript | simmar/react-pottier-hooks-context | /src/authentification/OldLogin.js | UTF-8 | 2,067 | 2.65625 | 3 | [] | no_license | import React, {useState} from 'react';
const Login = (props) => {
const [user, setUser] = useState({firstName: '', lastName: '', password: ''});
const handleChange = (e) => {
const value = e.target.value;
setUser({
...user,
[e.target.name]: value,
});
};
const handleSubmit = () => {
... | true |
79251132ce3fc80896e135f089277a4f5cb46655 | JavaScript | InterStelios/martian-robots | /src/services/FileInputService.js | UTF-8 | 1,075 | 2.90625 | 3 | [] | no_license | const Surface = require('../core/Surface');
const Orientation = require('../constants/Orientation');
const {
prune,
extractSurfaceSize,
extractProperties,
} = require('../utils/parse');
const { readFileSync } = require('fs');
/**
* Reads the input from the given path and passes the clean input to the callback f... | true |
83e2c7f1693311da440c444d4426fab461680686 | JavaScript | ggoforth/Bitwise-Skill | /index.js | UTF-8 | 1,884 | 2.609375 | 3 | [] | no_license | var alexa = require('alexa-app'),
app = new alexa.app(),
mongoose = require('mongoose'),
env = require('node-env-file'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
Promise = require('bluebird');
env('./.env', {verbose: true, overwrite: true, raise: false, logger: console});
mongoose.connect(pro... | true |
8940d1692f50db1b7bf4cdac3a16cf72c8c079cd | JavaScript | yashpandit/javascript-exercises | /dec_11_2019/maxDepthOfBinaryTree/maxDepthOfBinaryTree.test.js | UTF-8 | 509 | 3.171875 | 3 | [] | no_license | const maxDepth = require('./maxDepthOfBinaryTree');
describe('maxDepthOfBinaryTree', () => {
class Node {
constructor(data) {
this.data = data;
this.right = null;
this.left = null;
}
}
const root = new Node(3);
root.right = new Node(20);
root.left = new Node(9);
const rightNode ... | true |
65e08bece0766ffbd980c0432d92629009bf8a85 | JavaScript | michbyc801/graphql-java-master-thesis | /restapi-layer/src/main/webapp/lib/js/scripts.js | UTF-8 | 2,251 | 2.609375 | 3 | [] | no_license | var testSalesByCategory = function () {
var categories;
$.get('/categories', function (data) {
categories = data;
});
};
var actors_list = function () {
$.get('/actors', function (data) {
var actorFilmMap = new Map(data.map(entry => [entry.actorId, entry.filmIds]));
var filmIdsFlatArray = [];
actorFilmM... | true |
b13189f2acf8f4ffee42ceb3d46c0022606c5abc | JavaScript | mohhef/FindAJob | /main/js/employer/rep_dashboard.js | UTF-8 | 1,940 | 2.8125 | 3 | [] | no_license | function createRep(){
const username = $('input[id=insert_rep_username]').val();
const email = $('input[id=insert_rep_email]').val();
const password = $('input[id=insert_rep_password]').val();
const confirm_password = $('input[id=insert_rep_confirm_password]').val();
if( password !== confirm_passwor... | true |
c72908dcb949c50dee527594b48305b69f521316 | JavaScript | Aleksey-Kolpakov/goit-js-hw-11-color-switch | /src/index.js | UTF-8 | 872 | 2.84375 | 3 | [
"MIT"
] | permissive | import './styles.css';
import colors from './colors.js'
const randomIntegerFromInterval = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
const changeBodyColor = function () {
timerId = setInterval(() => {
const color = colors[randomIntegerFromInterval(0, colors.length - 1)]... | true |
98c8d0dbffa6f992ab743bac61054984a3c9f0d0 | JavaScript | kingideayou/sgjq_online | /public/js/main.js | UTF-8 | 14,076 | 2.984375 | 3 | [] | no_license | // 兵站
var BaseCamp = function(x, y,w, h){
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.draw = function(container){
this.canvas = document.createElement('canvas');
this.canvas.width = this.width;
this.canvas.height = this.height;
this.canvas.style.pos... | true |
15975f2cb2301607098f4f59acc9534b2ebb8e15 | JavaScript | FilipaPereira/PRC19 | /TPC3/graphdb/public/javascripts/actions.js | UTF-8 | 561 | 2.75 | 3 | [] | no_license | $(document).ready(function() {
$("#limpar").click(e => {
e.preventDefault()
$("#resultados").val('')
})
$("#exec").click(e => {
e.preventDefault()
var q = $("#query").val()
var rep = $("#rep").val()
axios.get('http://localhost:3019/query/'+rep+'?query=' + q)
... | true |
b766cc2a7902d92d5ffc70fa0eb68393d4285dbb | JavaScript | Fabsgx/Bingo | /random generation.js | UTF-8 | 4,067 | 3.203125 | 3 | [] | no_license | /* playlist.js */
var i, numbers, random, n ;
var grid1, grid2, grid3, grid4;
var b0, b1, b2, b3;
var details, question, suggestion;
var selection=0;
//grids
window.onload = startup;
function shuffle(o) {
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
retu... | true |
345e63c8409ee197d4e14a61d8c9011edfb1ba46 | JavaScript | Ambeshgaurav/assignments | /promise1.js | UTF-8 | 1,236 | 3.421875 | 3 | [] | no_license |
// let promise=new Promise((resolve,reject)=>{
// setTimeout(()=>{
// //resolve("done");
// reject("not done")
// },1500)
// })promise.then((value)=>
// {
// console.log(value);
// },(value1)=>
// {
// console.log(value1);
// })
// function waitSecond(seconds) {
// return new Pr... | true |
c1e022d72024b94e55ddee1c13d28a725ada3cab | JavaScript | nestoreduardosierra/caliBlanca | /dia7/script.js | UTF-8 | 947 | 3.71875 | 4 | [] | no_license | // Imprimir numeros del 1 al 100
// Si el numero es multiplo de 3 --> Fizz
// Si el numero es multiplo de 5 --> Buzz
// Si es multiplo de 3 y 5 --> FizzBuzz
// Si no se cumple ningua condicion, imprimir el numero
// for (i = 1 <= 100; 1++) {
// if(i % 3 == 0 && i % 5 == =) {
// } else if (i % 3 == 0)
// }
va... | true |
0009217332e42e0b0c1cc8d1d65fbb930631476b | JavaScript | cardaminexhz/cardaminexhz.github.io | /practiceDemo/algorithms/leetcode/70-Climbing Stairs/demo.js | UTF-8 | 760 | 3.859375 | 4 | [] | no_license | /**
* Created by carda on 2016/9/7.
*/
/**
* T(n)? S(n)?
* @param {number} n
* @return {number}
*/
var climbStairs = function(n) {
if(n === 1) return 1;
if(n === 2) return 2;
return climbStairs(n-1) + climbStairs(n-2);
};
/**
* T(n) = O(n), S(n) = O(n)
* */
var climbStairs1 = function(n) {
v... | true |
a266d63bf0677c5cafcde38e406bec6ff0b1de00 | JavaScript | IgorGomesSilva/StudioGamers | /controllers/ComputadorController.js | UTF-8 | 1,575 | 2.78125 | 3 | [] | no_license | import Computador from '../models/computador';
class ComputadorController {
getAll (req, res) {
return Computador.find()
.then(result => res.json(result))
.catch(error => res.send(error).end());
}
getById (req, res) {
const params = req.params;
return Computador.findOne({"_id": params.id... | true |
3791cdba631d1a8626850f7c5133cfb0b53d4d42 | JavaScript | jhonmcc/javascript-learn | /js-orientado-objeto/1-inicio.js | UTF-8 | 532 | 3.859375 | 4 | [] | no_license | // aqui podemos importar um modulo ou classe de um outro arquivo, tudo irá depender da estrutura que irá utilizar para o seu programa
// é possível criar uma classe no proprio arquivo e interagir com ele
class Carro {
cor;
ano;
renavam;
}
// criamos uma nova instancia da classe
const fusca = new Carro();
... | true |
e305ee052a7045b20728106f3fc0421f8df26ad4 | JavaScript | kpakshay/integra-react-assignment3 | /src/App.js | UTF-8 | 1,085 | 2.625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import './App.css';
import CounterComponent from './CounterComponent';
import CardComponent from './CardComponent';
function App({counterComponent}) {
const [alltoggle, setToggleCounterComponent] = useState(true);
// const [toggleCard, setToggleCard] = useState(tru... | true |
9eb51484fc3a1306853d6b68efadd69ffdb7ef39 | JavaScript | pvnair265/barclays | /assets/js/pie.js | UTF-8 | 5,069 | 2.953125 | 3 | [] | no_license | function donutChart() {
// margin
var margin = {top: 20, right: 20, bottom: 20, left: 20},
width = 350 - margin.right - margin.left,
height = 350 - margin.top - margin.bottom,
radius = width/2;
// color range
var color = d3.scaleOrdinal()
.range(["#BBDEFB", "#90CAF9", "#0D1C65", "#4F4948"]);
// donu... | true |
d117b958a1b997f7d22172de425a7359798ae617 | JavaScript | ValkrynCiel/jQuery_huntr_board | /DOM.js | UTF-8 | 10,327 | 2.71875 | 3 | [] | no_license | $(function() {
let $body = $('body');
// container for creating and storing lists
let $listOrderContainer = $('#list-order-container');
let $newListButton = $('#new-list-button');
// delete form and inputs
let $deleteNotice = $('#delete-form');
let $deleteListId = $('#delete-list-id');
let $deleteJob... | true |
f2d5e8144c512094cfdb6676e51d9a33de81a7bb | JavaScript | 4bros1app/4bros1app | /public/app/quizMovieList.jsx | UTF-8 | 1,815 | 2.625 | 3 | [] | no_license | import React from 'react'
import axios from 'axios'
import QuizMovieEntry from './quizMovieEntry.jsx'
import { Grid, Row, Jumbotron, Button, Col } from 'react-bootstrap'
class QuizMovieList extends React.Component {
constructor(props) {
super(props);
this.state = {
front: this.props.movies[0]
}
this.chang... | true |
7b3d38a1973edd6f8bed910bfccea91a246d828a | JavaScript | Klay24-Huang/AllPages | /All/DataTable/script.js | UTF-8 | 4,651 | 2.75 | 3 | [] | no_license | $(function () {
// 初始化table
dt = $('#table_id').DataTable({
data: dat
});
// 讀取local data
LoadData();
//顯示新增modal
$('#btn-ShowAddModal').click(function (e) {
$('#AddModal').modal();
});
//點擊匯入按鈕
$('#btn-ShowImportModal').click(function (e) {
isImport = tru... | true |
071115840a65d6b46d6917845fa3ab3c31f768fc | JavaScript | Crawping/fishjam-template-library | /Web/JavaScript/tests/JsHtml5Tester.js | GB18030 | 2,547 | 3.171875 | 3 | [] | no_license | "use strict";
/*************************************************************************************************************************
* HTML5 ˺ܶµԪ
* canvas --
* getContext("2d") -- ȡ2DĻĺ
* width/height -- ߿
* toDataURL() -- CanvasеתURLֱӸֵ img.src
*
* context
* createImageData
* getImage... | true |
ecbf32169a65454829d73c58c81ea5c15fed8d0a | JavaScript | cFuller-Softwire/Dynamite | /botOne.js | UTF-8 | 5,094 | 3.28125 | 3 | [] | no_license | class Bot {
constructor() {
this.dynamiteUsed = 0;
this.opponentsDynamite = 100;
this.myMoves = [];
this.oppMoves = [];
this.myPoints = 0;
this.oppPoints = 0;
this.nextRoundPoints = 1;
this.twoTieMoves = [];
};
makeMove(gamestate) {
if... | true |
46cacfcaf1686f2a203bf8343c88acff7aeb02bb | JavaScript | masskonfuzion/masskonfuzion.github.io | /asteroids_arena_wip/src/arena.js | UTF-8 | 5,396 | 2.921875 | 3 | [] | no_license | function Arena () {
GameObject.call(this);
// In this early version, the arena will simply be a rectangle. We can use AABBs for the arena's boundaries (which will be 2 vertical and 2 horizontal)
// If we continue into later versions, we should have a general polygonal shape; maybe use the separating axis t... | true |
b10b8f5cd527c948fbd9d7a59f25c199237c0945 | JavaScript | icefox0801/algorithm | /utils/wrapMST.js | UTF-8 | 362 | 2.859375 | 3 | [] | no_license | module.exports = (title, func) => {
const result = [];
func.callback = edge => {
result.push(`[ ${edge[0]}, ${edge[1]}, ${edge[2]} ]`);
}
return function (...args) {
const sum = func(...args);
if (!sum) result.splice(0);
console.log(`${title}`);
console.log(`SUM: ${sum}`);
console.lo... | true |
9e57ea9a7dae58fb6887d581a9a3ebe1c4a31b1b | JavaScript | whuisummer/77629296.github.io | /src/每天lodash/__test__/arrayIncludesWith.test.js | UTF-8 | 709 | 2.65625 | 3 | [] | no_license | import _ from '../';
describe('arrayIncludesWith', () => {
var array = ['a', 'b', 'c', 'd'];
var comparatorEqual = (target, value) => target === value;
var comparatorAddB = (target, value) => target === value + 'b';
it('包含a 没有比较函数', () => {
expect(_.arrayIncludesWith(array, 'a')).toEqual(false);
});
i... | true |
909965a6dc19ad451b05dc07abf8084aae84c298 | JavaScript | adbilagi/cathlab | /client/src/validate/index.js | UTF-8 | 365 | 2.53125 | 3 | [] | no_license |
/**
* This file contains generic validadtors for front end
*/
export let numberToCrDr = (Amount = 0)=>{
if(typeof Amount != "number"){
throw "invalid number to Cr or Dr";
}else if(Amount < 0){
return `${Math.abs(Amount)}Cr`
}else if(Amount > 0){
return `${Amount}Dr`;
}else if(... | true |
0e67dbdd82b84e23b4fced218827e53d9b3adeeb | JavaScript | Usama-Faisal/Web-Tech | /Java_Script_Begginers/Function_Hosting/function_hosting.js | UTF-8 | 119 | 2.984375 | 3 | [] | no_license | var total = sum(4,3);
document.write("Total = ", total);
function sum(a,b)
{
return a + b;
}
| true |
aab010c9cd152e43a78b0e57559fd5e9efa8501d | JavaScript | midorisan388/game | /js/Battlescenes/Battleparty.js | UTF-8 | 3,916 | 2.59375 | 3 | [] | no_license | var i=0;
const
partylength=4,
posutionY=45,
positiondist=20;
let
STEPTIME = 10,
step=0,
playerrenderStetas=[
{
y:posutionY,
name:"",
currentHp:0,
maxHp:1000,
state:"idle",
id_img:100000,//通し番号
img: "",//imgurl "img/characters/character1/"+id_img+"0301.png",
... | true |
a4bfce0a8ecce0b97145c9c79ea3b69243475638 | JavaScript | Stephanlebed/beginners-playground-uzduotis | /static/js/main.js | UTF-8 | 1,886 | 2.96875 | 3 | [] | no_license | $(document).ready(function(){
// COMPILE TEMPLATE
var template = $("#template-info").html();
var compiledTemplate = Handlebars.compile(template);
// HEADER + json header
var navigation = {
'navLogo': 'Logo',
'navItems' : [
{
'navTitle' : 'Home',
'navLink' : '#'
},
{
'navTitle... | true |
7ccf626f2aa9d7ad1adf6452dac09991bfd06f56 | JavaScript | jschappel/ABC-Corp | /Server/src/SQL/employee.js | UTF-8 | 11,295 | 2.828125 | 3 | [] | no_license | const connection = require('../Database/database')
const AuxQueries = require('./utils/abstract_queries')
/* --- Queries --- */
/**
* getEmployee: retrieves a single employee type from db based on the id passed
* @param {String} id the id of the employee to be queried
* @returns {Promise} Promise is resolved if th... | true |
30601ba6cf9f6b0e54fc408a74c9e6313dc8b967 | JavaScript | c2m2-asia/kathmandu-portal-client | /app/containers/UnivariateChartPage/reducer.js | UTF-8 | 867 | 2.515625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /*
*
* UnivariateChartPage reducer
*
*/
import { fromJS } from 'immutable';
import {
GET_UNIVARIATE_DATA,
GET_UNIVARIATE_DATA_SUCCESS,
GET_UNIVARIATE_DATA_FAILURE,
} from './constants';
export const initialState = fromJS({
loading: false,
univariateData: null,
errorMessage: null,
});
/* eslint-disable... | true |
e37c0666c26e34ac8b0c130482857b42ed85bf2b | JavaScript | radomirKrastev/JS-Advanced | /Old Exams/17.03.2019/Courses/scripts/solution.js | UTF-8 | 2,452 | 3.234375 | 3 | [] | no_license | function solve() {
let coursesMap = {
"JS Fundamentals": 170,
"JS Advanced": 180,
"JS Applications": 190,
"JS Web": 490,
bonus: "HTML and CSS"
};
function checkCourses(selectedCourses, courses) {
for (let i = 0; i < courses.length; i++) {
if (!selectedCourses.includes(courses[i])) {... | true |