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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
befa1a62676b0d28da8326cfb72141be0186010c | JavaScript | KRADEL/Javascript-Course | /JavaScript/bind-function.js | UTF-8 | 573 | 4.3125 | 4 | [] | no_license | // constructor() {
// this.handleClick = handleClick.bind(this);
// }
const userOne = {
firstName: 'Ryley',
lastName: 'Arnold'
}
const userTwo = {
firstName: 'Jordan',
lastName: 'Arnold'
}
// cannot use an arrow function b/c arrow function changes the scope of this keyword(this will... | true |
a04fba405813bbf1a0854d7bba6541357a54b3e7 | JavaScript | webfun-sept2017/Travis_Johnson_webfun-sept2017 | /Algorithms/multiplesOfFive.js | UTF-8 | 238 | 3.3125 | 3 | [] | no_license | function multiplesFive(start, end) {
var counter = 0;
for (i = start; i <= end; i++) {
if (i % 5 === 0) {
console.log(i);
counter++;
}
}
console.log(counter + " mulitples of 5.");
}
multiplesFive(512, 4096);
| true |
3772badf5a775862bac5dc38cdc760253e9bbc81 | JavaScript | wuwensen007/campus_express_rjxz | /src/main/resources/static/user/js/rl.js | UTF-8 | 2,815 | 2.703125 | 3 | [] | no_license | //登录
var loginForm = new Vue({
el:"#login",
data:{
email: '',
password: '',
authCode: '',
checked: false
},
methods:{
login: function(){
if (this.email.length == 0 || this.password.length == 0) {
this.help = '请将信息填写完整';
return;
}
//提交登录请求
$.get("/user/log... | true |
2b87c088361566b9c0c863602c7e59435dcdf241 | JavaScript | jinho6225/hackerRank | /Sorting/Insertion Sort - Part 1.js | UTF-8 | 596 | 3.734375 | 4 | [] | no_license | function insertionSort1(n, arr) {
for (let i = 1; i < arr.length; i++) {
if (arr[i] < arr[i-1]) { //i - 4
let j = i - 1 // j = 3
let temp = arr[i] //temp = 3
while (j >= 0) { // 2, 4, 6, 8, 3
arr[j+1] = arr[j] // 2, 3, 4, 6, 8
console.log(... | true |
68b7c5e6474a939ef48484777223a44b8907c879 | JavaScript | petitepirate/reduxFundamentals | /04_apprehaul/memegen/src/rootReducer.js | UTF-8 | 656 | 2.828125 | 3 | [] | no_license |
const INITIAL_STATE = { memes: [], deadMemes: [] };
export default function rootReducer(state = INITIAL_STATE, action) {
const { type, payload } = action;
switch (type) {
case 'ADD_MEME':
return { ...state, memes: [...state.memes, payload] };
case 'DELETE_MEME':
const newMemeArr = [... | true |
40ffcc514ec02de734ffcd2d1bbc7ba8f47477ca | JavaScript | gvillamayor/septimoarte | /webapp/libs/tooltip.d3.js | UTF-8 | 1,211 | 2.921875 | 3 | [
"MIT"
] | permissive | function tooltipd3(tltp_name){
/**
* @Class tooltip - d3 object tooltip
* Requiere [d3.js](https://github.com/mbostock/d3)
*/
"use strict";
var s = {};
s.name = tltp_name ? tltp_name : "tooltipd3";
s.w = 0; // width tooltip
s.h = 0; // height tooltip
s.t = d3.select("body").append("div") // tooltip html node
... | true |
9a0ffa69f69886ef9feb7501759ebe112e05adfb | JavaScript | alisha-davis/number-guesser | /script.js | UTF-8 | 879 | 3.953125 | 4 | [] | no_license | let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// generate new secret target number at start of each round
function generateTarget() {
return Math.floor(Math.random()*10);
}
// determine which guess is closest to the target number
function compareGuesses(userGuess, compGuess, target) {
... | true |
70b666591d12c91ac990837e38047eb871636410 | JavaScript | baas-cloud/baas | /js/app.js | UTF-8 | 1,328 | 2.65625 | 3 | [
"MIT"
] | permissive | function init_ui() {
var format;
var formats = {
mp3: { mime: "audio/mpeg", ext: "mp3"},
wav: { mime: "audio/x-wav", ext: "wav"}
};
for( var format in formats ) {
format = formats[format];
var myAudioTag = undefined; // Global
var audioTagSupport = !!((myAudioTag = document.createElement('... | true |
bd681e943d70e509719fefe04c7b5afda9aaf847 | JavaScript | mirusz9/2d-game | /engine/Engine.js | UTF-8 | 1,252 | 3.28125 | 3 | [] | no_license |
class Engine {
constructor(timeStep, update, render) {
this.accumulatedTime = 0;
this.animationFrameRequest = undefined,
this.time = undefined,
this.timeStep = timeStep,
this.updated = false;
this.update = update;
this.render ... | true |
f4bd71efcc54ca73c81868ee8d7c0445c340d8fb | JavaScript | roctomato/duktape-unity | /duktape-2.5.0/tests/ecmascript/test-expr-void.js | UTF-8 | 299 | 3.21875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* 'void' operator (E5 Section 11.4.2).
*/
/*===
456
undefined
===*/
try {
print(eval("123; 456;"));
} catch (e) {
print(e.name);
}
try {
/* latter expression generates an 'undefined' implicit return value */
print(eval("123; void 456;"));
} catch (e) {
print(e.name);
}
| true |
bce6399fb912b0acd6ad5447e4f8aa4a87f84fc8 | JavaScript | ericstratmann/Fiz | /web/static/fiz/ChartTitle.js | UTF-8 | 3,450 | 3.328125 | 3 | [] | no_license | /* Copyright (c) 2009 Stanford University
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCL... | true |
217291179d8478114c8b52c031d580b780f63565 | JavaScript | airum82/am-number-guesser | /numberguess.js | UTF-8 | 2,780 | 3.625 | 4 | [] | no_license |
var min = 1;
var max = 100;
var entry = document.getElementById("guess").value;
var secretNum = Math.floor(Math.random() * (max - min) + min);
function isRight() {
var entry = document.getElementById("guess").value;
var fin = parseInt(entry)
event.preventDefault();
if (fin === secretNum) {
document.getElem... | true |
e3ebd67b5c09665cd76ce3548056703ba38fe760 | JavaScript | mindliner/mindliner | /MindlinerWeb/web/resources/js/userConnectionScript.js | UTF-8 | 3,338 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Author: Marius and Niklaus Messerli
* July 4th, 2013
*/
/**
* Build a chord graph with the users as the object and the connections between
* objects belonging to those users as the strokes.
*
* @param {type} userConnectionMatrix An int[][] 3D vector with the connection count as the values.
* @param {typ... | true |
73fe7cc5b2868139dbedf05820d95408f2b010c0 | JavaScript | omicto/art-gallery | /models/customer.js | UTF-8 | 2,151 | 2.578125 | 3 | [] | no_license | const mongoose = require('mongoose');
const AutoIncrement = require('mongoose-sequence')(mongoose);
const Schema = mongoose.Schema;
const customerSchema = new Schema({
lastname: String,
firstname: String,
emailaddress: String,
encryptedpassword: String,
street: String,
city: String,
state: ... | true |
ba72f11c8a1d4af01179c186ebf20ae8461a22f9 | JavaScript | NguyenThaiQuyen/Nodejs03 | /Day3/callback.js | UTF-8 | 561 | 2.59375 | 3 | [] | no_license | function doTestOne(callback) {
console.log('Start testing');
setTimeout(function() {
console.log('Done testing');
return callback();
}, 3000);
}
function showTestingStatus() {
console.log('Finish test');
}
doTestOne(function() {
showTestingStatus();
});
// tac vu I/O : WRITE/ READ... | true |
67213893678f3ee80e3f236cc943dc7de0203dfc | JavaScript | RiodeJaneiroo/i-tasker | /Client/src/reducers/update-task.js | UTF-8 | 627 | 2.625 | 3 | [] | no_license | import {FETCH_TASK_REQUEST, FETCH_TASK_SUCCESS, FETCH_TASK_FAILURE} from '../actions/task-actions';
const updateTask = (state, action) => {
if(state === undefined) {
return {
item: [],
loading: true,
error: null
};
}
switch(action.type) {
case FETCH_TASK_REQUEST:
return {
item: [],
loadi... | true |
fd4a22131e44a11e0d569010d9424163598199f6 | JavaScript | mathiuskormasela12/belajar-typescript-dasar | /build/interface.js | UTF-8 | 939 | 3.078125 | 3 | [] | no_license | "use strict";
/*
===== Belajar Interface =====
Interface adalah sebuah template
untuk membuat sebuah class. Interface
ini mirip seperti class abstract
namun interface ini semua method dan
propertynya harus abstract dan akan
di implementasi di child class nya.
rumus membuat interface :
inter... | true |
efcbecabb43195e678a8afdd5c62708e6167052c | JavaScript | messer-84/messer-84.github.com | /phoneBook/js/keypad.js | UTF-8 | 3,468 | 2.875 | 3 | [] | no_license | class Keypad {
constructor(appState) {
this.appState = appState;
this.app = document.querySelector('#app');
}
createTag(tag, parent, mClass) {
mClass = mClass || false;
var myTag = document.createElement(tag);
if (mClass) {
myTag.className = mClass;
}
parent.appendChild(myTag);
... | true |
877af994b3a9a9c91eee6cab5e48f9733f49bdda | JavaScript | liliuzhu/reactExample | /lanO/RN/lessonTouchable/App.js | UTF-8 | 2,942 | 2.578125 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, {Component} from 'react';
import {
Platform,
StyleSheet,
Text,
View,
TouchableOpacity,
TextInput
} from 'react-native';
/*
* React Native 提供3个组件用于给其他没有触摸事件
* TouchableOpacity 透明触摸,点击时,组件会出现透明效... | true |
e1c2499a3de1ca14791966104b9d16378aca8f61 | JavaScript | akarenl/password-generator | /script.js | UTF-8 | 1,396 | 3.84375 | 4 | [] | no_license | // Assignment Code
var generateBtn = document.querySelector("#generate");
function generatePassword(charLength, lowerResult, upperResult, numResult, specialResult) {
// password length
var charLength = prompt("Please enter desired password length");
if (charLength > 7 && charLength < 129) {
// Ask for Lowe... | true |
b9809acd9d7d894bae09781756a397c3d935fa6c | JavaScript | samra125/javascript-assignment-2 | /app.js | UTF-8 | 1,126 | 3.546875 | 4 | [] | no_license | // .....................chapter 21 to 25/////
var cleanestCities = ["Cheyenne", "cheyenne", "Santa Fe", "santa fe", "Tucson", tucson", "Great Falls",
"great falls", "Honolulu", "honolulu"];
var cityToCheck = prompt("Enter your city");
cityToCheck = cityToCheck.toLowerCase();
var cleanestCities = ["cheyenne", "sa... | true |
59f6fde340e9e556b70418debd6d9ebead9a1c1d | JavaScript | davarg5/HTTP-Movies-Assignment | /client/src/Movies/AddForm.js | UTF-8 | 1,930 | 2.9375 | 3 | [] | no_license | import React, { useState } from 'react';
import axios from 'axios';
import { useHistory } from 'react-router-dom';
const initialValues = {
title: '',
director: '',
metascore: '',
stars: ''
}
const AddForm = props => {
const { push } = useHistory()
const [movie, setMovie] = useState(initialVal... | true |
55d19e4a1af58d1531726a726c34e5dc1ba83735 | JavaScript | Sroca3/kairos | /app.js | UTF-8 | 1,027 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | const moment = require('moment');
const fs = require('fs');
var testCaseCounter = 1;
let TEST_FILE_NAME = "test_cases";
setupTestCaseFile();
addTestCase("YYYY/MM/DD");
addTestCase("DD/MM/YYYY");
addTestCase("MM/DD/YYYY");
addTestCase("DD/MM/YY");
addTestCase("MM/DD/YY");
addTestCase("HH:mm");
addTestCase("hh:mm A");
... | true |
3e75b03fa1c0446baaa5c6ca6edd73485b7b18ab | JavaScript | egamasa/atsumori | /assets/play.js | UTF-8 | 1,952 | 3.21875 | 3 | [] | no_license |
// Count button click
let $count = 0;
function countUp() {
document.getElementById('clickCount').innerHTML = ++$count;
}
function countReset() {
$count = 0;
document.getElementById('clickCount').innerHTML = $count;
}
// Initialize
window.AudioContext = window.AudioContext || window.webkitAudioContext;
let co... | true |
0ab6aa7e6a8f8b49b22b7468166d9abe7df9b4e8 | JavaScript | lliriq77/new-git-repo | /lesson-1-1/lesson_1_1.js | UTF-8 | 360 | 3.78125 | 4 | [] | no_license | /* В переменных a и b хранятся числа. Написать
программу, которая выводит в консоль произведение
и сумму этих чисел. */
export function sumMul(a, b) {
const sum = a + b;
const mul = a * b;
return `Сумма = ${sum}; Произведение = ${mul}.`;
} | true |
fd49bc013b64afa84a8cb4b5421fef0f3517da98 | JavaScript | circlehddev/liquidjs | /test/unit/tags/if.js | UTF-8 | 4,077 | 2.53125 | 3 | [
"MIT"
] | permissive | import Liquid from '../../../src/index'
import chai from 'chai'
const expect = chai.expect
chai.use(require('chai-as-promised'))
describe('tags/if', function () {
const liquid = Liquid()
const ctx = {
one: 1,
two: 2,
emptyString: '',
emptyArray: []
}
it('should throw if not closed', function ... | true |
76b4305c6ab1b4fdeda3fa43cbc847e730c7110f | JavaScript | Sermonizer/LeetCode | /LeetCode/LC26_删除排序数组中的重复项.js | UTF-8 | 929 | 3.515625 | 4 | [] | no_license | /*
* @Author: your name
* @Date: 2020-08-14 11:27:43
* @LastEditTime: 2020-08-14 11:30:08
* @LastEditors: Please set LastEditors
* @Description: 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
* @FilePath: \LeetCode\LeetCode\LC26_删除排序数组中的重复项.js
*/
/**
* 1. 双指针
* 数组有序,相同的数字一定相邻
* 利用两个指针,比较当前位置的元素是否相等
* 若相等... | true |
7d01cc819ac328ef5aaa3428b161bdc896f59c5b | JavaScript | maxiaoqu/utils | /components/operation.js | UTF-8 | 1,604 | 2.6875 | 3 | [] | no_license | function getCSS (o, key) {
return o.currentStyle ? o.currentStyle[key] : document.defaultView.getComputedStyle(o, false)[key];
}
export function startDrag (bar, target, callback) {
const params = {
left: 0,
top: 0,
currentX: 0,
currentY: 0,
flag: false
};
bar.onmousedown = (e) => {
par... | true |
9df77dea25cc43125dea7bc457e8fe91225aa2b8 | JavaScript | gangwaranuj/React-Example | /src/Example.js | UTF-8 | 645 | 3.203125 | 3 | [] | no_license | import React from 'react';
class Example extends React.Component {
render() {
return (
<div>
<h3>Array: {[this.props.propArray]}</h3>
<h3>Bool: {this.props.propBool ? "True..." : "False..."}</h3>
<h3>Func: {this.props.propFunc()}</h3>
</div>
... | true |
5054e0bb690cd218894667651931905730288c51 | JavaScript | milen-vm/SoftUni-Homework | /1-level/JavaScript-Basics/3.JavaScript-Loops-Arrays-Strings/03.docProperties.js | UTF-8 | 238 | 2.890625 | 3 | [] | no_license | function displayProperties() {
var documentProperties = [];
for (var prop in document) {
documentProperties.push(prop);
}
documentProperties.sort();
document.getElementById('result').innerHTML = documentProperties.join('<br/>');
}
| true |
40e0d4e19cc15f8f7e12b038c17c7b35bb3f03f1 | JavaScript | Adammonast/JavaScript-Practice | /03-Control Flow/04-While-Loop.js | UTF-8 | 350 | 4.3125 | 4 | [] | no_license | // Key difference between for loops and while loops: in for loops, the variable is part of the loop itself
// In while loops, you have to declare the variable externally
let i = 0;
/* syntax -->
while (condition) {
statement that we want to repeat
increment i
}
*/
while (i <= 5) {
if (i % 2 !=... | true |
bad327da94348f346110c498ce2b4388e4cc4504 | JavaScript | Mrshulan/Muti_ShareBlog_FE | /src/App.js | UTF-8 | 1,374 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'
import routes from './routes/index.js'
class App extends Component {
renderRoutes(routes, contextPath) {
const children = []
const renderRoute = (item, routeContextPath) => {
let ... | true |
fe0c3469ac522091d137242c5a75d9d7b5f6bd84 | JavaScript | isabella232/docs-11 | /theme/assets/javascripts/select.js | UTF-8 | 208 | 2.515625 | 3 | [] | no_license | (function(){
var select = document.querySelector("select");
select.onchange = function(ev){
window.location = this.options[this.selectedIndex].dataset.url + window.location.hash;
};
})();
| true |
ee97a9f5d5059559bc5f29bfc2db7db2dac6d4c9 | JavaScript | NDGP/lighthouse-js-fundamentals | /loopy.js | UTF-8 | 511 | 3.109375 | 3 | [] | no_license | let loopyLighthouse = (range, multiples, words) => {
for(let counter = range[0]; counter <= range[1]; counter++){
if(counter % multiples[0] === 0 && counter % multiples[1] === 0){
console.log(words[0] + words [1]);
continue;
}else if(counter % multiples[0] === 0){
console.log(words[0]);
continue;
} ... | true |
90093afefcdb3a276015704b547e9109753dfb03 | JavaScript | olufemi424/algorithms | /ALGO/JS/slasherflick.js | UTF-8 | 415 | 4.03125 | 4 | [] | no_license | // function slash(arr, num) {
// return arr.splice(0, num);
// }
// // console.log(slash(["a", "b", "c", "d", "e"], 3));
// // console.log(slash(["burger", "friend", "shakes"], 1));
// function slasher(arr, howMany) {
// // remove the head
// arr.splice(0, howMany);
// // return the remaining or the tail
// ... | true |
02425531f37f1e9235df8656e358f9e3341fd82c | JavaScript | VaibhaveeM11/financial-portfolio-tracker-app | /src/Components/FetchApi.js | UTF-8 | 1,142 | 2.625 | 3 | [] | no_license | import React, { Component } from "react";
import Axios from "axios";
import firebase from "firebase/app";
import "firebase/database";
class FetchApi extends Component {
constructor(props) {
super(props);
this.state = {
query: this.props.apiQuery,
stockValue: {},
};
}
componentDidMount() ... | true |
051ad6df161963b68810ce5aa6d7e06432d934db | JavaScript | Richard-Howard-Toronto/HackerYouFall2018 | /1.3 Functions/snippets.js | UTF-8 | 1,715 | 4.5625 | 5 | [] | no_license | function helloWorld() {
console.log("Hello there!");
}
helloWorld();
console.log('----------------------------');
const add = (a,b) => {
console.log(`${a} plus ${b} = ${a+b}`);
};
add(Math.trunc(Math.random()*100),Math.random()*100)
console.log('----------------------------');
const addPi = () => 3 + 4;
con... | true |
0581c8b13452d0685984445bb5e1c9a362f84552 | JavaScript | m-hops/GAMERELLA | /untitled game/js/game/scene/ConvoIntro.js | UTF-8 | 7,077 | 2.640625 | 3 | [] | no_license | class ConvoIntro extends Scene{
static bkg;
static overlay;
static text;
static mouse;
static v1;
static v2;
static v3;
static onPreload(){
ConvoIntro.bkg = loadImage('assets/images/introScreens/convoBKG.png');
ConvoIntro.overlay = loadImage('assets/images/generalAssets/textOverlayBar.png');
... | true |
116e1c4b33c610ec0f7d919f4ac421d0a0037cd1 | JavaScript | ertprs/Estudo | /Glass/Vue/_Compartilhado/Servicos/ImpressoesEtiquetas.js | UTF-8 | 2,729 | 2.625 | 3 | [] | no_license | var Servicos = Servicos || {};
/**
* Objeto com os serviços para a API de impressões de etiquetas.
*/
Servicos.ImpressoesEtiquetas = (function (http) {
const API = '/api/v1/impressoesEtiquetas/';
const API_Individual = API + 'individual/';
return {
/**
* Objeto com os serviços para a API de impressõe... | true |
a36fc657c640230f97a83ceb87a32666aa66f4fe | JavaScript | LucasYuNju/leanote-desktop-lite | /src/actions/TagActions.js | UTF-8 | 1,050 | 2.59375 | 3 | [
"MIT"
] | permissive | import union from 'lodash/union'
import * as types from '../constants/ActionTypes';
import {updateNote} from '../actions/NoteActions';
/**
* Leanote有单独的api进行增删tag,目前还没有调用这些api,而是从note中解析出tag
*/
export function addNoteTag(noteId, tag) {
return (dispatch, getState) => {
const tags = getState().entities.notes[no... | true |
6decc6ec3b3b682006f0a3fc4023057c76ac7535 | JavaScript | bigcab/psautiers.org | /js/recherche.js | UTF-8 | 213 | 2.59375 | 3 | [] | no_license | function date_recueil(checkbox)
{
var row=document.getElementById('row_date_recueil');
if(checkbox.checked==true)
{
row.style.display="table-row";
}
else
{
row.style.display="none";
}
}
| true |
33b076a4a64435e4004f07b78471b4f1dcf0ee6f | JavaScript | nitishbala2000/javascriptGames | /src/games/snake/game.js | UTF-8 | 4,027 | 3.21875 | 3 | [] | no_license | import {Snake} from "./snake.js";
import {Food} from "./food.js";
export const SCREEN_WIDTH = 500;
export const SCREEN_HEIGHT = 500;
const snakeCellInfo = {
width: 10,
height: 10,
color: "green"
};
const foodCellInfo = {
width: 10,
height: 10,
color: "orange"
};
export class SnakeGame {
... | true |
08088a68d87edb5cc2102c00d73dae38919bccaf | JavaScript | Aurora0728/bigEvent | /assets/js/index.js | UTF-8 | 1,560 | 2.546875 | 3 | [] | no_license | $(function () {
getUserInfo()
})
// 获取用户基本信息
function getUserInfo() {
$.ajax({
method: 'GET',
url: '/my/userinfo',
headers: {
// 可以直接写localStorage.token,localStorage是对象
// Authorization: localStorage.getItem('token'),
// Authorization: localStorage.tok... | true |
6f60a7fcf44c4691c14c25813e698e17551d4dfc | JavaScript | alanblins/legacy_code_study | /start.js | UTF-8 | 474 | 2.78125 | 3 | [] | no_license | require('./game.js');
module.exports = {
start: function(dyces1,dyces2){
var notAWinner = false;
var game = new Game();
game.add('Chet');
game.add('Pat');
game.add('Sue');
do{
game.roll(dyces1.shift());
if(dyces2.shift() == 7){
notAWin... | true |
79b245efcbf92abfc37fde210c3d2cf872588e2e | JavaScript | KazisMurata/JS-HomeWork | /Lesson 20/HomeWork 20/webpack-starter-main/src/scripts/MVC/model.js | UTF-8 | 1,055 | 2.984375 | 3 | [
"MIT"
] | permissive | class ToDoModel {
todos = []
subscribers = []
addTodo(value) {
this.todos.push({ id: Math.random(), value: value, completed: false });
this.notify();
}
removeTodo(id) {
this.todos = this.todos.filter(todo => todo.id != id);
this.notify();
}
toggleTodoCheck... | true |
bd7b36da89eaa6c442a7649dcb2fae00725b49ff | JavaScript | rushkock/rushkock_web | /app/static/js/animation/main.js | UTF-8 | 2,941 | 2.859375 | 3 | [] | no_license | // This function will load the data in an order
// ONLY when the data is loaded then it will execute a function
// In this function we call the functions to make the D3 visualizations
window.onload = function(){
background_bubbles()
make_background()
}
function process_data_experiment(data, subreddit){
... | true |
bb7fd437a3039705c283469215ee6efbde20c4b4 | JavaScript | ahn-gan/JS-Function-2019-5-24-8-38-13-536 | /2.function2/main.js | UTF-8 | 213 | 3.140625 | 3 | [] | no_license | function palindrome(message){
// wirte your code here
return message === message.split('').reverse().join('');
}
// palindrome('hello'); // should return false
// palindrome('abcba'); // should return true | true |
c8804b7da65bed10ac1c5ee84e9388e2e19b5831 | JavaScript | Shafin5714/Vanilla-Javascript-Projects | /Form Validaiton JS/app.js | UTF-8 | 1,927 | 3.171875 | 3 | [] | no_license | const from = document.getElementById("form")
const username = document.getElementById("username")
const email = document.getElementById("email")
const password = document.getElementById("password")
const password2 = document.getElementById("password2")
from.addEventListener('submit',(e)=>{
e.preventDefault()
... | true |
a5f75fa60bd50852d26bbbe55f7cc0857e5cff43 | JavaScript | mikolalysenko/vj-stuff | /midi.js | UTF-8 | 2,682 | 2.5625 | 3 | [] | no_license | const DECAY_TIME = 200.0
const ATTACK_TIME = 180.0
const SUSTAIN_TIME = 100.0
module.exports = function initMidi ({regl}) {
const state = {
buttons: Array(8).fill(0),
knobs: Array(9).fill(0),
ontap: () => {},
tick,
setup: regl({
context: {
buttons: regl.this('buttons'),
knob... | true |
20fc26105a9fc5b046a0a23c32bfc710f8a6470a | JavaScript | JIJEvoid/webgl-learning | /demo1/js/3_click.js | UTF-8 | 1,497 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* Created by wanglei on 2019-06-24
*/
var vs ='attribute vec4 a_Position;\n'+
'void main(){\n'+
' gl_Position = a_Position;\n'+
' gl_PointSize = 10.0;\n'+
'}\n';
var fs ='precision mediump float;\n' +
'uniform vec4 u_FragColor;\n'+
'void main(){ gl_FragColor = u_FragC... | true |
b52469e3e435d9554234c1c9083f0bd11c878aed | JavaScript | chyangfather/envadmin | /envadmin/static/js/form2json.js | UTF-8 | 835 | 2.71875 | 3 | [] | no_license | //jquery 插件对象
/**
*
* 序列话一个表单,并给该表单中每一个字段添加别名
* @author jt.tao QQ:1453566283
* @param {Object} n 表单对象别名
* @memberOf {TypeName}
* @return {TypeName}
*/
$.fn.serializeObjectForm = function(n)
{
//if(!n) { alert('序列化表单请给别名!'); return null};//在此临时简单处理n,还有待你们完善呀...
var o = {};
var a = this.serializeArr... | true |
f0762579a8a6f852d0d6e3a8c8086ff2b97f9cbe | JavaScript | Jack2ee-dev/yeongjong-jaehyuk | /05_Stopwatch/js/app.js | UTF-8 | 2,408 | 3.21875 | 3 | [] | no_license | const BASE_TIME = {
mm: 0,
ss: 0,
ms: 0
};
const [$button1, $button2] = document.getElementsByClassName('control');
const $display = document.querySelector('.display');
const $laps = document.querySelector('.laps');
// hooks
const useState = (defaultValue, customRenderFunction) => {
let value = defaultValue;
... | true |
02ee14e2ca02c6015fd49f45e0400c66a6f5332f | JavaScript | ifreeWorld/interview-code | /leetcode/300.最长递增子序列.js | UTF-8 | 1,648 | 3.9375 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=300 lang=javascript
*
* [300] 最长递增子序列
*
* https://leetcode.cn/problems/longest-increasing-subsequence/description/
*
* algorithms
* Medium (54.42%)
* Likes: 2937
* Dislikes: 0
* Total Accepted: 661.9K
* Total Submissions: 1.2M
* Testcase Example: '[10,9,2,5,3,7,101,18]'
... | true |
d48aeaf0dd4bfebc93e6844cdc0ffa8dd27be4e4 | JavaScript | mag16/Node-Express-Lab | /server.js | UTF-8 | 3,812 | 2.859375 | 3 | [] | no_license | // import your node modules
const express = require('express');
const db = require('./data/db');
const cors = require('cors');
// add your server code starting here
const port = 5555;
const server = express();
server.use(express.json());
server.use(cors({ origin: 'http://localhost:3000' }));
server.post('/', (req, ... | true |
c99d90bda53e193b8bb02081418bb9acc766282f | JavaScript | fikrikarim/hnpopquiz | /src/__tests__/SlideQuestion.test.js | UTF-8 | 5,472 | 2.65625 | 3 | [] | no_license | import React from "react";
import { shallow } from "enzyme";
import SlideQuestion from "../components/SlideQuestion";
describe("<SlideQuestion />", () => {
it("renders with class 'slide-question'", () => {
const wrapper = shallow(<SlideQuestion quiz={{}} userAnswers={{}} />);
expect(wrapper.hasClass("slide... | true |
69c8433196f28f477c90012acdc09fd151cd1bf9 | JavaScript | Lein2018/study | /0313fetch/FetchGet.js | UTF-8 | 939 | 3.15625 | 3 | [] | no_license | /**
* 获取数据
* @param url 资源地址
* @param options 资源对象
*/
function FetchGet(url,options,callback) {
//post put delete
var option = {method:"GET"};
if(option.method === "GET" && options.param){
var arrParam = [];//存放转换之后的格式
//对象 citykey=101210101
Object.keys(options.param).for... | true |
583ad0f6d5b3928818cce343548bb3eb875c23b2 | JavaScript | lorranpalmeira/XPTOTicket | /XRTTicket/Scripts/Add/newUser - Copy.js | UTF-8 | 7,182 | 2.65625 | 3 | [] | no_license | /// <reference path="jquery-1.9.1.intellisense.js" />
//Load Data in Table when documents is ready
$(document).ready(function () {
loadData();
});
//Load Data function
function loadData() {
$.ajax({
url: "/Account/ListUsers",
type: "GET",
contentType: "application/json;charset=utf-8",
... | true |
e2426deb3b06a46107f1f5299a0f65f35b6e831e | JavaScript | stanislavstoyanov99/SoftUni-Software-Engineering | /JavaScript-Advanced/Labs-And-Homeworks/JS Applications/03. Asynchronous Programming - Exercise/01. Forecaster/With modules/data.js | UTF-8 | 738 | 2.640625 | 3 | [
"MIT"
] | permissive | function host(endpoint) {
return `https://judgetests.firebaseio.com/${endpoint}.json`;
}
const api = {
locations: 'locations',
today: 'forecast/today/',
upcoming: 'forecast/upcoming/'
};
export async function getCode(name) {
const response = await fetch(host(api.locations));
const data = await... | true |
08f84493d1fcec50309c981d0cacf730397b1ae6 | JavaScript | Ngapa/alel | /commands/buatGrup.js | UTF-8 | 1,785 | 3.0625 | 3 | [] | no_license | const rng = arr => {
for (var i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]]
}
return arr;
}
module.exports = {
name: 'buatgrup',
description: 'Perintah untuk membagi kelompok sebanyak-n anggota.\n` alel buatgrup ... | true |
f506c06ed94d2869d11cb1901c9e942199b08bef | JavaScript | MCluck90/code2050-terminal | /skills.js | UTF-8 | 3,678 | 2.96875 | 3 | [] | no_license | const character = require('./character');
const toLookup = (x) => x.toLowerCase().replace(/ /g, '_');
const skillToStat = (skill) => ({
strength_save: 'strength',
athletics: 'strength',
dexterity_save: 'dexterity',
acrobatics: 'dexterity',
sleight_of_hand: 'dexterity',
stealth: 'dexterity',
constitution_save: ... | true |
c5164d5b8b512ef4a956a4667d8b99e44f822a5b | JavaScript | bhaveshbs789/Cat-Clicker | /js/app.js | UTF-8 | 1,739 | 3.5625 | 4 | [] | no_license | // var clickValue = document.getElementById("click-count");
// var count = clickValue.innerHTML;
//var catPic = document.getElementById("cat-pic-elem"); // for Requirement 1
var imageDiv = document.getElementById("image");
/*
-- Below for working as per requirement 1
- */
// catPic.addEventListener("click", functio... | true |
78fd15b74ed2dbf16365f4344cb35352c2e2e6fd | JavaScript | greco05/Tp-Greco | /app/App.js | UTF-8 | 2,323 | 2.609375 | 3 | [] | no_license | class App {
static start() {
App.loadClasses().done(() => {
Utils.init();
$(document).ready(() => {
App.browse();
});
})
window.onpopstate = () => {
App.browse();
}
$('.nav-link').on('click', (evt) => {
... | true |
d7e474bc123efe3c4eb8dad46c36fb9a64fb5028 | JavaScript | gitalink/algos | /removeDups.js | UTF-8 | 1,065 | 4.09375 | 4 | [] | no_license | /*
Remove all duplicates from an array while preserving the order.
Example
Input: [1, 2, 9, 1, 8, 2, 4, 8, 5, 6, 9, 2]
Output: [1, 2, 9, 8, 4, 5, 6]
*/
const test_cases = [
{input: [1, 3, 5, 0, 0, 0, 1,3], output: []},
{input: [1, 1, 1, 2], output: [1,2]},
{input: [1,1,1,1,1,1], output: [1]},
{input: [1], outp... | true |
74cdc4c5a7ef216be37c5c93fdc119fa33e34d85 | JavaScript | alfianverter/12 | /lib/commands/tag/set.js | UTF-8 | 1,393 | 2.625 | 3 | [] | no_license | "use strict";
const Yna = require("ynajs");
const RESERVED_KEYS = [
"create",
"eval",
"deval",
"debug",
"get",
"yna",
"owner",
"raw"
];
const saveTag = (key, yna, me, tagStorage) => {
tagStorage.setKey(key, {
creator: me.user.id,
content: yna.tree,
data: {}... | true |
b2d9afd0989d261aa73a804ef35ed0c07136c0f8 | JavaScript | hars0596/deployKakao | /Admin/src/reducers/flashMessages.js | UTF-8 | 763 | 2.59375 | 3 | [] | no_license | import {ADD_FLASH_MESSAGE,DELETE_FLASH_MESSAGE} from '../components/actions/types.js';
import shortid from 'shortid';
import findeIndex from 'lodash/findIndex';
export default (state =[],action ={}) =>{
switch(action.type){
case ADD_FLASH_MESSAGE:
return[
...state,
{
... | true |
4a6d33187589c64d79e87d56f6c004b7dbad0a7a | JavaScript | svrooij/svrooij.github.io | /assets/clock/station-clock.js | UTF-8 | 19,584 | 2.609375 | 3 | [
"MIT"
] | permissive | /*!
* station-clock.js
*
* Copyright (c) 2010 Ruediger Appel
* ludi at mac dot com
*
* Date: 2016-02-16
* Version: 1.0.1
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* h... | true |
350d4595c1eac3ce4076e1157158a4cf8b1a0638 | JavaScript | praveen7557/rentcart-fe | /src/shared/shared.js | UTF-8 | 1,496 | 2.78125 | 3 | [] | no_license |
export let getRandomColor = (str) => {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var h = hash % 360;
return 'hsla(' + h + ', 60%, 50%)';
};
export let getRandomColor_rgb = () => {
let colorArray = [
[
204, 51, 69
],
[
... | true |
d5405266171cb5195658ba6d331f31739c747ee2 | JavaScript | doc22940/youtube-app | /src/js/index.js | UTF-8 | 1,123 | 2.703125 | 3 | [] | no_license | (function popularVideos() {
var popularUploadsSection = document.querySelector('.js-popular-uploads-section');
var popularUploadsSlides = popularUploadsSection.querySelector('.js-slides');
var slides = youtube.Slides(popularUploadsSlides);
var previousBtn = popularUploadsSection.querySelector('.js-previ... | true |
f9ea47162f413a53681b6bb78130d265c4142435 | JavaScript | nadirov-etibar/IBA-homeworks | /JavaScript/HomeWork_9/js/main.js | UTF-8 | 1,271 | 2.921875 | 3 | [] | no_license | // let tabs = document.getElementsByClassName("tabs-title");
// let content = document.getElementsByClassName("content");
//
// for (let i = 0; i < tabs.length; i++) {
// tabs[i].addEventListener("click", function() {
// let active = document.getElementsByClassName("active");
// active[0].className ... | true |
dd0b931100d9ec3c7db14faacf545d049cca7a2c | JavaScript | OmTejaswi/Plinko | /sketch.js | UTF-8 | 2,916 | 2.921875 | 3 | [] | no_license | const Engine = Matter.Engine,
World = Matter.World,
Events = Matter.Events,
Bodies = Matter.Bodies;
var particles = [];
var plinkos = [];
var divisionHeight=300;
var score =0;
var divisions = []
var crossingLine;
var score1 = 500;
var score2 = 100;
var score3 = 200;
var gameState = "play";
function setup... | true |
c179cd7fb06c6a11c668215cb958af901f3446da | JavaScript | kishanbhakta/JSFunctionExercises | /main.js | UTF-8 | 5,150 | 4.4375 | 4 | [] | no_license | // ---------------------
// Define a function max() that takes two numbers as arguments and returns the largest of them. Use the if-then-else construct available in JavaScript.
// ---------------------
function max(num1, num2){
if (num1 > num2) {
return num1 ;
}
else if (num2 > num1) {
ret... | true |
d5565860586c9beaa41470c4e90a91541ce96d46 | JavaScript | steve-nerey/node-study-group-steve | /week1/1.1-Fetch/app.js | UTF-8 | 753 | 3.9375 | 4 | [] | no_license |
/** first sample using fetch and catch */
console.log('about to get a guitar');
fetch('guitar.jpg').then(response => {
console.log(response);
return response.blob();
}).then(response => {
console.log(reponse);
document.getElementById('rainbow').src = URL.createObjectURL(blob);
}).catch(error => {
c... | true |
13251ff11e8ae5c962b803fedecf28a929691b9e | JavaScript | LuciaMartinez379/codoacodo | /control.js | UTF-8 | 258 | 2.90625 | 3 | [] | no_license | let usu = "usuario";
let pass = document.getElementById('pass');
function enviar() {
if (usu.value == '' || pass.value == '') {
alert('Todos los campos son obligatorios');
} if (!usu.includes("@")) {
alert('Falta un arroba en el usuario');
}
} | true |
0942fd28ca5c75b768142a70dca5583bea5f464e | JavaScript | lansechahu/calendar | /js/Yinli.js | UTF-8 | 6,285 | 2.5625 | 3 | [] | no_license | var CalendarData = new Array(100);
var madd = new Array(12);
var tgString = "甲乙丙丁戊己庚辛壬癸";
var dzString = "子丑寅卯辰巳午未申酉戌亥";
var numString = "一二三四五六七八九十";
var monString = "正二三四五六七八九十冬腊";
var weekString = "日一二三四五六";
var sx = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
var cYear, cMonth, cDay, TheDate;
CalendarData = new Array(0xA4B, 0x5164B, 0x6A5, 0... | true |
7bff4c5749f6bb3bcbb933a5dcde6b0f51fceb5a | JavaScript | jaysig/n-queens | /src/solvers.js | UTF-8 | 7,754 | 3.296875 | 3 | [] | no_license | /* _
___ ___ | |_ _____ _ __ ___
/ __|/ _ \| \ \ / / _ \ '__/ __|
\__ \ (_) | |\ V / __/ | \__ \
|___/\___/|_| \_/ \___|_| |___/
*/
// hint: you'll need to do a full-search of all possible arrangements of pieces!
// (There are also optimizations that will allow you to skip a lot of the dead s... | true |
9a9cea0338d4c61bfe6e7dc2c84f888ea13768db | JavaScript | olivia-koehler/React-Todo | /src/App.js | UTF-8 | 2,150 | 3.1875 | 3 | [] | no_license | import React from 'react';
import TodoList from "./components/TodoComponents/TodoList";
import TodoForm from "./components/TodoComponents/TodoForm";
import "./components/TodoComponents/Todo.css";
//list of todo items:
const todoData = [
{
task: "complete ToDo App",
id: 1,
completed: false,
},
{
... | true |
06fdfa4282ec0b62726fffc980d777f895045baa | JavaScript | Luigisa/ReactTrivia | /src/repository/opentdb.repository.js | UTF-8 | 863 | 2.859375 | 3 | [] | no_license | function convert(str) {
str = str.replace(/&/g, "&");
str = str.replace(/"/g, '"');
str = str.replace(/'/g, "'");
return str;
}
class OpenDbRepository {
getQuestions() {
return fetch(
"https://opentdb.com/api.php?amount=50&difficulty=easy&type=multiple"
).then(res => res.json());
... | true |
c003a20b19aa7ff9f85fe76df4aa04a828867930 | JavaScript | henvisi-1994/MTranzavilidad-Urocal_Banano | /urocalbackend/components/mix/mix.controller.js | UTF-8 | 2,345 | 2.53125 | 3 | [] | no_license | // Une varias capas
// Se comunica con el modelo
// *Pendiente: Añadir capa de validación a todos los controladores
const nodemailer = require("nodemailer");
const mixModel = require('./mix.model');
module.exports = {
// Obtener todos los mix
async getMix(req, res) {
const mix = await mixModel.getMix... | true |
0b2be5939535e51f6860698aa4e028690fceb8f1 | JavaScript | ThermoDev/Capstone-Project | /frontend/lib/useApi/ApiProvider.js | UTF-8 | 792 | 2.65625 | 3 | [] | no_license | import { useReducer, createContext } from 'react';
import PropTypes from 'prop-types';
import { apiReducer } from './apiReducer';
const DEFAULT_STATE = {};
/**
* ApiContext initialises are Context object with a default state and dispatch function
* @returns {React Context}
*/
export const ApiContext = createContex... | true |
b8412f5597972d94b6b2f98ebda2e11471f73c7f | JavaScript | rahimniaz/PIAIC67153-RAHIMNIAZ | /task8.js | UTF-8 | 58 | 2.59375 | 3 | [] | no_license | var x = 3;
var y = 5;
var z = x + y;
document.write(z); | true |
776e67d34b777e1d40587ac307a3ebc062e92698 | JavaScript | dimitrilahaye/chat-app-course | /public/js/chat.js | UTF-8 | 3,108 | 2.5625 | 3 | [] | no_license | const socket = io();
const chatForm = document.querySelector('#chatForm');
const messageField = document.querySelector('#messageField');
const sendMessage = document.querySelector('#sendMessage');
const sendLocation = document.querySelector('#sendLocation');
const messages = document.querySelector('#messages');
const ... | true |
fe3c6818d5062e65d0175a6d6e8a7cfcef00ffd1 | JavaScript | RajuShetty/Bible-Quiz-Eng | /books/Heb5.js | UTF-8 | 5,037 | 3.09375 | 3 | [] | no_license | var quiztitle = " Hebrews chapter 5";
var quiz = [
{
"question" : " 1. Every high priest is ordained for men in things pertaining to ",
"image" : "",
"choices" : [
" a. God. ",
" b. Wrath. ",
" c. Judgment. ",
" d. Vengeance. "
],
"correct" : " a. God. ",
"explanation" : " For every high priest tak... | true |
a5f549b299c586593b2ee847228b762ccda15c06 | JavaScript | licarth/node-gtfs | /lib/utils.js | UTF-8 | 938 | 3.75 | 4 | [
"MIT"
] | permissive | /*
* Converts miles to degrees
*/
exports.milesToDegrees = miles => {
const milesPerDegree = 69.17101972;
return miles / milesPerDegree;
};
/*
* Pluralize a word based on count
*/
exports.pluralize = (word, count) => {
return count === 1 ? word : `${word}s`;
};
/*
* Extend a set of bounds with a point
*/
... | true |
9093af7af4115c2565c5ee615a64a0e7c6889a05 | JavaScript | JoLuMTavares/Most-Recent-Files_08-10-2018 | /challenges/sorting/main.js | UTF-8 | 6,694 | 4.1875 | 4 | [] | no_license | // Displaying a random number.
console.log('Random value: ', Math.random());
// Displaying a square root of 9
console.log('Square root of 9: ', Math.sqrt(9));
// Using the sort() Method to sort the array
// alphabetically.
var fruits = ["Banana", "Orange", "Apple", "Kiwi"];
console.log('Alphabetically ordered arr... | true |
29257302e3f9ea0d5b42304dfeb17a29ebb647f6 | JavaScript | vikisimovska/RithmSchool | /javascriptInfo.js | UTF-8 | 10,266 | 4.71875 | 5 | [] | no_license | //THIS IS HOW YOU DISPLAY/PRINT ANY OBJ WITH THE CONTENT INSIDE!!
//alert(user.toSource());
console.dir(ANYobject);
// Let's try to write a function called each which accepts two parameters: an array and a callback function. The each function should loop over the array passed to it and run the callback function on eac... | true |
3a8e2ab22cf8fb096e4df2e0bb9bd02acd5517bd | JavaScript | alshaw/dps-react-assessment | /client/src/components/Beers.js | UTF-8 | 2,211 | 2.546875 | 3 | [] | no_license | import React from 'react'
import axios from 'axios'
import { Header, Container, Grid, Item, Loader, Input } from 'semantic-ui-react'
import BeerItem from './BeerItem'
import InfiniteScroll from 'react-infinite-scroller';
class Beers extends React.Component{
state = {beers: [], page: 1, totalPages: 0, searchTerm: ""... | true |
0df55fa9ffa4da5e26ec06735f9bb325fe89f415 | JavaScript | bryant1410/node-threads-a-gogo2 | /example/httpServer.js | UTF-8 | 677 | 2.53125 | 3 | [] | no_license | var http = require('http');
var tagg = require('../index.js');
var assert = require('assert');
var th_func = function(){
var fibo =function fibo (n) {
return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1;
}
var n = fibo(45) + '';
thread.end(n);
}
http.createServer(function (request, response) {
r... | true |
b992de296b683d7363d0f39e248a8872d466671a | JavaScript | jsstein1995/Friend-Finder | /app/data/friends.js | UTF-8 | 1,518 | 3.234375 | 3 | [] | no_license | // ===============================================================================
// DATA
// Below data will hold all of the reserved tables.
// Initially we just set it equal to a "dummy" friend.
// But you could have it be an empty array as well.
// ===================================================================... | true |
208b48404c6eac4c4c184e18880a18e0aed35f1d | JavaScript | Nozomi2710/blokus-project | /exercise/TestObject.js | UTF-8 | 1,006 | 3.859375 | 4 | [] | no_license | var TestObject = function(param){
this.testVal=2;
this.testVal2 = param;
}//js因為彈性很大,在物件導向上並不是使用一般概念上的class,而是用類似function宣告的方式去做物件的實體
// 也就是說在js中會有function定義包住funtcion定義的情況
// 但是這樣會浪費過多的空間,可以改用prototype的方式將共用函示寫在其中
TestObject.prototype = {
testFunction1 :function(){
this.testVal3=10;
... | true |
c42ce15bfe1b369ce90ccb6a7cfc60996de868a1 | JavaScript | lehman-cuny2x/city-api-BryantS42 | /citysearch-app/src/App.js | UTF-8 | 2,081 | 2.890625 | 3 | [] | no_license | import logo from './logo.svg';
import './App.css';
class App extends Component{
constructor(props){
super(props);
this.state = {
items: [],
isLoaded: false,
}
}
promisePractice = (e) => {
let city = e.target.value.toLocaleUpperCase();
fetch('https://ctp-zip-api.herokuapp.co... | true |
034c23c1b346a21f07ffed5d45c2238016cfabbd | JavaScript | blendacosta/desafio-odin | /exercises/codewars/longestConsec.js | UTF-8 | 316 | 2.984375 | 3 | [
"MIT"
] | permissive | const longestConsec = (strarr, k) => {
let result = '';
let len = strarr.length;
if (len == 0 || k > len || k <= 0) {
return result;
}
for (let i = 0; i < len; i++) {
let str = strarr.slice(i, i + k).join('');
if (str.length > result.length) {
result = str;
}
}
return result;
};
| true |
bf7256cd0499acd8c9662c07a247332495fc0fe4 | JavaScript | ChrisChou-freeman/exampleForJest | /test/sum.test.js | UTF-8 | 220 | 2.859375 | 3 | [
"MIT"
] | permissive | const sum = require('../sum');
beforeAll(()=>{
console.log('run before')
});
afterAll(()=>{
console.log('run after');
});
test('adds 1 + 2 to equal 3', () => {
const data = sum(1,2);
expect(data).toBe(3);
});
| true |
b5c62f0989251600b9b4b1dda3da6e75dd458ee3 | JavaScript | juddbaguio/BagX-JS | /store.js | UTF-8 | 916 | 2.578125 | 3 | [] | no_license | export default class bgxStore {
constructor (stateFeatures={},methods={}) {
this.state = stateFeatures;
this.method = methods;
}
addStateFeature(obj) {
if (typeof obj === 'object') {
let props = Object.keys(obj);
props.forEach((key) => {
Obje... | true |
7200e8489c7f4f6577d2ea3f7c5c8b1fd0327b75 | JavaScript | S-Tangg/ife-homework | /day37/js/checkbox.js | UTF-8 | 4,312 | 2.78125 | 3 | [] | no_license | function funSetLocationStatue() {
var arrProductCheckbox = [];
var arrRegionCheckbox = [];
arrCheckbox.length = 0;
var objWrapper = document.getElementById("product-select");
var objInput = objWrapper.getElementsByTagName("input");
for (var i = 0; i < objInput.length; i++) {
arrProductC... | true |
4c423104d8f52ce31548c06e8dbfc65ee4ba5e0c | JavaScript | markkorput/Synesthesia | /public/javascript/visualizers/grassfield/grassfield.js | UTF-8 | 2,331 | 2.78125 | 3 | [
"MIT"
] | permissive | jQuery(function($) {
var server = io.connect('/grassfield');
server.on('welcome', function (data) {
console.log('welcomed', data);
});
var oflowData = [];
server.on('opticalFlow', function(data){
oflowData = data.zones;
});
var width = Math.max(960, innerWidth), //640
height = Math.max(... | true |
9e28d867a65be5812e7271060eb1be59f0d22332 | JavaScript | Severance462/OpenSWD | /Lab_6/MongoEmployee/server1.js | UTF-8 | 3,723 | 2.640625 | 3 | [] | no_license | //load express library
const express = require("express");
//load handlebars library
const hbs = require('hbs');
//express object
const app = express();
app.set('view engine', 'hbs');
const mongoose = require("mongoose");
const employee = require("./schema/employee.js");
var tId = "5c707d4a54f5fb24e4436118";
app.use... | true |
c98488f0f24e79ca745a6d3c31c1ccf5ae2fa091 | JavaScript | artur-silveira/my-lab | /pages/auto_increment_fields.jsx | UTF-8 | 960 | 2.75 | 3 | [] | no_license | import { useState } from 'react'
const Fields = () => {
const [ fields, setFields ] = useState([
{
id: new Date().getTime() + Math.random(),
value: ''
}
])
const addInput = () => {
setFields(fields => fields.concat([
{
id: new Date().getTime() + Math.random(),
valu... | true |
8d4e793e9feadb3ea12d287dd40727d23a67eca7 | JavaScript | evenbikramrana/myLibrary | /index.js | UTF-8 | 5,987 | 3.25 | 3 | [] | no_license | function Book(bookId, title, author, pages, isRead) {
this.title = title;
this.author = author;
this.pages = pages;
this.isRead = isRead;
this.bookId = bookId;
}
let myLibrary = restoreLocal();
const addBookToLibrary = (props) => {
if (myLibrary.some((book) => book.title === props.title)) return fals... | true |
cc679d9d662fbdb2ef14afdfcab3d4fbd4cb3aa2 | JavaScript | paper/LeetCodeV2 | /Algorithms/665. Non-decreasing Array.js | UTF-8 | 1,693 | 3.84375 | 4 | [
"MIT"
] | permissive | /**
* Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.
*
* We define an array is non-decreasing if array[i] <= array[i + 1] holds for every i (1 <= i < n).
*
* Example 1:
* Input: [4,2,3]
* Output: True
* Explanation: You could modify the ... | true |
6819a880e202f45cfcfcc644ccaa4f214659f18e | JavaScript | astares/ScarletSmallTalk | /bootstrap/runtime.js | UTF-8 | 16,622 | 2.53125 | 3 | [
"MIT"
] | permissive | function SmalltalkModuleWrapper(module) {
this.module = module
}
SmalltalkModuleWrapper.prototype.send = function (receiver, selector, arguments) {
//A smalltalk message send
return this.module.perform_withArguments_(selector, [receiver, arguments]);
}
function PrimitiveManager(_platform = 'common') {
this.platfo... | true |