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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8d898d428f8d07d6e681cbe13769cf0ec154b911 | JavaScript | Judiciozan/skolskiITbootcamp | /Objekti/blog_script.js | UTF-8 | 4,959 | 3.515625 | 4 | [] | no_license | let blog1 = {
title : "Blog 1!",
content : "Tekst 1",
likes : 5 ,
dislikes : 10
};
let blog2 = {
title : "Blog 2!!",
content : "Tekst 2",
likes : 20 ,
dislikes : 20
};
let blog3 = {
title : "Blog 3!?",
content : "Tekst 3",
likes : 50 ,
dislikes : 0
};
let user = {
... | true |
275fd64a8ba853a8e854e89fe2e5cfdda9962ea3 | JavaScript | shlev/Alpaca-image-generator-website | /frontend/src/App.js | UTF-8 | 2,610 | 2.75 | 3 | [] | no_license | /* eslint-disable no-alert */
/* eslint-disable arrow-parens */
/* eslint-disable max-len */
import { useState } from 'react';
import Header from './components/Header';
import ActionButton from './components/ActionButton';
import Preview from './components/Preview';
import ButtonsList from './components/ButtonsList';
i... | true |
4ec90ef00e096b75c38ffb3af414ef8eb9d4419c | JavaScript | xuwoan/KLTN_MyWork | /src/reducers/listTypeJob.reducer.js | UTF-8 | 829 | 2.546875 | 3 | [] | no_license | import * as type from '../actionTypes';
import assign from 'object-assign';
import _ from 'lodash';
const initialState = {
isLoading: false,
isError: false,
datatypejob:[],
};
export default function statistic(state = initialState, action) {
switch (action.type) {
case type.FETCH_LIST_TYPE_JOB_REQUEST:
... | true |
3d3acd8ad7582de02c074168587f7a7f67764d00 | JavaScript | melmarin/TurisTICO | /View/js/mapa.js | UTF-8 | 1,270 | 2.890625 | 3 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive |
/*------------------------------mapa------------------------------*/
localize();
function localize()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(mapa,error);
}
else
{
alert('Tu navegador no soporta geolo... | true |
bd67e7e21969401bb2c4a68b1892dfcce2f56262 | JavaScript | JulianNicholls/Logo-Interpreter | /turtle.js | UTF-8 | 1,187 | 3.625 | 4 | [
"MIT"
] | permissive | // The direction starts straight up, however, actually its 270deg
// because the co-ordinate system runs from the top.
class Turtle {
constructor(ctx) {
this.ctx = ctx;
this.reset();
}
reset() {
this.angle = -Math.PI / 2;
this.x = 300;
this.y = 300;
this._penDown = true;
this.ctx.st... | true |
0ec86cc29f7060793a565eb24365a7ad4725423f | JavaScript | clairecoxo/web2018_clairecohen | /demonstration_6/scripts.js | UTF-8 | 1,606 | 3.359375 | 3 | [
"MIT"
] | permissive | //ARRAYS FOR RANDOM
var fonts=["monospace", "cursive", "serif", "sans-serif","impact"];
var letterspacing = [0,5,10,15];
//FUNCTION TO UPLOAD IMAGE
function previewFile(){
var preview = document.querySelector('img'); //selects the query named img
var file = document.querySelector('input[type=fil... | true |
79dd398599ab80fa68e02325a4f3860e83ea0cba | JavaScript | kihapper/p5js_play | /docs/sketch.js | UTF-8 | 3,200 | 3.078125 | 3 | [] | no_license | // Copyright (c) 2018 ml5
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
/* ===
ML5 Example
ImageNet_Camera
Video Camera Classification using p5.js
=== */
// Initialize the ImageNet method with the MobileNet model.
const classifier = new ml5.ImageClassifier('MobileNet')... | true |
2165090f5e3ab622b7a2fc11e3857246cd150978 | JavaScript | convio/luminate-online-data-viewer | /src/js/services/DateRangePicker.js | UTF-8 | 1,397 | 2.75 | 3 | [] | no_license | dataViewerApp.factory('DateRangePickerService', [function() {
return {
init: function(selector, callback) {
var _this = this;
$(selector).daterangepicker({
startDate: moment().subtract(1, 'days'),
endDate: moment(),
ranges: _this.getRanges(),
timePicker: true
... | true |
cab520e13c2cf844a2b917c53facbec56f2a980d | JavaScript | RenatoSiqueira/newslleter-tool | /classes/weekly.js | UTF-8 | 1,785 | 2.546875 | 3 | [
"MIT"
] | permissive | class Weekly {
constructor(data) {
this.applyData(data)
this.state = 'partial'
this.loadComments().then(UI.update)
this.contributors = {}
this.categories = {}
}
static isValid(data) {
if (data.title.startsWith('Edição ') && data.repository_url === 'https://api.github.com/repos/braziljs/wee... | true |
5747020a98917077c63b9575f37755b3902d3a41 | JavaScript | SarahNoel/node-github-contest | /server/routes/index.js | UTF-8 | 2,818 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var logic = require('../logic/logic');
var model = require('../models/models')
var allSubs = model.allSubs
var errorArray;
var winners;
var winners2;
var champ;
//show home page
router.get('/', function(req, res, next) {
res.render('index', {errorArra... | true |
b7a38439432d3a4cae042a3a113f12f8cb9d4e06 | JavaScript | roggew/javascript-arrays-lab-js-intro-000 | /index.js | UTF-8 | 845 | 3.953125 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var kittens = ["Milo", "Otis", "Garfield"] //define your array here
// Add your functions and code here
function destructivelyAppendKitten(name){
kittens.push("Ralph")
return kittens
}
function destructivelyPrependKitten(name){
kittens.unshift("Bob")
return kittens
}
function destructivelyRemoveLastKitten(na... | true |
76a9497658c5ebfc131c02573db50ebc83997bc0 | JavaScript | denilsonsa/lajejs | /laje.js | UTF-8 | 50,512 | 3.078125 | 3 | [] | no_license | /*jslint browser: true, devel: true, sloppy: true, white: true */
// vim:foldmethod=marker foldmarker={,}
"use strict";
// Returns a linear interpolation of y1,y2 based on x value between x1,x2.
function linearInterp(x, x1, x2, y1, y2) {
return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
}
// Receives a table, a string... | true |
e578890b86ac6bda379a867b45cf154b3eb8766d | JavaScript | arielconti10/trau | /source/helpers/thumbor.js | UTF-8 | 6,186 | 2.734375 | 3 | [] | no_license | import { IMAGE_CDN_HOST } from 'Config/Constants';
/**
* @param {[type]} securityKey
* @param {[type]} thumborServerUrl
*/
function ThumborUrlBuilder(thumborServerUrl) {
this.THUMBOR_URL_SERVER = thumborServerUrl;
this.reset();
}
ThumborUrlBuilder.prototype = {
TOP: 'top',
MIDDLE: 'middle',
BOTTOM: 'bo... | true |
51091cda123f58a9c348922a5fae5c5b3fdec107 | JavaScript | isabella232/checklist | /src/util.js | UTF-8 | 1,452 | 2.90625 | 3 | [
"MIT"
] | permissive | util.empty=txt=>!txt.replace(/\s/g,'').length
//useful when rerendering before array length is updated (e.g. pop/splice)
util.mapEmpty=(arr,fn)=>arr.filter(x=>!!x).map(fn)
util.rand=(max,min=1,seed=Math.random())=>Math.floor(seed*(max-min+1))
util.shuffle=function(arr)
{
arr.map(()=>util.rand(arr.length-1,0))
.forEac... | true |
7842c0a2d33f7761fae629384ded932fcd3eb448 | JavaScript | licorm/lotide | /without.js | UTF-8 | 1,145 | 4.4375 | 4 | [] | no_license | // check if arrays are equal
const eqArrays = function(array1, array2) {
if (array1.length !== array2.length) {
return false;
}
for (let i = 0; i < array1.length; i++) {
if (array1[i] !== array2[i] || typeof(array1[i]) !== typeof(array2[i])) {
return false;
}
}
return true;
};
// check if a... | true |
c81431cd6bf3ccd3628ce671cc0d5b7f9034c26f | JavaScript | lamnguyencse17/smart-lighting | /src/client/reducers/device.js | UTF-8 | 510 | 2.578125 | 3 | [
"MIT"
] | permissive | import { GET_DEVICE, ADJUST_DEVICE } from "../actions/types";
const initialState = {
_id: "",
device_id: "",
name: "",
history: {},
};
export default function (state = initialState, action) {
switch (action.type) {
case GET_DEVICE:
return {
...action.payload,
};
case ADJUST_DEVIC... | true |
a1f97b2bbac59e27758788db7fb5a879c16242c0 | JavaScript | SaidNM/Aprendiendo-C-y-ASP.NET | /PruebaDesarrollo/PruebaDesarrolloW/js/principal.js | UTF-8 | 3,531 | 3 | 3 | [
"MIT"
] | permissive |
$(document).ready(function () {
vaciarTabla();
var datos = {
tipo: 1
}
//peticion_llenar_ASCDESC_PAR(1, 1);
document.getElementById("btnAscendente").onclick = function () {
var parametro = $('input:radio[name=radios]:checked').val();
peticion_llenar_ASCDESC_PAR(parametro... | true |
fc071e86ec218e6cbf20e157afc41d609b192457 | JavaScript | hailduong/NeighbourhoodMap | /server.js | UTF-8 | 1,081 | 2.515625 | 3 | [] | no_license | /*
* This will setup a simple server for the project
* */
const http = require('http');
const express = require('express');
const app = express();
let httpServer = http.createServer(app);
app.use(express.static('public'));
httpServer.listen(8080, () => {
console.log('Http Server Started, port 8080')
});
app.ge... | true |
825a04b377994a47a7193df6cc5226e23492ec29 | JavaScript | sjclijie/javascript_example | /node/async_demo/mysql_demo/2.js | UTF-8 | 773 | 2.546875 | 3 | [] | no_license | /**
* Created by Jaylee on 15/9/02.
*/
var mysql = require('mysql'),
async = require('async');
var conn = mysql.createConnection({
host: "localhost",
user: "root",
password: "123456",
database: "test"
});
var sqls = {
insertSQL : "insert into user(name, age) values('abc', 12)",
selectSQ... | true |
5cdeb244c55a2ffb5fb14b850dfb4e906d1bbc6a | JavaScript | AnorVen/254627-big-trip-8 | /src/models/ModelOffer.js | UTF-8 | 528 | 2.765625 | 3 | [] | no_license | export default class ModelOffer {
constructor(data) {
this.type = data[`type`];
this.offers = data[`offers`];
this._getOffer = this._getOffer.bind(this);
}
_getOffer() {
const temp = this.offers.map((item)=>{
return {title: item.name,
price: item.price,
accepted: false};
... | true |
056e2155a839d2b2c3bc29f879e10b6718e2e6ae | JavaScript | CindyChenx/fewpjs-removing-altering-and-inserting-html-lab-online-web-pt-041519 | /index.js | UTF-8 | 252 | 2.625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Write your code here!
main.remove();
// let element = document.querySelector('h1#victory');
// element.innerHTML = 'newHeader';
let newHeader = document.createElement('h1');
newHeader.id = 'victory';
newHeader.innerHTML = 'Cindy is the champion'; | true |
87e4a51ce0642b36d0ad389ce8b5a014e944f110 | JavaScript | lahuer99/carter | /carter.js | UTF-8 | 4,168 | 3.359375 | 3 | [] | no_license | class Items{
constructor(name){
this.itemname=name
this.qty=0;
this.isStarred=false;
}
}
const cart=[]
// const divitems=document.querySelectorAll('.items')
// console.dir(divitems[divitems.length-1])
// const inititem=new Items(divitems[divitems.length-1].childNodes[1].innerHTML.trim())
// divitems[0].ob... | true |
f31eddfd06fc427853f416da8933d2c41fcb4c91 | JavaScript | mosesnova/TalenOnboarding | /TalenOnboarding/ClientApp/src/components/Talent/AddCustomer.js | UTF-8 | 1,772 | 2.84375 | 3 | [] | no_license | import React, { Component } from 'react';
import $ from 'jquery';
export class AddCustomer extends Component {
constructor(props) {
super(props);
this.state = {
name: '',
address:''
};
this.handleSubmit = this.handleSubmit.bind(this);
this.logChang... | true |
3436af87f138df1d323dcd7637fc1a24356c8ada | JavaScript | hhuynhlam/algorithms | /AlgorithmicToolbox/src/KMP/computeLPS.spec.js | UTF-8 | 638 | 2.59375 | 3 | [] | no_license | const computeLPS = require('./computeLPS');
describe('#computeLPS', () => {
it('Case 1', () => {
expect(computeLPS('a'))
.toEqual([0]);
});
it('Case 2', () => {
expect(computeLPS('aba'))
.toEqual([0, 0, 1]);
});
it('Case 3', () => {
expect(computeLPS('abab'))
.toEqual([0, 0, 1... | true |
ac719e7939a502b8121be5df732ad52e71317d63 | JavaScript | hhff/empathy-simulator | /app/scripts/src/lib/app.js | UTF-8 | 11,546 | 2.59375 | 3 | [
"MIT"
] | permissive | // Vendor Libs Modernizr, Soundcloud, Firebase
// Add Range Map
Number.prototype.rangeMap = function ( in_min , in_max , out_min , out_max ) {
number = ( this - in_min ) * ( out_max - out_min ) / ( in_max - in_min ) + out_min;
if(number < 0){
number = 0
}
if(number > out_max) {
number = out_max
}
... | true |
d17e4e778ebe22d03e4130952c2b69d10c5c47bd | JavaScript | paulajofre/html5bootcamp | /topic3/app/js/test/unit/testingAngularUnit.js | UTF-8 | 1,950 | 2.640625 | 3 | [] | no_license | describe('Testing AngularJS Test Suite', function() {
describe('Testing AngularJS Controller', function() {
var ctrl;
var scope = {};
beforeEach(function() {
module('topicThree');
inject(function($controller) {
ctrl = $controller('topicController', {... | true |
3b6be36a40fec0a6c538c208b1b43adca8776686 | JavaScript | cttttt/js-control-flow-trials | /trials/11-sequential-promises.js | UTF-8 | 1,064 | 3.65625 | 4 | [] | no_license | // write a promise returning function that accepts three promise returning
// functions. Call them in order.
module.exports.simpleSequence = function (first, second, third) {
};
// write a promise returning function that accepts three promise returning
// functions. Call each one with the result of the previous functi... | true |
7b24a24ae8e061a475296780383ed36715a2681b | JavaScript | reneolivo/music-search | /app/services/spotify.spec.js | UTF-8 | 2,712 | 2.703125 | 3 | [
"MIT"
] | permissive | import jQuery from 'jquery';
import './spotify';
import artists from '../mocks/data/artists';
import albums from '../mocks/data/albums';
import tracks from '../mocks/data/tracks';
describe('Spotify Service', () => {
beforeEach(inject(setup));
it('should be defined', shouldBeDefined);
it('should define a .searc... | true |
cdeefb9d8e09af472c66c617aa1c3404a9735a28 | JavaScript | nguyenhoangnam123/drag-drop-reorder | /index.js | UTF-8 | 2,088 | 3.15625 | 3 | [] | no_license | let dragged;
let swapItem;
function createDraggableElement() {
const element = document.createElement("div");
element.setAttribute("class", "draggable-item");
element.setAttribute("draggable", "true");
return element;
}
for (let i = 0; i < 10; i++) {
let element = createDraggableElement();
element.innerTe... | true |
79bb12e909c87e45a7b23123bac2abe001d1a861 | JavaScript | gharbirami/checkpoint-api | /src/UserList.js | UTF-8 | 3,269 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios";
const UserList = () => {
const [data, setData] = useState([]);
useEffect(() => {
axios.get("https://jsonplaceholder.typicode.com/users").then((res) => {
setData((data) => res.data);
})
}, []);
re... | true |
30a9519119d7706ded813f6d8f8173f4a0f934d9 | JavaScript | nilproject/NiL.JS | /TestSets/tests/sputnik/ch15/15.3/15.3.4/15.3.4.2/S15.3.4.2_A11.js | UTF-8 | 511 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2009 the Sputnik authors. All rights reserved.
/**
* The length property of the toString method is 0
*
* @path ch15/15.3/15.3.4/15.3.4.2/S15.3.4.2_A11.js
* @description Checking Function.prototype.toString.length
*/
//CHECK#1
if (!(Function.prototype.toString.hasOwnProperty("length"))) {
$ERROR('#... | true |
95c5f68def4b523577904157f2aad1a263c98652 | JavaScript | NinaHahne/thePond | /src/reducers.js | UTF-8 | 2,031 | 2.90625 | 3 | [] | no_license | export default function reducer(state = {}, action) {
if (action.type === "RECEIVE_FRIENDS_WANNABES") {
// cloning global redux state with spread operator:
state = {
...state,
friendsWannabes: action.friendsWannabes
};
}
if (action.type === "ACCEPT_FRIEND_RE... | true |
9db727def982fe633e52bfcb5c1a885f68e25086 | JavaScript | ESGI2048/2048-API | /routes/index.js | UTF-8 | 2,278 | 2.546875 | 3 | [] | no_license | 'use strict';
const express = require('express');
const bodyParser = require('body-parser');
const router = require('./classLoader.js');
const NotificationRouter = router.NotificationRouter;
const ComponentRouter = router.ComponentRouter;
const EventRouter = router.EventRouter;
const CodeRouter = router.CodeRouter;
co... | true |
2a32263d240e28c1bc17d8ee3749c5589dfd9f8a | JavaScript | Tr4vi5/incase-solo-project | /src/components/RegisterPage/RegisterPage.js | UTF-8 | 2,842 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
class RegisterPage extends Component {
constructor(props) {
super(props);
this.state = {
use... | true |
de096ab9cb09c9784bf99488f4cf75583c58f761 | JavaScript | erikfenriz/elven-scout | /src/scenes/game-level.js | UTF-8 | 1,104 | 2.59375 | 3 | [
"MIT"
] | permissive | import { Scene } from '../scene';
import { SpriteSheet } from '../sprite-sheet';
export class GameLevel extends Scene {
constructor(game) {
super(game);
this.tiles = new SpriteSheet({
imageName: 'tiles',
imageWidth: 640,
imageHeight: 640
});
this.... | true |
a23367f8eb1fc455810307ba859b3ee1463da85e | JavaScript | orassayag/starter-kits | /starter-kits/project-server-external-api---client-hooks-redux-thunk---socket.io/server/src/services/socketio.service.js | UTF-8 | 747 | 2.640625 | 3 | [] | no_license | const socketIo = require('socket.io');
class SocketIoService {
constructor() {
this.socketIO = null;
}
initiate(server) {
this.socketIO = socketIo(server, {
cors: {
origin: '*'
}
});
this.socketIO.on('connection', (socket) => {
this.log(`socketIo ${socket.id} connected.`);
... | true |
a971b1da7f3d751d533d88876ac1984ff6cca17c | JavaScript | aalmog333/PizzaRestaurant-NodeJS | /order.js | UTF-8 | 5,703 | 3.125 | 3 | [] | no_license | const fs = require('fs');
module.exports = class Order {
constructor(id,toppings) {
this.id = id;
this.toppings = toppings;
this.stage = 0;
this.startTime = new Date();
this.endTime = null;
this.log(this.startTime);
}
// write to log the current stage of the order
// currently using... | true |
e1270e35fcde2447fd3d1025c1fd50f05383005c | JavaScript | nebjs/nebjs-validator | /src/schema/keywords/pattern.js | UTF-8 | 968 | 2.734375 | 3 | [
"MIT"
] | permissive | const message = 'data{{dataPath}} should be match to one of the pattern';
/**
* pattern关键字处理程序:data字符串值的格式满足pattern对应的正则表达式
* 举例:pattern: ['^[abc]+$']
* 符合:data: "a", "abc", "cde"
* 不符合: data: "d", "abd", "def", "123", ""
*/
const dataValid = function (stack) {
const stackItem = stack[stack.length - 1], {data, s... | true |
207b5bcfb1043ab84d80f00e5bb0c1221a048aac | JavaScript | huyIttos2/session10 | /productManager.js | UTF-8 | 1,702 | 2.96875 | 3 | [] | no_license | function Product(id,name,price) {
this.id = id;
this.name = name;
this.price = price;
this.getId = function () {
return this.id;
};
this.getName = function () {
return this.name;
};
this.getPrice = function () {
return this.price;
};
}
function ListProduct() {... | true |
d173831da33d7e314c44f94400d2fc7be91f03d2 | JavaScript | lsgabriel/projeto-mobile | /ProjetoSalao/Frontend/AppSalao/hooks/useAuth.js | UTF-8 | 553 | 2.59375 | 3 | [] | no_license | import AsyncStorage from '@react-native-async-storage/async-storage';
import { useState, useEffect } from 'react';
const useAuth = () => {
const [auth, setAuth] = useState('');
const getData= async () => {
try{
const resp = await AsyncStorage.getItem('auth');
if(resp !== null)... | true |
b580028c05902a20eb3085da3c1c5a14e1773770 | JavaScript | daimant/social-network | /src/redux/profile-reducer.test.js | UTF-8 | 1,411 | 2.640625 | 3 | [] | no_license | import profileReducer, {
addPostActionCreator,
deletePost
} from "./profile-reducer";
import React from "react";
let state = {
postsData: [
{
id: 1,
message: "hello, how u feel?",
img: "https://clck.ru/MDDf7",
likeCounts: 0
},
{
id: 2,
message: "where my money?",
... | true |
c9236bca36d6e2a725bf117454c605423934253b | JavaScript | wxyzcctv/WebTrainingBattalionWeek11 | /html-parser/test/parser-test.js | UTF-8 | 2,614 | 2.65625 | 3 | [] | no_license | var assert = require('assert');
var parserHTML = require('../src/parser.js').parserHTML;
// import { parserHTML } from '../src/parser.js';
describe('parse html:', function () {
it('<a></a>', function () {
let tree = parserHTML('<a></a>');
assert.equal(tree.children[0].tagName, 'a');
assert... | true |
690c973cdabdcd90f8c858a289ba3cf400cd3745 | JavaScript | villeantila/ReactTalo2 | /WebApplication3/ClientApp/src/components/Sovellus.js | UTF-8 | 9,141 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
export class Sovellus extends Component {
displayName = Sovellus.name
constructor(props) {
super(props);
this.state = {
talot: [],
talonTiedot: [],
loadingTalonTiedot: true,
ta... | true |
959a87f4023f06f9c8a54d547ca1cc55f792e23c | JavaScript | RimantasGalvonas/customJSRendererAndPhysicsExperiment | /thingsAndTheirPhysics.js | UTF-8 | 4,867 | 2.921875 | 3 | [] | no_license | class Thing {
positionX = 0;
positionY = 0;
positionZ = 0;
rotationZ = 0;
scaleX = 0;
scaleY = 0;
scaleZ = 0;
image = null;
physicsModule = null;
attachedCamera = null;
constructor(x = 0, y = 0, z = 0, scaleX = 0, scaleY = 0, scaleZ = 0, lifetime = null) {
... | true |
84251113956d1497db47a5c1660738fda0ec8648 | JavaScript | lnieves/rest-markdown | /tests/lib/MarkdownHtmlTest.js | UTF-8 | 2,760 | 2.65625 | 3 | [] | no_license | 'use strict';
const fs = require('fs');
const MarkdownHtml = require('../../lib/MarkdownHtml');
const chai = require('chai');
chai.should();
describe('MarkdownHtml', () => {
var parser;
beforeEach(() => {
parser = new MarkdownHtml();
});
it ('Should split into blocks', () => {
const ... | true |
b06217ddec89fab1352fe6f612db7101f01aabf5 | JavaScript | liip/chusho | /packages/chusho/lib/utils/tests/debounce.spec.js | UTF-8 | 1,580 | 2.59375 | 3 | [
"MIT"
] | permissive | import debounce from '../debounce';
afterAll(() => {
vi.useRealTimers();
});
describe('debounce', () => {
const time = 500;
it('call the function only once after the given duration', () => {
vi.useFakeTimers();
const callback = vi.fn();
const debounced = debounce(callback, time);
debounced()... | true |
6d785dbd73c0dfafe0d1bb3a99387679b8e2a056 | JavaScript | AliceTarnovskaya/lesson6 | /lesson6/script.js | UTF-8 | 1,050 | 3.140625 | 3 | [] | no_license | // В самом простом виде это будет инпут для ввода задач и список задач с чекбоксами для маркировки задач как сделанных. \
// Дальше можно добавлять: \
// 1. Перечеркивание задачи при маркировке как сделанной
// 2. Удаление задач
const input = document.querySelector('#search'),
button = document.querySelect... | true |
4ce5767ce21afff2adb55f68af1fd2d671e71e6a | JavaScript | nairrita/C38_bug | /js/Player.js | UTF-8 | 1,011 | 3.0625 | 3 | [] | no_license | class Player {
constructor(){
//Adding the Properties
this.index = null;
this.distance = 0;
this.name = null;
}
getCount(){
var playerCountRef = database.ref('playerCount');
playerCountRef.on("value",function(data){
playerCount = data.val();
})
}
updateCount(count){
da... | true |
f093ca6a668cb49cefd291f3c3fa25fd4b082e27 | JavaScript | etangreal/hsds-react | /src/components/SleepDetector/index.js | UTF-8 | 1,140 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { noop } from '../../utilities/other'
class SleepDetector extends Component {
constructor() {
super()
this.state = {}
}
componentWillMount() {
this.clearInterval()
const { interval, buffer } = this.props
cons... | true |
45d692795db30040ec2d9197ca90d0d2e77d7861 | JavaScript | oflisback/graph-generator | /test/gg.js | UTF-8 | 1,279 | 2.8125 | 3 | [
"MIT"
] | permissive | const expect = require('chai').expect;
const gg = require('../index.js');
const math = require('mathjs');
describe('Graph generator tests', () => {
it('Generates random graph, verifies size, diagonal and symmetry', () => {
const nbrNodes = 10;
const adjMatrix = gg.generateGraph({ nbrNodes });
const trans... | true |
22087b885d4d0fd5da744eb8437468623c30e178 | JavaScript | funcococode/interactive-navbar | /main.js | UTF-8 | 1,055 | 2.75 | 3 | [] | no_license | const navItem = document.querySelectorAll('.navItem');
const lis = document.querySelectorAll('li');
const imgs = document.querySelectorAll('.navItemImg');
const ps = document.querySelectorAll('.navItemDesc');
navItem.forEach((item,i) => {
item.addEventListener('mouseover', ()=>{
imgs[i].classList.add('vis'... | true |
69fe1373a9a7483fb4d43237b48bd77517c4a4dd | JavaScript | nongKoh/SwuBus | /Screens/userfunction.js | UTF-8 | 3,211 | 2.546875 | 3 | [] | no_license | import axios from "axios";
import env from "./config";
import { AsyncStorage, Alert } from "react-native";
import * as Location from "expo-location";
import haversine from "haversine";
let station = [];
let location = {};
// let stations = 0;
let id = 0;
let status = false;
let check = false
let checkid = false
let pu... | true |
613b2d85cf4bb10ec5cdabf23c6fd1a272bf4b74 | JavaScript | noamsauerutley/react-async-fetch-lab-dumbo-web-091619 | /src/App.js | UTF-8 | 523 | 2.5625 | 3 | [] | no_license | import React from 'react'
class App extends React.Component{
state = {
spacePpl: []
}
async componentDidMount(){
let rawSpacePpl = await fetch('http://api.open-notify.org/astros.json')
let spacePpl = await rawSpacePpl.json()
this.setState({
... | true |
9f724dae32b968eaa89978308ba3e11ad79d6468 | JavaScript | MuskaanSharma30/Newtodos | /src/App.js | UTF-8 | 4,381 | 2.65625 | 3 | [] | no_license | // import React, { Component } from 'react';
// import Todos from "./components/Todos"
// export default class App extends Component {
// state = {
// todos : [
// {
// id: 1,
// name: "Cook Lunch",
// completed: true
// },
// {
// ... | true |
525c00204be1403770a32dd0771fa1cb7b1d856a | JavaScript | andersonmcook/node-testing-mocha-chai-demo-1 | /app/index.js | UTF-8 | 1,036 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
const express = require('express');
const app = express();
const fs = require('fs');
const path = require('path');
const { IS_A_TEST, USERS_FILE } = require('../config');
// const USERS_FILE = path.resolve(__dirname, '..', 'users.json');
app.set('port', process.env.PORT || 3000);
console.log(USERS_FI... | true |
8cc0064b41c15a25f838bf3e5e11c4f2e30df06a | JavaScript | newedition994/js-object-oriented-classes-travel-lab-v-000 | /index.js | UTF-8 | 833 | 3.203125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | class Driver {
constructor(name, startDate){
this.name = name
this.startDate = new Date(startDate)
}
yearsExperienceFromBeginningOf(year){
return Math.abs( this.startDate.getFullYear() - year) -1
}
}
class Route {
constructor(start, end){
this.map = ['1st Avenue', '2... | true |
434ccfbc6edf951eddb9eb7a7a985c53c835699b | JavaScript | kaushalag29/Flo-Token-Tracking | /app.js | UTF-8 | 1,947 | 2.796875 | 3 | [
"MIT"
] | permissive | //take in root address
root_address = "oPounjEbJxY7YCBaVBm61Lf2ym9DgFnAdu"
root_init_value = 21000
let ajax = function (url, params, req_type, callback) {
//let url = `https://testnet.flocha.in/${uri}`;
console.log(url);
let response = {};
var http = new XMLHttpRequest();
http.open... | true |
f9c764f71ebcc211591c33f30f67056ef679fae1 | JavaScript | danidevstuff/flappybird | /classes/pipe.js | UTF-8 | 715 | 2.75 | 3 | [] | no_license | speed = 0;
class Pipe{
constructor(x , y , w , h){
this.x=x;
this.y=y;
this.w=w;
this.h=h;
let options = {
isStatic:true
}
this.body = Bodies.rectangle(x,y,w,h , options);
World.add(world , this.body);
};
display(){
... | true |
6d6bfb2d4cb448a52ab9fa957ab465ec42cf2c27 | JavaScript | urmastalimaa/interactive_frontend_development_2017 | /lecture_7/connected-react-router/src/JSONAjaxRequest.js | UTF-8 | 674 | 2.8125 | 3 | [
"MIT"
] | permissive | export default (url, method, data, onSuccess, onFailure) => {
const request = new XMLHttpRequest();
request.onreadystatechange = () => {
if (request.readyState == XMLHttpRequest.DONE) {
let response;
try {
response = JSON.parse(request.responseText);
} catch (error) {
... | true |
dd6185cebe0de79aba522ad17dbc7428cd730271 | JavaScript | Gustavo-Kuze/Bilhetinhos | /bilhetinhos/src/main/redux/reducers/mateNoteboardReducer.js | UTF-8 | 919 | 2.53125 | 3 | [
"MIT"
] | permissive | const INITIAL_STATE = {
user: {
email: '',
uid: '',
name: '',
profilePic: '',
coverPic: '',
bio: '',
phone: '',
matesUids: []
},
notes: [],
isLoading: true
}
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
... | true |
1afe7f29980f0be1012420aceb015d3b7dc1969e | JavaScript | NatalJR/objectiveTest | /src/components/CharactersComponents/CharactersPagination/index.jsx | UTF-8 | 2,595 | 2.53125 | 3 | [] | no_license | import { useMemo, useState, useEffect } from 'react'
import {
ButtonWrapper,
ButtonsWrapper,
Button,
PageButtonWrapper,
} from './styled'
import { useCharacters } from 'contexts/CharactersContext'
import debounced from 'utils/debounced'
const CharactersPagination = () => {
const { state, dispatch } = useChar... | true |
ce2afd3d64190155a73887b3f5ab41839d55d3e7 | JavaScript | Shinico/avina | /commands/approve.js | UTF-8 | 1,755 | 2.75 | 3 | [] | no_license | let dbClient = require('../databaseClient.js');
module.exports = {
execute: function(args, message) {
if(!message.guild) {
message.author.send("Sorry, but this command doesn't work in direct messages!");
return;
}
if(!message.guild.member(message.author.id).hasPermi... | true |
884c31fdd228353e6d0e897c591e7d23f958dad7 | JavaScript | dev-gui/test-nodejs | /src/controllers/productController.js | UTF-8 | 2,061 | 2.515625 | 3 | [] | no_license | const repository = require('../repositories/productRepository')
exports.create = async (req, res) => {
try {
const data = await repository.create(req)
res.status(201).send({
data: {},
message: data,
})
}
catch (err) {
res.status(500).send({
... | true |
5bce854a376997f0c67a3b693947193dda857dbd | JavaScript | ddatta-DAC/wwf_site_p1 | /home/home/static/sankey/visualization.js | UTF-8 | 4,237 | 2.921875 | 3 | [] | no_license | // Grab the chart div from the HTML page; retrieve its width and height
var chartDiv = document.getElementById("chart");
var section = document.getElementById("svg-section");
var width = chartDiv.clientWidth;
var height = 3000;
// Number formatting
var formatNumber = d3.format(",.0f"),
format = function(d) {
va... | true |
1aaa5ef4c094ddede4d60260065df592aaef217f | JavaScript | ryanblessing/GIT-IT-DONE | /assets/js/script.js | UTF-8 | 940 | 3.921875 | 4 | [] | no_license | // The array of questions for the game.
var questions = [
{ q: 'The sky is blue.', a: 't' },
{ q: 'There are 365 days in a year.', a: 't' },
{ q: 'There are 42 ounces in a pound.', a: 'f' },
{ q: 'The Declaration of Independence was created in 1745.', a: 'f' },
{ q: 'Bananas are vegetables.', a: 'f'... | true |
52dff7f05b18851234bb5efddcdadfe7221e5da9 | JavaScript | ll-fox/node | /by_self.js | UTF-8 | 440 | 2.71875 | 3 | [] | no_license | const http=require("http");
http.createServer((req,res)=>{
console.log(req.url);//获取url
//设置响应头
//状态码是200,文件类型是html,字符集是utf-8
res.writeHead(200,{"Content-Type":"text/html;charset='utf-8'"});
res.write("<head><meta charset='UTF-8'></head>");//解决乱码
console.log(req.url)
res.write('你好 is node.... | true |
84dd260ed98b16c57dde5bed8783982564439afe | JavaScript | abidkhan124/Accenture_Test | /Problem2.js | UTF-8 | 792 | 4.3125 | 4 | [] | no_license | //Write a function which accepts an array of strings and returns a map of character to count of the character(including spaces and special characters).
//Eg: input: [‘hello world’, ‘hello world’] output: {h: 2, e: 2, l: 6, ‘ ‘: 1, o: 4 …… }
var input = ['hello world', 'hello world']
function charCountMap(arr) {
... | true |
ab55db067eb9d26ddda75857182715b903af1474 | JavaScript | karang8/XReact | /src first/XReact.js | UTF-8 | 509 | 2.640625 | 3 | [] | no_license | const XReact = importRender();
function importRender() {
function render(element, mainDom) {
console.log(element)
const { type, props } = element;
const isTextElement = type === 'TEXT ELEMENT';
const dom = isTextElement
? document.createTextNode(props.textValue)
: document.createElement(... | true |
b1367ed4365d2949785028f6c6427cfbfe8bc89c | JavaScript | liuyingjie1130/JS-advanced-lessons | /LS30_/js30_.js | UTF-8 | 8,185 | 4.28125 | 4 | [] | no_license | // ES6对函数的扩展
var f=function(v){
return v+1;
}
f(2);//3
var f=v=>v+1;
f(2);//3
// 没有参数和有多个参数的情况下,需要使用小括号来表示参数,
// 如果有多条语句则需要有大括号表示函数体
var f=()=>5;
f();//5
var foo=(num1,num2)=>{
return num1>num2?num1*2:num2*2;
}
foo(2,3);//6
var max=function(a,b){
return a>b?a:b;
}
max(1,2);//2
var max=(a,b) => a>b?a:b... | true |
855473ee64fa6a04ffa2bf396205d0e5f695af32 | JavaScript | ywinharjono/Red-Onion-ReactJS | /src/Admin/EditProductForm.js | UTF-8 | 4,764 | 2.59375 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import { useHistory, useParams } from 'react-router-dom'
// eslint-disable-next-line no-unused-vars
import swal from 'sweetalert'
import Button from '../components/Form/Button'
import Label from '../components/Form/Label'
import TextField from '../components/Form/TextF... | true |
0242f7c673ddb51f326c694e00a8050398fffcc0 | JavaScript | cutyapple/Programming | /알고리즘/백준/브론즈3/2455.js | UTF-8 | 495 | 3.125 | 3 | [] | no_license | // const fs = require('fs');
// const [a, b, c, d] = fs.readFileSync('/dev/stdin').toString().split("\n").map(str => str.split(" ").map(text => Number(text)));
const [a, b, c, d] = `0 32
3 13
28 25
39 0`
.split('\n')
.map((str) => str.split(' ').map((text) => Number(text)));
console.log(
[a, b, c, d].reduce(
(pr... | true |
437ae08776b442c5683e7b7454de5772426eb014 | JavaScript | juliaramosguedes/ironhack-iron-nutrition-app-frontend | /src/components/pages/Foods/Foods.js | UTF-8 | 1,339 | 2.546875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import api from '../../../api/api';
import { FoodCard, AddForm, SearchForm, Cart } from '../../../components';
const Foods = (props) => {
const [foods, setFoods] = useState([]);
const [filteredFoods, setFilteredFoods] = useState([]);
useEffect(() => async () =... | true |
bde88b7aff65835592351da0c80b2c77e27197d6 | JavaScript | abdulawad93/aawadblog_app | /client/src/views/register.jsx | UTF-8 | 8,969 | 2.96875 | 3 | [] | no_license | //Import react and react hooks
import React, { useState, useEffect } from "react";
import {useHistory} from "react-router-dom";
//Importing bcryptjs to generate salt and hash
import bcrypt from "bcryptjs";
//Importing authentication services
import {register,getCurrentUser} from "../services/auth.service.js";... | true |
bf05c0b55b9769f04dc132b3d720cc9caed5c2a3 | JavaScript | mr3dh00d/Lab-4-ICF241 | /app-3/server.js | UTF-8 | 1,275 | 2.578125 | 3 | [] | no_license | const net = require('net');
const express = require('express');
const socketio = require('socket.io');
const http = require('http');
const fs = require('fs');
const filename = 'datos-sensores.txt';
const sensor1 = 7001;
const sensor2 = 7002;
const port = 7080;
var app = express();
app.use(express.static(__dirname+'/... | true |
8efcd5fce55863882e6f23bc53053f7ed3cef76e | JavaScript | drewminns/qqui | /src/scripts/app.js | UTF-8 | 6,371 | 3 | 3 | [] | no_license | let QQForm = React.createClass({
getInitialState() {
return {
value: 'atLeast'
}
},
update(e) {
e.preventDefault();
let theVal = {
selector: React.findDOMNode(this.refs.selectorName).value,
type: this.state.value,
amount: {
one: React.findDOMNode(this.refs.amountOne).value,
two: React.f... | true |
add03f90bcfb58480ed5d8c838f5542a7885f88a | JavaScript | Animesh033/Time-Sheets | /public/js/timesheet/help.js | UTF-8 | 361 | 2.609375 | 3 | [
"MIT"
] | permissive | var dString = new Date()
var d = new Date(dString.getTime() - (dString.getTimezoneOffset() * 60000 )).toISOString().split("T")[0]
spDate = d.split('-')
console.log(spDate)
/* Trigger on load or any where */
$('#datepicker-month').trigger('changeMonth');
$("#datepicker-month").datepicker('setDate', ... | true |
4afb6c71824507848b1b8535e83a46ecd483b01a | JavaScript | ErsanYashar/JavaScript-Advanced | /JS Advanced - Exams/Exam August 2019 !/01/scripts/app.js | UTF-8 | 2,532 | 3.109375 | 3 | [] | no_license | function solve() {
//Add Book select all neede elements
const addBtn = document.querySelector('form>button');
addBtn.addEventListener('click', addBook);
const [oldBook, newBook] = Array.from(document.querySelectorAll('div>section'));
let totalProfit = document.querySelectorAll('h1')[1];
let cost... | true |
380c077770845698462d2e83b4c04f4a70c49524 | JavaScript | ankitrajpr/JavaScriptWork | /Basics/boolean-advanced.js | UTF-8 | 535 | 3.40625 | 3 | [] | no_license | /* let isAccountLocked = false
if(isAccountLocked){
console.log('is Account locked')
}else{
console.log('Welocme!')
} */
//if-else-if statement
let isAccountLocked = false
let userRole = 'OK'
if (isAccountLocked) {
console.log('is Account locked')
} else if(userRole === 'Admin'){
console.log('Welocme Ad... | true |
8955cd27ccf15624aa81536e88102c19bb2cdc33 | JavaScript | MaciekPluta/CSS_Grid_Page | /js/main.js | UTF-8 | 3,219 | 2.734375 | 3 | [] | no_license | // Top Nav Code
$(".top__nav__hamburger").on("click", function(event){
event.preventDefault();
$(".ni_1").toggleClass("not__visible", 2000);
$(".ni_2").toggleClass("not__visible", 2000);
$(".ni_3").toggleClass("not__visible", 2000);
console.log("nav toggle");
});
// Body Code
$(document).ready(function() {... | true |
887421c09453a7b985c03bb9642407aeb7583929 | JavaScript | mundix34/e-commerce- | /src/components/User2.js | UTF-8 | 722 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
export default class User2 extends Component {
constructor() {
super();
this.state = {
user: [],
result: ''
};
}
componentDidMount() {
axios.get(`/api/user/${this.props.match.params.id}`).then(res => {
this... | true |
3c8bc973e2d0c075f0da6493189914ba4b1a4a97 | JavaScript | fajariadi-id/mini-projects-practice | /udemy-course/20-btnRippleEffect/app.js | UTF-8 | 770 | 3.40625 | 3 | [] | no_license | // *======= SELECTOR =======*
const ripples = document.querySelectorAll(".ripple");
// *======= EVENT LISTENER =======*
ripples.forEach((ripple) => {
ripple.addEventListener("click", function (e) {
const x = e.clientX;
const y = e.clientY;
console.log(x, y);
const btnTop = e.target.offsetTop;
co... | true |
8b31539b716df3ce1a8a2ca9a9f403566ce425d3 | JavaScript | DeyanParushev/MyStudentProjects | /JS/Advanced/DomManipulation/Excercise/LockedProfile/app.js | UTF-8 | 787 | 2.734375 | 3 | [] | no_license | function lockedProfile() {
let buttonElements = document.getElementsByTagName('button');
Array.from(buttonElements).forEach(element => {
element.addEventListener('click', (e) => {
if (e.target.tagName.toLowerCase() === 'button') {
let parentDiv = e.target.parentNode.children... | true |
d3279dc4b754aabb14191f2f992e6d2b234e6e25 | JavaScript | kwin555/JavaScirptPractice | /absentVowel.js | UTF-8 | 168 | 3.4375 | 3 | [] | no_license | function absentVowel(string){
var vowels = ['a','e','i','o','u'];
for(var i=0; i<vowels.length; i++) {
if(string.indexOf(vowels[i]) < 0)
return i;
}
}
| true |
7e4dbf91187d7010c921e39d752aba7778e02788 | JavaScript | patnir/client-starter | /src/containers/Home.js | UTF-8 | 1,234 | 2.71875 | 3 | [] | no_license | import React, { useState } from "react";
import "./Home.css";
import Form from "react-bootstrap/Form";
import Button from "react-bootstrap/Button";
export default function Home() {
const [fileContents, setFileContents] = useState(undefined);
function getFileContents(event) {
console.log("file contents");
... | true |
26a68fda8d69889888596b0de2bf3cba6946c2d3 | JavaScript | vvanghelue/vanilla-single-page-app-example | /lib/create-dom-element.js | UTF-8 | 249 | 2.71875 | 3 | [] | no_license | const createDomElement = function(html, onCreated) {
const element = new DOMParser().parseFromString(html, "text/html").body.firstChild
if (onCreated) {
onCreated(element)
}
return element
}
export default createDomElement | true |
ed7f88131dfaf453ea284b8873cf98f3adaf86be | JavaScript | danreeves/punkjam | /src/modules/copAttack.js | UTF-8 | 977 | 3.078125 | 3 | [] | no_license | var DAMAGE = 10, KNOCKBACK = 1000, KNOCKUP = 250;
module.exports = function copAttack (cop, player, emitter) {
var hit = false;
if (player.body.x < cop.body.x) {
// player is to the left
if (Math.abs(Math.floor(cop.body.x) - Math.floor(player.body.x) < 10)
&& Math.floor(cop.body.y... | true |
fc2d8a450305055486ae0bfdf050af467c6a34d1 | JavaScript | 18is/wt | /queue.js | UTF-8 | 740 | 3.625 | 4 | [] | no_license | class Queue
{
constructor()
{
this.items = [];
}
enqueue(x)
{
this.items.push(x);
}
dequeue()
{
if(this.isEmpty())
return "QUEUE UNDERFLOW";
return this.items.shift();
}
display()
{
var str = "";
for(var i = 0; i < this.items.length; i++)
... | true |
d5fec24e05a6df46a0e35a2cbb6c3cab59830ef2 | JavaScript | shifujun/newtest | /sign_util.js | UTF-8 | 429 | 2.5625 | 3 | [
"MIT"
] | permissive | const randomUuid = require('uuid/v4');
let sign = function (data, secretId, secretKey) {
data.secretId = secretId;
data.signTime = Date.now().toString();
data.signNonce = randomUuid();
data.signMethod = 'SHA256';
const content = Object.entries(data)
.push({secretKey: secretKey})
.m... | true |
f358609be4392b09895cb1eb5963e7e3d5881d34 | JavaScript | Soma1997/UserCard_assignment | /list/src/components/mylist/tolist.js | UTF-8 | 3,436 | 2.53125 | 3 | [] | no_license | import React ,{Component} from 'react';
import ItemModal from '../Modal/ModalFile';
import ItemUpdate from '../UpdateText/Update';
import '../mylist/tolist.css';
class ToList extends Component{
constructor(props){
super(props);
this.state={
Task:[],
values:'',
u... | true |
d7a42c6bf9cca7d4c4337e3d3e522a63a38d5ba8 | JavaScript | kevinreber/data-structures-algorithms | /47.11 - Sorting Algorithms/selection.js | UTF-8 | 1,265 | 4.40625 | 4 | [] | no_license | /**
* Here’s some guidance for how selection sort should work:
*
* - Assign the first element to be the smallest value (this is called the minimum).
* It does not matter right now if this actually the smallest value in the array.
* - Compare this item to the next item in the array until you find a smaller number... | true |
052143d8caebfc4c885486821db15374ee7f77a0 | JavaScript | Gridonyx/totally-random | /tests/errors.js | UTF-8 | 2,545 | 2.984375 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-undef */
const { expect } = require("chai");
const TotallyRandom = require("../dist/index.js");
const random = new TotallyRandom();
describe("TotallyRandom", () => {
describe("#array", () => {
it("should throw an error when Array length is less than count with unique=true", () => {
ex... | true |
74ad498c57e68cc4975f19768e40f6cafeaee79d | JavaScript | funky-tiger/Taro-TypeScript-Dva-MiniProgram-Template | /scripts/component.js | UTF-8 | 2,562 | 2.703125 | 3 | [] | no_license | /* eslint-disable indent */
/* eslint-disable import/no-commonjs */
/* create by tiger */
const fs = require("fs");
const dirName = process.argv[2];
const capPirName = dirName.substring(0, 1).toUpperCase() + dirName.substring(1);
if (!dirName) {
console.log("文件夹名称不能为空!");
console.log("示例:npm run com test");
... | true |
575bb710ae8a8d888a5d5a776a96ace19442a106 | JavaScript | Pariola-droid/JsCalculator | /Calculator/script.js | UTF-8 | 2,825 | 3.546875 | 4 | [] | no_license | function getHistory(){
return document.getElementById("history-value").innerText;
}
function printHistory(num){
document.getElementById("history-value").innerText=num;
}
function getOutput(){
return document.getElementById("output-value").innerText;
}
function printOutput(num){
if(num==""){
document.ge... | true |
e93c000e466a5b801d5e4aeaec9d7150caaa49b4 | JavaScript | vipullimbachiya/rn-sample-app | /src/screens/SampleForm/redux/reducer.js | UTF-8 | 904 | 2.671875 | 3 | [] | no_license | import * as actionTypes from './actionType';
const initialState = {
isLoading: false,
isSubmitted: false,
};
const submitFormReducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.SUBMIT_FORM_LOADING:
console.log('SUBMIT_FORM_LOADING>>>>');
return {
...stat... | true |
3bf4d1ff8fb1a2dccdedad7a4ae1ebed5917e23c | JavaScript | yjlim5/algorithms | /test/21.js | UTF-8 | 583 | 3.0625 | 3 | [] | no_license | let expect = require('chai').expect;
let solution = require('../solutions/21').solution;
// solution = require('../yourSolution').solution;
describe('Return 3 top largest values of an array in a descending order', () =>{
it('should return 3 top largest values of an array', () =>{
expect(solution([8,1,4,2,12,6,7,... | true |
647a07a85a0497dbb3596c1abd53ffe9fab4d5fa | JavaScript | MyNamesRaph/MyNamesRaph.github.io | /Programmation 1/exam/examFormatif/js/1/q9.js | UTF-8 | 789 | 2.75 | 3 | [] | no_license | var prix = 3;
var lines = 16;
var cols = 3;
var num = 0;
var revenu = 0;
document.writeln("####################<br>#Revenu des assistances#<br>####################<br><br>");
document.writeln("Nb de spectateurs Prix Billets Revenu<br><br>");
for (i = 0; i < lines; i++) {
revenu = num*prix;
if (num < ... | true |
9495d182d1724d9318b496824eafdecfe1a77a4e | JavaScript | tingaz-2nye/Students-management-system | /admin/js/subject.js | UTF-8 | 4,422 | 2.5625 | 3 | [] | no_license | $(document).ready(function(){
// Add Subject
$('#addSubject_form').on('submit', function(e){
e.preventDefault();
var subject_name = $('#subject_name').val();
var subject_code = $('#subject_code').val();
if(subject_name !='' && subject_code !=''){
$.ajax({
... | true |
dc19069097eee25d2b652cea83c194c40e1d94a6 | JavaScript | Emma0s/exercise_eloquent_javascript | /chapter2/FizzBuzz.js | UTF-8 | 412 | 4.1875 | 4 | [] | no_license | // 使用console.log打印出从1到100的所有数字;
// 当数能被3整除时,不打印数字,打印"Fizz";
// 当数能被5整除时,不打印数字,而打印"Buzz";
// 当数能被3与5同时整除时,打印"FizzBuzz"
for (var n = 1; n <= 100; n++) {
var output = "";
if (n % 3 == 0)
output += "Fizz";
if (n % 5 == 0)
output += "Buzz";
console.log(output || n);
}
| true |
db90bb724b31f67142d18e1ec7d2e179601e3b8e | JavaScript | naxan/AC-QR-Closet-FrontEnd | /ac-qr-closet/src/components/UploadImage/UploadImage.js | UTF-8 | 1,741 | 2.578125 | 3 | [] | no_license | import React from "react";
import { Button } from "semantic-ui-react";
import "./UploadImage.css";
const endpoint = "http://localhost:4000";
class UploadImage extends React.Component {
state = {
uploadedImage: null,
uploadedImageURL: null,
uploadStatus: null,
};
setDefaultImage() {
this.setStat... | true |
516608374b5394abfebf8c24f781f673dae41711 | JavaScript | rogerthat39/iss-tracker | /script.js | UTF-8 | 1,681 | 3.734375 | 4 | [] | no_license | //get json file from NASA API, return data and call gotData
function queryAPI() {
fetch("https://api.wheretheiss.at/v1/satellites/25544")
.then(r => {
return r.json()
})
.then(data => {
gotData(data)
updatePosition()
})
}
//what to do after the data has returned
function got... | true |