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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
aeb0983879d672577995b8a398e6e66816ad9cd8 | JavaScript | jfandata/YouTube-Data-Analytics-and-Visualization | /data_viz/static/js/old_js/line5.js | UTF-8 | 3,919 | 3.03125 | 3 | [] | no_license | // Define SVG area dimensions
var svgWidth = 960;
var svgHeight = 500;
// Define the chart's margins as an object
var margin = {
top: 60,
right: 60,
bottom: 60,
left: 60
};
// Define dimensions of the chart area
var chartWidth = svgWidth - margin.left - margin.right;
var chartHeight = svgHeight - margin.top -... | true |
08e924fc4e807b30f1ad7acace2128597cfc5fd1 | JavaScript | AntonyHatchet/react-starter-kit | /src/components/OSMap/OSMap.js | UTF-8 | 1,099 | 2.546875 | 3 | [
"MIT",
"CC-BY-4.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React from 'react';
var cords = [[51.508, -0.11],[52.508, -0.11],[53.508, -1.11],[43.508, -1.11]];
var point;
'use strict';
module.exports = React.createClass({
getInitialState: function () {
return {
map: {}
};
},
componentDidMount: function() {
var map = L.map('map').setView([52.505, -0... | true |
4bfb50819163d30bcf411f5ce31ad6671bb919b4 | JavaScript | merestrickland/Algorithm_Practice | /binary_search.js | UTF-8 | 1,583 | 4.46875 | 4 | [] | no_license | // const arr = [1,2,3,4,5,6]
// var secretNum = 5
// //find the lowest number
// var low = arr[0]
// //find the highest number
// var high = arr[arr.length-1]
// //find the mid number by adding the low and high, dividing it by 2, and then rounding it to the closest low integer using Math.floor(# to round down)
// var m... | true |
9ae781bfd43354fba87598209ae8a1a9871d7c7c | JavaScript | eqst/react_project_test | /02_src_redux/App.js | UTF-8 | 1,642 | 3.078125 | 3 | [] | no_license | import React,{Component} from 'react'
import {creatIncrementAction, creatDecrementAction } from "./redux/action_creators";
export default class App extends Component{
componentDidMount(){
console.log(this.props.store.count);
}
//创建加法函数
increment = () => {
let {value} = this.refs.selectNumber
this.... | true |
cd4631f8790eb30d6e39c9c5476b5f4a99d74652 | JavaScript | kenianbei/OpenJSCAD.org | /packages/utils/array-utils/src/toArray.test.js | UTF-8 | 456 | 2.75 | 3 | [
"MIT"
] | permissive | const test = require('ava')
const { toArray } = require('./index')
test('array-utils: toArray() should return arrays', (t) => {
let obs = toArray()
let exp = []
t.deepEqual(obs, exp)
obs = toArray(null)
exp = []
t.deepEqual(obs, exp)
obs = toArray(1)
exp = [1]
t.deepEqual(obs, exp)
obs = toArra... | true |
1054d5b6c19ee72ed055aae2d7aab7650d013e2a | JavaScript | YashiJha/Project_25_Crumpled_Balls_2 | /Paper.js | UTF-8 | 627 | 2.6875 | 3 | [] | no_license | class Paper{
constructor(x,y){
var options={
isStatic: false,
restitution: 0,
friction:0.5,
density:1.2
}
this.body=Bodies.circle(x,y,20,options);
this.image=loadImage("ppr.png");
this.image.scale=5;
World.add... | true |
49901af0428b0c972db71e19d5f0b79449d95dc4 | JavaScript | nulltu/MyTinerary-Travel | /frontend/src/redux/reducers/userReducer.js | UTF-8 | 728 | 2.78125 | 3 | [] | no_license | const initialState = {
photoProfile:'',
username: '',
token:''
}
const userReducer = (state=initialState, action) => {
switch (action.type){
case 'LOG_IN_APP':
localStorage.setItem('token', action.payload.token)
return{
...state,
p... | true |
01d80ca4f9a46dbb69a001d32b9402c0b0741b49 | JavaScript | 123vvishwakarma/JobSearch | /server/curdOperation/crud.js | UTF-8 | 1,935 | 2.625 | 3 | [] | no_license | // Function to insert document
exports.createCandidateProfile = function(schemaType, body, app, callBack){
console.log("inside :",body);
var dataToBeSaved = {};
dataToBeSaved.name = body.name;
dataToBeSaved.phoneNumber = body.phoneNumber;
dataToBeSaved.email = body.email;
dataToBeSaved.locationPreference = body... | true |
fe28e47876b08d246421cab486184b873328547a | JavaScript | gusgh911/react-habit | /src/components/example.jsx | UTF-8 | 408 | 2.765625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
const Example = (props) => {
const [count, setCout] = useState(1);
useEffect(() => {
document.title = `You clicked ${count} times`;
});
return (
<div>
<p>
You clicked {count} times
</p>
<button onClick={() => setCout(count ... | true |
5ac98274818e5d02b14f8f77c6dfe7ca4566e250 | JavaScript | nathanwerrede/cogs120 | /js/games.js | UTF-8 | 2,268 | 2.96875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | // Call this function when the page loads (the jQuery "ready" event)
$(document).ready(function() {
initializePage();
})
/*
* Function that is called when the document is ready.
*/
function initializePage() {
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
var parentDi... | true |
d9eb5b1589199a53fdfbb682ea9da2e01db0088c | JavaScript | utsavPatel4152/Utsav | /3_Jan/script2.js | UTF-8 | 449 | 3.234375 | 3 | [] | no_license | var avgJohn = (89+120+103)/3;
var avgMike = (89+120+180)/3;
var avgMary = (89+120+200)/3;
if(avgJohn > avgMike && avgJohn > avgMary)
{
console.log("John is Winner, Average is "+avgJohn);
}
else if(avgMike > avgJohn && avgMike > avgMary)
{
console.log("Mike is Winner, Average is "+avgMike);
}
else if(avgMary > ... | true |
bbac7c5009dc0550d48647d3354a20326c125116 | JavaScript | ekazakov/eslgaber | /test.js | UTF-8 | 447 | 3.15625 | 3 | [] | no_license | const out = process.stdout;
let n = 0;
const print = (n) => {
//process.stdout.write("line " + n + "%\n" + "line " + n + "%\nline " + n + "%\n");
console.log("line " + n + "%\n");
console.log("line " + n + "%");
console.log("line " + n + "%");
}
print(n++);
const handler = setInterval(() => {
out... | true |
892f14f084eeaa8b567cbb4e6d8593fcbab96615 | JavaScript | RadostinKostadinov/JS_Fundamentals_softuni | /MidExam/myExam/listManipulator.js | UTF-8 | 1,879 | 3.359375 | 3 | [] | no_license | function listManipulator(array){
let myArr = array.slice();
let namesList = myArr.shift();
namesList = namesList.split(', ');
let blacklisted = 0;
let lost = 0;
while(myArr.length > 0){
let operatingArr = myArr.shift();
operatingArr = operatingArr.split(' ');
switch(oper... | true |
41b14cf126d8585bdf71e7ecae66007054ad22f9 | JavaScript | jeonghwan-kim/lecture-making-express | /public/js/index.js | UTF-8 | 2,070 | 2.78125 | 3 | [] | no_license | import {post} from './script.js'
const tag = '[index.js]'
const onload = () => {
console.log(tag, 'DOMContentLoaded')
post.list(1).
then(data => {
renderPosts(data.list)
renderPagination(data.pagination)
}).
catch(err => {
console.log(err)
})
}
const renderPosts = data => {
co... | true |
615d67284885b7267fb5447e8aefd3b6f441397b | JavaScript | daniagung/HeartRate-Monitor | /JS/Detection.js | UTF-8 | 3,694 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | /**
* Created by maakbar on 8/3/2016.
*/
const HEART_MAX_CONST = 220;
/* http://www.livescience.com/42081-normal-heart-rate.html */
const R_BUFFER_SIZE = 4;
const SAMPLING_SPEED = 3; // milli second
/* Jun Liu, Yaqi Zhou; Design of a novel portable ECG monitor for heart health; 2013 */
var PanTomkins = require('./P_... | true |
8a7ca7ae4415530da5867c67681cfbaf0c27cee6 | JavaScript | travishewitt/assignments | /exercises/duplicates_mocha_warmup/test/test.js | UTF-8 | 959 | 2.796875 | 3 | [] | no_license | let chai = require("chai");
let assert = chai.assert;
let duplicates = require("../js/app.js")
let testExamples = {
noDupes: "i am not a robot",
allDupes: "i i am am not not a a robot robot",
someDupes: "i am am not a a robot",
fuckDupes: "i am not am not am not a robot am not a robot"
}
describe("te... | true |
8ec9ea80ba11c6d315631645d0562c183b4884be | JavaScript | pputra/jquery-plugin | /lib/email-validator.js | UTF-8 | 758 | 2.90625 | 3 | [] | no_license | function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
$(document).ready(function() {
$('<div class="error-message">email is invalid</d... | true |
bc62410a129481bece0a6211babac1786c53a3f9 | JavaScript | CourtneeM/TOP | /Remade Projects/todo_list/src/modules/display_controller/projects.js | UTF-8 | 5,994 | 2.65625 | 3 | [] | no_license | import '../../styles/projects_container/style.css';
const projectsContainer = (() => {
const projectsContainer = document.createElement('section');
const projectsListContainer = document.createElement('div');
projectsContainer.id = 'projects-container';
projectsListContainer.id = 'projects-list-container';
... | true |
d97c7ae28e8a56a9ee256b47cf32f6ca572bad18 | JavaScript | vasyl-kruk/ui | /src/layout/Content/content.util.js | UTF-8 | 460 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | export const generateGroupedItems = (
content,
selectedRowData,
getIdentifier
) => {
const groupedItems = {}
content.forEach(contentItem => {
const identifier = getIdentifier(contentItem)
if (selectedRowData?.[identifier]?.content) {
groupedItems[identifier] = selectedRowData[identifier]?.cont... | true |
efb295fcfe19e92d5afe93fc2dac8b9e785e7fc4 | JavaScript | fahimShahriaar/hungry-monster | /script.js | UTF-8 | 4,810 | 3.359375 | 3 | [] | no_license | function displayMealList() {
document.getElementById('search-btn').addEventListener('click', function () {
// clearing previous display value
document.getElementById('selected-meal-div').innerText = '';
document.getElementById('meal-details-div').innerText = '';
// displayMealList()... | true |
0e5a90cad4127855b56d41952d647227bf05a3dc | JavaScript | uverpro/JavaTUT | /App-Academy/W3/W3D3/W3D3-Lecture.js | UTF-8 | 552 | 4.5625 | 5 | [] | no_license | // Immediately evoked function syntax
(function () {
console.log('Run me');
})();
// Anonymous functions written above can only be ran once!
// Doesn't exist outside of this scope
let result = (function () {
return "Party!";
})();
console.log(result);
// Evoking the return value of the function, not the fu... | true |
8b3f113d7640b2f9caa04f02cc0b0f427eddad6c | JavaScript | yjeong19/giphy_search | /logic.js | UTF-8 | 3,163 | 3.28125 | 3 | [] | no_license | var topics =["The Hangover", "Anchorman", "Step Brothers", "Baby Driver", "Superbad", "The Empire Strikes Back"]
//creates the button initially
for (var i = 0; i < topics.length; i++){
$('#buttonSpot').append(
$('<button class="buttons" data-name="' + topics[i] + '">').text(topics[i])
);
}
//creates button fu... | true |
560baec1daa2127b9b8cd20747e3f892f4d662a9 | JavaScript | packethost/packet-nodejs | /lib/resources/user/index.js | UTF-8 | 625 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | (function() {
'use strict';
module.exports = function(Packet) {
Packet.prototype.getUser = function(callback) {
var path = getProfileUrl();
this._get(path, {}, function(err, body) {
callback(err, body);
});
};
Packet.prototype.updateC... | true |
d8cf9f6a3bccf59b9959b7ed6b486affaab0d462 | JavaScript | Shripad03/first-react-project | /App.js | UTF-8 | 3,084 | 3.5 | 4 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Person from './Person/Person'
import person from './Person/Person';
class App extends Component{
state={ //with state object you create initial state
persons:[
{id:1,name:'Allan',age:22},
{id:2,name:'David',age:32},
{id:3,name:... | true |
1a6bf77c7b454dcd87324e6bf2427866fb5c3ca5 | JavaScript | acanida0623/Donutshop | /donutshop.js | UTF-8 | 1,311 | 3.296875 | 3 | [] | no_license | function DonutShop (location,minCustomers,maxCustomers,avgDonuts) {
this.location = location;
this.minCustomers = minCustomers;
this.maxCustomers = maxCustomers;
this.avgDonuts = avgDonuts;
this.calcDonuts = function() {
var hoursOpen = prompt("How many hours is the " + this.location + " shop open?");
... | true |
4c0828a630acd587d6b74820e91293dbd6dac64d | JavaScript | scottdmccord/Home-Cookin- | /src/components/UpcomingMealItem/UpcomingMealItem.jsx | UTF-8 | 714 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import './UpcomingMealItem.css';
function cleanDate(x) {
let y = x.slice(0, 10);
return y;
}
const UpcomingMealItem = props => (
<div className="UpcomingMealItem">
<h2 className="meal-heading"> Cuisine: {props.cuisine} </h2>
<p className="row-odd"> Ingredients: ... | true |
18ed59b1cff39668bcd9baa0fb7fcda21f99cf03 | JavaScript | vivekmaru/Tic-Tac-Toe | /app.js | UTF-8 | 282 | 3.203125 | 3 | [] | no_license | const board = document.querySelector('.container');
const cells = [...board.querySelectorAll('.cell')];
function updateBoard(e) {
if(e.target.className === 'cell') {
e.target.textContent = 'X';
}
}
board.addEventListener('click', updateBoard);
//console.log(cells); | true |
f56f1452374bc0f64fec60df6746fb4022c8485a | JavaScript | EzioReturner/js-assembly | /leetcode/findKthToTail.js | UTF-8 | 238 | 3.625 | 4 | [] | no_license | // 输入一个链表,输出该链表中倒数第k个结点。
function FindKthToTail(head, k) {
let arr = [];
let _head = head;
while (_head) {
arr.push(_head);
_head = _head.next;
}
return arr[arr.length - k];
}
| true |
8d110a47270bd0a44287bdae4ce3813c5d792b84 | JavaScript | cpclark360/example1 | /src/App.js | UTF-8 | 4,088 | 3.09375 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Header from './components/Header';
import Player from './components/Player';
import Addplayer from './components/Addplayer';
// const code = 'src/App.js';
// function App() {
// return (
// <div className="App">
/... | true |
49b8b3b4070cfdf11c1dfbb58ff3c5486605cfcc | JavaScript | maciejblinkbox/cucumber-js | /lib/cucumber/ast/feature.js | UTF-8 | 2,550 | 2.703125 | 3 | [
"MIT"
] | permissive | var Feature = function(keyword, name, description, uri, line) {
var Cucumber = require('../../cucumber');
var background;
var scenarios = Cucumber.Type.Collection();
var tags = [];
var self = {
getKeyword: function getKeyword() {
return keyword;
},
getName: function getName() {
... | true |
542602bea03ad208eea5417a4b318cac2902b28c | JavaScript | hoeck/vecks | /lib/Line2.js | UTF-8 | 3,956 | 2.625 | 3 | [] | no_license | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototy... | true |
ce0db75ebf8cc5d8039390b9933c6b8bc85c97e9 | JavaScript | Rivoc/vue-node-moba | /server/models/Hero.js | UTF-8 | 1,643 | 2.515625 | 3 | [
"MIT"
] | permissive | //定义Hero模型
const mongoose = require('mongoose')
const schema = new mongoose.Schema({
name: { type: String },
//数据库不是直接保存图片(一个图片几兆),而是将图片上传到一个地址,数据库保存的是图片的地址
avatar: { type: String },
//英雄称号
title: { type: String },
banner: { type: String },
//一个英雄可能关联多个分类
//ref:关联的模型的名称
categories: [{ type: mongoose.S... | true |
8107205def5531f588671c761e87d8b8d90aa505 | JavaScript | grahamosh/WebDev | /arrays.js | UTF-8 | 534 | 3.8125 | 4 | [
"MIT"
] | permissive | var myarr = ["one", "two", "three"];
var myarr2 = [1, 2, 3, 4];
function arrayInfo (element, index, array) {
console.log("element is: " + element + " index is: " + index, "array is: " + array);
}
myarr.forEach(arrayInfo);
function printReverse(arrparam) {
for (var i=myarr.length -1; i>=0; i--) {
conso... | true |
819d8505223da328e83df29df5eb8479b4ef46fa | JavaScript | nathancyam/anime-app-frontend | /app/modules/Episode/reducer.js | UTF-8 | 602 | 2.578125 | 3 | [] | no_license | import Immutable from 'immutable';
import {
RECEIVED_EPISODES,
RECEIVED_ALL_EPISODES
} from './actions';
/**
* @param {Object} state
* @param {Object} action
*/
export default function reducer(state = Immutable.Map(), action) {
let episodes = {};
switch (action.type) {
case RECEIVED_EPISODES:
epi... | true |
1ffb1c6da7918c434dd07938fc02de0b9b9d9e67 | JavaScript | frivizn/accountant-website-template | /js/main.js | UTF-8 | 292 | 2.75 | 3 | [
"MIT"
] | permissive | const navbarToggler = document.querySelector(".bars");
navbarToggler.addEventListener("click", barsClick);
function barsClick() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
| true |
1f005f9becba5c784cd24b98332faf49bf7cfd80 | JavaScript | Biskabos/My_first_java_script_project | /public/js/project.js | UTF-8 | 4,151 | 2.78125 | 3 | [] | no_license | /* JS - Прогноз погоды от Biskabos-weather.ru. */
/* Мой список городов */
// Каменск-Уральский = id: 1504826
// Москва = id: 524894
// Киев = id: 703448
// Нью-Йорк = id: 5128638
/* Open Weather Map */
// Мой ID = 4b085ecf3e1036bccb0d57d80886d045
// Ссылка на API =http://api.openweathermap.org/data/2.5/forecast?id=5... | true |
55bbf3a435e0f381cdca953fa397afbc0c881cf5 | JavaScript | iadwait/Javascript-Tutorials | /Javascript/tut17.js | UTF-8 | 1,119 | 3.8125 | 4 | [] | no_license | // Tutorial 17 - Events & Event Object
console.log('Events');
// Click Event
document.getElementById('heading').addEventListener('click',function(e){
console.log('Insane Programmer tapped');
let data;
// e is the Even Object that function provides us the Details about the Even Occurred as a Callback
c... | true |
e26ec915e410d86e28f2b6362abbf9a40a5caf87 | JavaScript | helllostar/moving-pixel-perfect-typo | /dist/js/moving-pixel-perfect-typo.js | UTF-8 | 35,644 | 2.859375 | 3 | [] | no_license | /**
* Moving Pixel Perfect Typo v1.0.0 - Design workshop. Helllostar is backed by the Bangladesh University of Business and Technology (BUBT).
* @link https://helllostar.github.io/moving-pixel-perfect-typo
* @copyright 2015-2016 Zafree
* @license MIT
*/
// Reference Javascript Porter Stemmer. This code corresponds... | true |
f56bb938bf30896870d485b0d4c210508bb8939a | JavaScript | Barmor96/Clase_5 | /Ejemplo1.js | UTF-8 | 140 | 2.546875 | 3 | [] | no_license | let hambre = parseFloat("1");
if (hambre) {
console.log("Estoy feliz :)");
}else{
console.log("Dame alimento goe :'v");
} | true |
0faf6a5849d543730ae423c665ea7688ed508a42 | JavaScript | iBreadInside/Fadeev_Avto-Moto | /project/src/components/modal/modal.jsx | UTF-8 | 6,380 | 2.5625 | 3 | [] | no_license | import React, { Fragment, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import { LocalStorageKey, STARS_IDS } from '../../const';
import styles from './modal.module.scss';
const CLOSE_KEYBORD_BTN = 'Escape';
export default function Modal({onClose, onFormSubmit}) {
const [fields, se... | true |
6059983ef9d67e52290f86171776570d96566153 | JavaScript | SimplyAhmazing/pomo-together | /modules/clock.js | UTF-8 | 762 | 2.953125 | 3 | [] | no_license | var util = require('util');
var EventEmitter = require('events').EventEmitter;
var pomoTimes = [25, 5, 15];
var currentCountDown = null;
var currentIndex = 0;
function getCountDown(){
var time = pomoTimes[currentIndex % pomoTimes.length];
currentIndex += 1;
return time;
}
function Clock (){};
util.inh... | true |
bede9eba3e94f5246e15a1bc716a12b3d5e1b785 | JavaScript | Axioma42/Data_Analytics_Boot_Camp | /Week 14 - Intro-To-JavaScript/3/Activities/02-Stu_D3_Select/Solved/static/js/app.js | UTF-8 | 589 | 3.546875 | 4 | [] | no_license | // The new student and grade to add to the table
var newGrade = ["Wash", 79];
// Use D3 to select the table
var table = d3.select("table");
// Use d3 to create a bootstrap striped table
// http://getbootstrap.com/docs/3.3/css/#tables-striped
table.attr("class", "table table-striped");
// Use D3 to select the table b... | true |
c8f9a12037028a6b9cedfafaf032b7a95117f70f | JavaScript | tonioblack/javascriptOOPratices | /src/superSimpleFunctionPattern.js | UTF-8 | 736 | 2.90625 | 3 | [] | no_license | /*globals myNamespace, console*/
(function () {
'use strict';
myNamespace.SuperSimpleFunction = function () {
var self = this,
myPrivateVar = "hi everybody!",
myPrivateMethod,
myPublicMethodOne,
myPublicMethodTwo;
myPrivateMethod = function () {
... | true |
c360511323192d754e6906a3afdf1b4ee06ba35d | JavaScript | Tyki/javascript_exercices | /JSDOC_Example/src/module.js | UTF-8 | 1,096 | 3.109375 | 3 | [] | no_license | /**
* Description of my First module
*
* @namespace
* @author Baptiste Leulliette
*/
var monModule1 = (function () {
/**
* privateMethod is meant to be called from publicMethod
* <br>This method is shown in doc only with -p when generating the documentation
*
* @private
* @memberOf mo... | true |
de4028c38e5949648ad89cd5a80c063bc08f5b3e | JavaScript | gutihi85/homework-3 | /Assets/js/script.js | UTF-8 | 1,429 | 3.671875 | 4 | [] | no_license | // on click of the button
// reach into the html and grab the button
var generateBtn = document.querySelector("#generate");
// add an event listener
generateBtn.addEventListener("click", function() {
// prompt for length
var length = prompt('Enter desired length between 8-128 characters.')
// prompt for lowerc... | true |
7aecfb7466e1abf175a996d6a39d904a49e3bc58 | JavaScript | rangerman555/Taki | /src/components/statistics.jsx | UTF-8 | 4,569 | 2.75 | 3 | [] | no_license | import React from "react";
import ReactDOM from 'react-dom';
let StatisticsStyle = {
float: "left",
marginLeft: 20
}
export default class Statistics extends React.Component {
constructor(props) {
super(props);
}
checkIfPlayerWon() {
let playerWon = false;
for (let i = 0; i... | true |
fec1ef5678da9a000784f8f07409d8efa1b8a6d4 | JavaScript | amankaushik96/React-Projects | /jsx/src/index.js | UTF-8 | 656 | 2.875 | 3 | [] | no_license | // import the react and reactDOM libraries
import React from 'react';
import ReactDOM from 'react-dom';
// create a react component
const App = ()=>{
const buttonText = {text:"Submit"};
return <div>
<label className="label" htmlFor="name" >Enter name:</label>
<input id="name" type="text... | true |
690a603ad680ec4d0488e2d940939704615976f6 | JavaScript | WeshGuillaume/vim-graphiql | /javascript/index.js | UTF-8 | 2,250 | 2.875 | 3 | [] | no_license | const program = require('commander')
const fetch = require('axios')
const GET_SCHEMA_QUERY = `
{
__schema {
types {
name
fields {
name
args {
name
description
defaultValue
}
type {
kind
ofType {
ofType {
... | true |
3bdf3d468a0ce420a7274cdf49561bd5a41407f7 | JavaScript | monareijneke/testing | /BigArrays/meeste.js | UTF-8 | 727 | 3.453125 | 3 | [] | no_license | /// !!!MEESTE MENSEN 3 punter!!!
//filter
const counts = {};
const addLandenToDom = (array) => {
array.forEach((aantal) => {
counts[aantal] = (counts[aantal] || 0) + 1;
const newLi = document.createElement("li");
newLi.innerHTML = counts;
newParent.appendChild(newLi);
});
console.log... | true |
ce8ecd9ad046c8936eda8f12a5bce0b8b5a2aa99 | JavaScript | m0n01d/modsinbio | /api/login.js | UTF-8 | 1,056 | 2.515625 | 3 | [] | no_license | const { User } = require('../db/schema');
const sendEmail = require('./_sendEmail');
module.exports = login;
function login(req, res) {
const { email } = req.body;
if (!email) {
return res.status(404).send();
}
return loginOrCreate(email)
.then(getJwt)
.then(jwt => {
return sendAuthEmail({... | true |
9bf984d385c27213a48d6c03f0b3345b17d50216 | JavaScript | JavaPr288/DataStructures | /src/arrays.js | UTF-8 | 493 | 3.375 | 3 | [] | no_license | const { names } = require("debug");
const name=['Max','Manu','Julie','Max'];
console.log(name[1]);
console.log(name.length)
//iteratable
for(const el of name){
console.log(el)
}
name.push('Julie')
console.log(name.length)
// how much space was allocated
//find an element
const julieIndex=name.findIndex (el=> e... | true |
45b9a996293fbe18b4bca6201311f6313b4d57a3 | JavaScript | yasmine-hj/fewpjs-js-fundamentals-arithmetic-lab-online-web-ft-100719 | /index.js | UTF-8 | 193 | 2.671875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
// Write your code here
const num1 = 2
const num2 = 31
const multiply = num1 * num2
const random = Math.floor(Math.random())+100;
const mod = 40%9
const max = Math.max(1, 2, 20, 9, 0, 18);
| true |
a3a70dfba2bd5591c8f36f19871f7ed691657893 | JavaScript | vanessaconti/react-forms-codealong-part-1 | /src/App.js | UTF-8 | 1,224 | 3.125 | 3 | [] | no_license | import React from "react";
import emojify from "./emojify";
class App extends React.Component {
constructor() {
super();
this.state = {
userInput: '',
feature: 'reverse',
};
}
handleInputChange = (event) => {
// change our state to reflect what the user has typed in
this.setState... | true |
c913a8654414e70573ecf102e102e971cf638b10 | JavaScript | gajendra14695/coreJava | /javascript/ES6/ES6.js | UTF-8 | 1,496 | 3.40625 | 3 | [] | no_license | const message= new Promise(function(resolve,reject){
if(30<20){
resolve([{
name:'gajendra ',
age:27,
},
{
name:'Shikha Sholki',
age:21,
},
{name:'Nisha Rajput ',
age:21,
} ,
{name:'Ritu Rajput',
... | true |
69abebaef770700b2b98182811e32dab9df42963 | JavaScript | Savchhenko/PracticeJS-MediaPortal | /scripts/videoPlayer.js | UTF-8 | 1,097 | 2.875 | 3 | [] | no_license | export const videoPlayerInit = () => {
// video-player;
// video-button__play;
// video-button__stop;
// video-time__passed;
// video-progress;
// video-time__total;
const videoPlayer = document.querySelector("video-player");
const videoButtonPlay = document.querySelector("video-button__play");
const videoBut... | true |
b539cd55f28deb07a71335f3218a2f6eec95c85a | JavaScript | rmorgan323/swapi-box | /src/helper/apiCalls.test.js | UTF-8 | 2,446 | 2.703125 | 3 | [] | no_license | import { getCharacters, getWorlds, getVehicles, getFilmCrawl } from './apiCalls';
import { mockPlanetApiResponse, mockVehicleApiResponse, mockPeopleApiResponse }
from './__mocks__/mockApiResponse';
describe('fetch characters tests', () => {
beforeEach(() => {
window.fetch =
jest.fn().mockImplementation... | true |
ab202cdfedbc4e3c217d45b2fae1945d32cf9fb5 | JavaScript | daniel-turner/Challenge-Rotate-Matrix | /MatrixRotator.js | UTF-8 | 2,060 | 3.515625 | 4 | [] | no_license | /* MatrixRotator(matrix)
*
* @param matrix a multidimensional array containing the matrix
*
* @public property matrix the matrix
*
* @public method rotate(direction) direction is either
* Direction.CW or Direction.CWW
* @re... | true |
697240a7caf50c8594b13c44264b20940e5b94f0 | JavaScript | cprieto64/apirestnode | /node_mysql/app.js | UTF-8 | 2,720 | 2.734375 | 3 | [] | no_license | const express = require('express');
const mysql = require('mysql');
const bodyParser = require('body-parser');
const PORT = process.env.PORT || 3050;
const app = express();
app.use(bodyParser.json());
// MySql
const connection = mysql.createConnection({
host: 'us-cdbr-east-02.cleardb.com',
user: ... | true |
681e908037cfe6ae55c16f101519367eb43577bd | JavaScript | Vizzuality/GlobalFishingWatch | /app/src/areasOfInterest/areasOfInterestReducer.js | UTF-8 | 2,487 | 2.53125 | 3 | [
"MIT"
] | permissive | import {
SAVE_AREA_OF_INTEREST,
UPDATE_AREA_OF_INTEREST,
UPDATE_WORKING_AREA_OF_INTEREST,
TOGGLE_AREA_OF_INTEREST_VISIBILITY,
SET_RECENTLY_CREATED_AREA_OF_INTEREST,
SET_EDIT_AREA_INDEX,
DELETE_AREA_OF_INTEREST
} from 'areasOfInterest/areasOfInterestActions';
import { COLORS } from 'config';
const initial... | true |
f2049191819da8416ea90e9f44cd694a624b36fd | JavaScript | atom-archive/tree-sitter-syntax | /languages/bash/related-tokens.js | UTF-8 | 1,966 | 2.6875 | 3 | [
"MIT"
] | permissive | const {closest, findAll, getText, getChild} = require('../../lib/node-helpers');
module.exports =
function(node, buffer, rootNode) {
switch (node.type) {
case 'variable_name': {
return getVariableUsages(node, buffer, rootNode)
}
case 'if':
case 'then':
case 'else':
case 'fi': {
c... | true |
a0e653f67bb021c3f2ea776c6d7b1f79e6b8e615 | JavaScript | zhuohang-liu/covid19-forecast-bench | /frontend/src/evaluation/rankingTable.js | UTF-8 | 1,692 | 2.53125 | 3 | [] | no_license |
import React, { Component } from "react";
import { Table, Tag } from "antd";
const rankingTable = props => {
const { data, addMethod } = props;
const columns = [
{
title: "Method Name",
dataIndex: "methodName",
sorter: (a, b) => a.methodName < b.methodName,
sortDirections: ["ascend", ... | true |
1cad61222a377876d1e2dd5d67495983698971f6 | JavaScript | yemartin/onecheckbox | /storage.js | UTF-8 | 3,887 | 3.265625 | 3 | [
"MIT"
] | permissive | /*
Space-efficient storage of the state of our checkboxes.
Data format:
{
notebook + year: {
month + day: statesString
}
}
The statesString is a comma-separated string of values, the position is the
index of the homework item, and the value's bits represent the state of
the checkboxes as... | true |
83f5620d5f18a49502038713a1012fe83a94deb1 | JavaScript | IrinaIv/frontend-task | /JS/task2.js | UTF-8 | 1,195 | 3.953125 | 4 | [] | no_license | /* При необходимости проверки определенных видов скобок необходимо удалить
из массивов (openingBrackets, closingBrackets) и ассоциативного массива (brackets) ненужные */
function checkSyntax(string) {
var openingBrackets = ['{', '[', '(', '<'];
var closingBrackets = ['}', ']', ')', '>'];
var bracketsStack =... | true |
c9a3572a4c0f82b97bcbb473dd7f9f1f508e866c | JavaScript | Necmttn/Project-Euler-Javascript-Algorithm | /02-Even-Fibonacci-numbers/app.js | UTF-8 | 413 | 4.59375 | 5 | [] | no_license |
// Start with first 2 term and a variable to track the sum
var a = 1;
var b = 1;
var sum = 0;
// Loop while it's lower than 4 million
while (a < 4000000){
// if a is even, add it to the sum
if (a % 2 == 0){
sum += a
}
// Create a new variable "c" that holds the sum of a and b
// then finally update a and b a... | true |
60f89e8daa24f5908fcf53a1f94fa48927fd001f | JavaScript | rymo90/Markdown_previewer | /src/App.js | UTF-8 | 1,054 | 2.765625 | 3 | [] | no_license | import React from 'react';
import './App.css';
import Markdown from 'react-markdown'
const name = "Redwan";
const text = `Hello There Obi Wan konobi!
how are you to day
i'm fine and you
what 's you name my name is ${name}'
`
class App extends React.Component{
constructor(props){
super(props);
this.ha... | true |
a572d0e5db0959490e03e0f2d0d9be49a1c7e89e | JavaScript | JanettaH/FullStackOpen2019 | /osa2/maat/src/components/countries.jsx | UTF-8 | 914 | 2.84375 | 3 | [] | no_license | import React from 'react';
import Details from './details'
const Countries = ({countryList, filter, showDetails}) => {
const getDetails = (name) => () => {
showDetails(name);
}
var filtered = countryList.filter(country => country.name.toLowerCase().includes(filter.toLowerCase()))
if(filtered.l... | true |
6c30e3edacaa84e8afc06c702fd415d86a435ce9 | JavaScript | secaidastudio/codingTests | /exercises/exercise5.js | UTF-8 | 294 | 3.796875 | 4 | [] | no_license | /*How much X% of X number is?
example = how much is the 20% of 100? - return 20
*/
function percentage(percentage, number) {
let operation = (number * (percentage / 100));
let result = `The ${percentage}% of ${number} is: ${operation}`;
console.log(result);
}
percentage(5, 1000); | true |
aa9a02ef2f96428d650cde0b779ddfea28e7b76c | JavaScript | oyeleyeoyediran/JavaScriptAssignment | /Java1/Ass.js | UTF-8 | 365 | 3.1875 | 3 | [] | no_license | var doctor = {
lastName :"Ajanlekoko",
firstName : "Yakubu",
age : 54,
address : "Ranvir street",
email : "jibola @ gmail.com",
initialMethod:function(){
return this. lastName + " " + this. firstName
},
finalMethod:function(){
return this.age +5
}
}
console.log(doc... | true |
a2b192e28f1614bc0c66276c4f6fc54f7abc9460 | JavaScript | Cienszki/zad-14.4 | /script.js | UTF-8 | 1,983 | 2.859375 | 3 | [] | no_license | var movies = [
{
id: 1,
title: 'Film o pszczołach',
desc: 'Taki film że są pszczoły',
img: 'bee.jpg'
},
{
id: 2,
title: 'Bambo',
desc: 'Obywatel Kamerunu ratuje wioske przed zdziczałym jeleniem',
img: 'bambo.jpg'
},
{
id: 3,
... | true |
3f815d673689b5f731e9af5a9a5aa16636b3a0f1 | JavaScript | artikedar/Finally | /validateFilm.js | UTF-8 | 2,464 | 3.125 | 3 | [] | no_license | function titleValidation(){
var filmTilte=createfilm.filmTilte.value;
var letters = /^[A-Za-z]+$/;
if(filmTilte.match(letters)){
document.getElementById("titleErr").innerHTML="";
return true;
}
else{
document.getElementById("titleErr").innerHTML="*Please Enter a Title Starting with an Alphabet";
f... | true |
3d9c54226df15014c58107c7b6896489ba3b4e0d | JavaScript | weskerhluffy/web2negro | /src/main/webapp/scripts/mensaje-ingles.js | UTF-8 | 395 | 2.78125 | 3 | [] | no_license | jQuery(document).ready(function() {
eliminarErroresEnInglesStruts();
});
function eliminarErroresEnInglesStruts() {
var contenido = "";
$("span").each(function(index, item) {
contenido = $(item).text();
// console.log("El item es " + contenido);
if (contenido.match(/field/)) {
// $(item).attr("style","disp... | true |
fa3176a26f9a2105940b84d0b916857570969700 | JavaScript | vitaliiU/node_JWT | /src/common/log.js | UTF-8 | 1,369 | 2.515625 | 3 | [] | no_license | const winston = require('../../config/winston');
module.exports.logging = async req => {
const { query, method, body } = req;
const urlLoc = `${req.protocol}://${req.get('host')}${req.originalUrl}`;
const bodyLoc = {};
const promise = new Promise(resolve => {
for (const property in body) {
if (proper... | true |
250ad7213e24156a06f3a5682055a17d739263a0 | JavaScript | Gilly8070/Budget-calculator-2 | /script.js | UTF-8 | 4,076 | 3.03125 | 3 | [] | no_license | let budgetController = (function() {
let Expense = function(id, description, value) {
this.id = id;
this.description = description;
this.value = value;
};
let Income = function (id, description, value) {
this.id = id;
this.description = description;
this.val... | true |
bd9cbf75acfcae2512859ae9f29392a1f4e60989 | JavaScript | Tamal50/Photography-Client | /src/component/Dashboard/Layout/Sidebar/ProductList/ProductList.js | UTF-8 | 1,060 | 2.609375 | 3 | [] | no_license | import React, { useState } from 'react';
import { useEffect } from 'react';
import Layout from '../../Layout';
const ProductList = () => {
const [product, setProduct] = useState([]);
useEffect(()=>{
fetch('https://picsmania0.herokuapp.com/products')
.then(res => res.json())
.then(data ... | true |
b27fc4050cc921724f70e597cc3c0692493c8e7d | JavaScript | isbjornar/timer-app | /timer.js | UTF-8 | 1,123 | 3.09375 | 3 | [] | no_license | class Timer {
constructor(d, s, p, c, r = 10) {
this.durationInput = d;
this.startButton = s;
this.pauseButton = p;
this.timerResolution = r;
if (c) {
this.onStart = c.onStart;
this.onTick = c.onTick;
this.onComplete = c.onComplete;
}
this.startButton.addEventListener("cl... | true |
ad4ddd435e7c1cc0f3805cba5377592f59460338 | JavaScript | RianaFerreira/wdi_sydney_2_hw | /w06/d01/riana/js/currency.js | UTF-8 | 1,111 | 4.71875 | 5 | [] | no_license | /*
Objectives:
create and use variables
create and use functions
Find the exchange rate between dollars and pounds
Store the exchange rate in a variable
Converting dollars to pounds:
Store a dollar amount into a variable.
Convert it to pounds and output "$NN is £NN".
Converting pounds to dollars:
Now store a pound ... | true |
ff64dc64cb299a8f9621d9bd283089538accaabd | JavaScript | zxk-github/zufeng | /node/13.stream/3.write.js | UTF-8 | 359 | 2.90625 | 3 | [] | no_license | const fs = require('fs');
const ws = fs.createWriteStream('./demo1.txt', {
highWaterMark: 3
})
let n = 9;
function write() {
let flag = true;
while(flag && n > 0 ) {
flag = ws.write(n+'');
n= n - 1;
console.log(flag);
}
ws.once('drain', () => {
console.log('drain');... | true |
6643e6f7ae597c50766f38e3eaee4b7328006555 | JavaScript | jspfei/jsencrypt | /js-base64/test.js | UTF-8 | 277 | 2.640625 | 3 | [] | no_license | // npm install --save js-base64
require("./base64")
console.log("----------base64加密解密---------------------")
//加密
var str = Base64.encode("ssssssssfffssf")
console.log("Base64 encode: "+str)
//解密
str = Base64.decode(str);
console.log("Base64 decode: "+str)
| true |
a7f24098b9af51d666901f68eda3a289d021f85e | JavaScript | Wolfan8or/Wolfan8or.github.io | /SoundGiOh/js/scripts.js | UTF-8 | 146 | 2.703125 | 3 | [
"MIT"
] | permissive | function getValue() {
var y = document.getElementById('trackTitle');
var x = document.getElementById('trackName').value;
y.innerHTML = x;
}
| true |
3dc161af3069e5841e992382e49c70ee31d1fb4a | JavaScript | mespinoza30/dino-lab | /src/App.js | UTF-8 | 648 | 3 | 3 | [] | no_license | import './App.css';
function App() {
const name = 'Marisela';
const post = {
title: "Dinosaurs Are Awesome",
author: "Stealthy Stegosaurus",
body: "Check out this body property!",
comments: ["Great title!", "Great post", "Hire this author now!"]
}
return (
<div className="App">
{/* c... | true |
79ab7ea54ff11d13ca0468ba5540c54740f7ad18 | JavaScript | aaronwhyte/plexode | /public_html/vorp/js/painters/playerpainter.js | UTF-8 | 3,150 | 2.953125 | 3 | [] | no_license | /**
* @constructor
* @extends {Painter}
*/
function PlayerPainter() {
FLAGS && FLAGS.init('playerTrail', false);
Painter.call(this, 600);
this.dying = false;
this.kaput = false;
this.tractorBeamPainter = new TractorBeamPainter();
this.zombieness = 0;
this.color = [0, 0, 0];
}
PlayerPainter.prototype = ... | true |
af7cbe8205a108dc696ffdeb2991c00ceba4d734 | JavaScript | Abhisheksharma01/BattleShip | /test/readableStreamHelper.js | UTF-8 | 407 | 2.609375 | 3 | [
"MIT"
] | permissive | const {Readable} = require("stream");
class StringToStream extends Readable {
constructor(testContent, options = {}) {
super(Object.assign(options, {"objectMode": true}));
this.testContent = testContent;
}
_read() {
if (!this.testContent.length) {
this.push(null);
return;
}
th... | true |
e38eb661d95688aae34b202b8513e532a2ce86d7 | JavaScript | jakounter/sequalizedburger | /config/orm.js | UTF-8 | 3,320 | 3.015625 | 3 | [] | no_license | // var connection = require("./connection.js");
// function printQuestionMarks(num) {
// var arr = [];
// for (var i = 0; i < num; i++) {
// arr.push("?");
// }
// return arr.toString();
// }
// // Helper function to convert object key/value pairs to SQL syntax
// function objToSql(... | true |
dd37548dad425d5e8681bbaa99836828616c7021 | JavaScript | KelsBecker/locali-frontend | /src/containers/Login.js | UTF-8 | 2,227 | 2.703125 | 3 | [] | no_license | import React from 'react';
import "./SignUp.css";
class Login extends React.Component {
state = {
username: '',
password: ''
}
handleLogin = (event) => {
this.setState({username: event.target.value})
}
handlePassword = (event) => {
this.setState({password: event.targe... | true |
c5458355a6078c06631359ee4d0ab73dc1d38848 | JavaScript | rcrespillio/mymovierocking | /app/scripts/services/movieService.js | UTF-8 | 1,884 | 2.515625 | 3 | [] | no_license | 'use strict';
/**
* @ngdoc overview
* @name mymovierockingApp
* @description
* # mymovierockingApp
*
* Service of the application.
*/
var module = angular.module('mymovierockingApp');
module.service('MovieService',['$http',function($http){
this.getMovies = function(getPeliculasRecientesSuccess,getPeliculasR... | true |
f4ebcb85b0bac4098a039f5b9820b0cefdbdd6ff | JavaScript | Chipi-IO/Chipi.Client.Desktop | /app/main/api/index.js | UTF-8 | 493 | 2.515625 | 3 | [] | no_license | /*export function fetchApiRequest(url, options={}) {
options.headers = options.headers || new Headers()
if(options.idToken) {
options.headers.append('Authorization', options.idToken)
}
const request = new Request(url, options)
return fetch(request).then(response => {
return response... | true |
31a07faf9263d2ed8be9a77475ef88322fc6b238 | JavaScript | heparish/Team-Profile-Generator | /_test_/Engineer.test.js | UTF-8 | 515 | 2.921875 | 3 | [] | no_license | const Engineer = require('../lib/Engineer');
const engineer = new Engineer('Hello', 'Kitty', 1975, 'hellokitty');
test('creates an engineer object', () => {
(engineer.firstName, 'Hello');
(engineer.lastName, 'Kitty');
(engineer.id);
(engineer.email, '@');
(engineer.role, 'Engineer');
});
test('ge... | true |
43c584ffea71f95edc064132d72b45de44c9c651 | JavaScript | gitter-badger/JNsolve | /lib/derivativenumeric.js | UTF-8 | 1,314 | 2.6875 | 3 | [
"MIT"
] | permissive | 'use strict' ;
var deltax = require('./deltax'),
sortInterval = require('./sortInterval');
/** @function
* function that calculate the array of numeric derivative of f(x) using npoints in interval ([a,b]) using pointsDistribution.
* @param {Function} f {Number} npoints {Array} interval {String} point... | true |
b3d91d7cec5f0a258dc9888c03a3cb2686a9de48 | JavaScript | Tushar-Tilwani/stuff | /strings/revise/wildcardDP.js | UTF-8 | 1,265 | 3.484375 | 3 | [] | no_license | // https://leetcode.com/problems/wildcard-matching/
/**
* @param {string} s
* @param {string} p
* @return {boolean}
*/
const isMatch = function(s, p) {
// Adding hash for special cases of empty strings
const pattern = removeExtraStars(p) + "#";
const str = s + "#";
const DP_TABLE = [];
const MAX_ROW = s... | true |
afb12c7a876d5d2a8e95fadcd28790ae57e9d3c7 | JavaScript | Bdita/CFA-Node-Ninja-Quiz | /src/ProgressBarComponent/ProgressBar.js | UTF-8 | 790 | 2.78125 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Progress from 'react-progressbar';
class ProgressBar extends Component {
render() {
return (
<div>
<Progress completed={((this.props.current_step-1) * 100)/this.props.question_length} />
</div>
)
//
... | true |
50f6a9b6d527410b30de8bc4c85558aa00d92960 | JavaScript | qianhaodong/Node.js | /博客后台/blog-1/src/router/blog.js | UTF-8 | 2,536 | 2.78125 | 3 | [] | no_license | const {
getList,
getDetail,
newBlog,
updateBlog,
delBlog
} = require("../controller/blog");
const { SuccessModel, ErrorModel } = require("../model/resModel");
const xss = require('xss')
// 登录验证
const loginCheck = req => {
if (!req.session.username) {
return Promise.resolve(new ErrorModel("尚未登录"));
}
};
const... | true |
b23300a8f0bd0f8969975f5e7faed45c1b6317cb | JavaScript | swopnilnep/internetProgramming | /notes/js_events/js/next_prime.js | UTF-8 | 704 | 3.921875 | 4 | [
"MIT"
] | permissive | "use strict;"
function nextPrime() {
let number = document.querySelector("#nextprime");
let currentPrime = number.innerHTML;
if (currentPrime === " ") {
currentPrime = 1;
}
number.innerHTML = getNextPrime(currentPrime).toString();
}
function getNextPrime(n) {
let nextPrimeNumber... | true |
e5d2992b3c28447315b77dc491b2dc4122c8de09 | JavaScript | vincentdchan/babel | /packages/babel-preset-es2015/test/fixtures/traceur/Yield/ReturnInFinally.js | UTF-8 | 625 | 3.34375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT"
] | permissive | function* f() {
try {
yield 1;
} finally {
return 2;
}
yield 3;
return 4;
}
var g = f();
assert.deepEqual(g.next(), {value: 1, done: false});
assert.deepEqual(g.next(), {value: 2, done: true});
function* f2() {
try {
yield 1
} catch (ex) {
yield ex;
} finally {
return 2;
}
yield ... | true |
5d4bdf24cbc02fa57913c49afbc16790751ebd8a | JavaScript | Ger-onimo/java_whw_JavaScript_ES6_classes | /client/src/views/select_view.js | UTF-8 | 1,839 | 2.984375 | 3 | [] | no_license | //const PubSub = require('../helpers/pub_sub.js');
// refactor pubsub import
import PubSub from '../helpers/pub_sub.js';
// 1. refactored class syntax
class SelectView { // refactored export to app.js
constructor(element){
this.element = element;
}
// 2. refactored method syntax
bindEvents() {
PubSub.subscri... | true |
4f3c04f7529045892e37164bb75fa6a50d1a021c | JavaScript | bakolaszlo/AspNetSandbox | /AspNetSandbox/wwwroot/js/book.js | UTF-8 | 1,412 | 2.6875 | 3 | [] | no_license | "use strict";
var connection = new signalR.HubConnectionBuilder().withUrl("/messagehub").build();
connection.start().then(function () {
console.log("Connection established..");
}).catch(function (err) {
return console.error(err.toString());
});
connection.on("BookCreated", function (book) {
console.log(... | true |
6f85a7f62cf236d08085ba3ff13fc640817d6834 | JavaScript | Samator/delfood.github.io | /js/main.js | UTF-8 | 1,233 | 2.703125 | 3 | [] | no_license | const cartButton = document.querySelector('#cart-button');
const modal = document.querySelector('.modal');
const close = document.querySelector('.close');
const card = document.querySelector('#card');
const card2 = document.querySelector('#card2');
const card3 = document.querySelector('#card3');
const card4 = doc... | true |
c5d8c139a4c8d8caa903b6543c2733a5515c8bf6 | JavaScript | dagute/holbertonschool-web_back_end | /0x11-ES6_data_manipulation/4-update_grade_by_city.js | UTF-8 | 361 | 2.578125 | 3 | [] | no_license | export default function updateStudentGradeByCity(student, city, newGrades) {
return student
.filter((item) => item.location === city)
.map((item) => {
const grades = newGrades.filter(
(grade) => grade.studentId === item.id,
);
const grade = grades.length ? grades[0].grade : 'N/A';
... | true |
291cb11a282712dbad8850a28fd806113498a85d | JavaScript | akshatjoshii/DataStructure-algo-JS | /recursion.js | UTF-8 | 2,063 | 4.5 | 4 | [] | no_license | /**
* Created by Akshat on 05-12-2017.
*/
//Recursion example
// When function calls itself
function computeFactorial(number) {
if(number ===1){
return 1
}
return number * computeFactorial(number-1)
}
//1. Write a function that loops through the numbers n down to 0.
// If you haven't done so try... | true |
d983550bbe181373e922750a46a79f56684234e6 | JavaScript | edwardphill/New-York-Times-API-Article-Search | /assets/javascript/code.js | UTF-8 | 505 | 2.515625 | 3 | [] | no_license | var queryURL = "https://api.nytimes.com/svc/search/v2/articlesearch.json?q=";
var searchTermQ = "christmas"; // this will be the search input
var apiKey = "&api-key=WLf22500vU4LEWrjmQIDk4uSX5bTog1u";
var limit = "limit=1"; // number of articles shown, needs to be completed link to Pagination: https://developer.nytim... | true |
b79dfcb0d9192c0ad476c890884986680e8bf8a5 | JavaScript | tolani41/qinliang760.github.com | /NESH/shicha/demo1/jquery.parallax.js | UTF-8 | 4,944 | 2.609375 | 3 | [] | no_license | /**
* @fileoverview
* @author jay
* @module Parallax
**/
(function($){
$.ns("JV");
/**
*
* @class Parallax
* @constructor
* @extends Base
参数1 视差区域的ID
参数2:设置参数
*/
JV.Parallax=function(Jnode,cfg){
var self = this;
var defaults={
activeNod... | true |