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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9a4047b60c5bb63f5254b641dab755d5a6b809c0 | JavaScript | ArondevIta/execicios-js | /isimpar.js | UTF-8 | 340 | 3.9375 | 4 | [] | no_license | /*
Dado um vetor de números, como poderia ser realizada a
soma de todos os valores ímpares utilizando reduce e filter.
*/
const vetor = [1, 2, 3, 4, 5]
const ehimpar = numero => numero % 2 !== 0
const somadora = (total, atual) => total + atual
const soma = vetor.filter(ehimpar).reduce(somadora, 0)
console.log('Soma do... | true |
61cb4f663e9c88b9de0f56810d036be921fe19cc | JavaScript | excaliburnt/homework2 | /instrument.js | UTF-8 | 816 | 3.296875 | 3 | [] | no_license | const instrumentForm = document.querySelector('#instrumentForm')
instrumentForm.addEventListener('submit', handleSubmit)
const details = document.querySelector('#details')
function handleSubmit(ev) {
ev.preventDefault()
const form = ev.target
const details = document.querySelector('#details')
const instrumen... | true |
6bdc9b084464d59ae2c964737a04d070716ea410 | JavaScript | SoumyaDey1994/Movie-Rental-App-Backend | /objectId.js | UTF-8 | 339 | 2.6875 | 3 | [] | no_license | const mongoose= require('mongoose');
let id= new mongoose.Types.ObjectId;
console.log(`New Object Id: ${id}`);
console.log(`Time of Object Id creation: ${id.getTimestamp()}`);
let arbitaryObjId= '5b0ew618074c203bd823f1c2';
console.log(`Object Id ${arbitaryObjId} is a valid object id: ${mongoose.Types.ObjectId.isValid... | true |
dc50747dd9bf46430f9f8b71f445b5318d584f39 | JavaScript | JacobYolles/Pupsters | /src/pages/Discover.js | UTF-8 | 2,998 | 3.03125 | 3 | [] | no_license | import React, { Component, Fragment } from "react"
import API from "../utils/API"
// in line styling process where styles are drawn from style={styles.image} styles is the const and image is the variable wanted from inside of it.
const styles = {
image: {
width: 300,
padding: "0 15px"
},
bu... | true |
0615e7f393fa4b46b2cef1918564e7618a4b8a49 | JavaScript | kaushalkumar/appflow | /public/javascripts/appflow.js | UTF-8 | 236 | 2.625 | 3 | [] | no_license |
function highlightMenu(menuItemId) {
//remove active from all menu ids
var menuItems = $("li[id^=menu_]");
$(menuItems).removeClass("active");
//add class
var menuItem = $("li"+"#"+menuItemId);
$(menuItem).addClass("active");
}
| true |
781d7a2ed96c194e2e757d7df807f049cc897b00 | JavaScript | mariafedorova12/js-module-02 | /src/29.js | UTF-8 | 448 | 3.671875 | 4 | [] | no_license | 'use strict';
function getEvenNumbers(start, end) {
// Change code below this line
const numbers = [];
for (let i = start; i <= end; i += 1){
if(i % 2 === 0) {
numbers.push(i);
}
}
return numbers;
}
console.log(getEvenNumbers(2, 5));
console.log(getEvenNumbers(3, 11));
console.log(ge... | true |
d16a8691caea7222480643ab01c8de220ede45a4 | JavaScript | achichikalova/kata | /camelCase.js | UTF-8 | 309 | 3.078125 | 3 | [] | no_license | const camelCase = function(input) {
return input
.replace(/\s[a-z]/g, function($1) { return $1.toUpperCase(); })
.replace(/\s/g, '')
};
console.log(camelCase("this is a string"));
console.log(camelCase("loopy lighthouse"));
console.log(camelCase("supercalifragalisticexpialidocious")); | true |
6eeb8a7e42b9a69fc370c888a32685cbbe0a1022 | JavaScript | rogonzalezb/ArtPort-ProyectoFinal | /www/js/my-app.js | UTF-8 | 46,922 | 2.671875 | 3 | [] | no_license | // If we need to use custom DOM library, let's save it to $$ variable:
var $$ = Dom7;
var app = new Framework7({
// App root element
root: '#app',
// App Name
name: 'My App',
// App id
id: 'com.myapp.test',
// Enable swipe panel
panel: {
swipe: 'left',
},
// Add default routes
routes: [{
... | true |
3337b92f27e7a0da7c81b36ba006df20b112eeab | JavaScript | HunXmoN/myFrstReact | /1-helloworld/src/App.js | UTF-8 | 2,682 | 2.953125 | 3 | [] | no_license | import React, { Component } from 'react'
// https://medium.com/@eshwaren/enable-emmet-support-for-jsx-in-visual-studio-code-react-f1f5dfe8809c
class App extends Component {
constructor(){
super()
this.state = {
firstname : '',
lastname : '',
name : ''
}
... | true |
06fc71688c353c1bba0a49a14d716cdf00530305 | JavaScript | JagerHunted/-UNSUPPORTED-UNMAINTAINED-Nexus.log | /Source/Index.js | UTF-8 | 1,329 | 2.578125 | 3 | [
"MIT"
] | permissive |
/*
Nexus.log — Index.js
*/
const Colors = require('colors');
const Time = require('time-stamp');
const File = require('fs')
var Path = ""
class Log {
constructor(Message) {
this.Message = Message
}
CreateLogger(JSONObj) {
if(JSONObj == null) {
console... | true |
18861bc0be737991077225055df9a8d58b955f8d | JavaScript | juanpablo1997/MERNTanks-cliente | /src/context/tareas/TareaState.js | UTF-8 | 3,778 | 2.59375 | 3 | [] | no_license | // DEPENDENCIAS DEL COMPONENTE TareaState:
import React, { useReducer } from "react";
// COMPONENTES COMPLEMENTARIOS:
import TareaContext from "./TareaContext";
import TareaReducer from "./TareaReducer";
// Types:
import {
TAREAS_PROYECTO,
AGREGAR_TAREA,
VALIDAR_TAREA,
ELIMINAR_TAREA,
ESTADO_TAREA,
TAREA_... | true |
5a07bf5e9ff7384f3eb1c14dba07da8c755f6bf2 | JavaScript | LhexyRomero/CAPSTONE_ZOODIS | /js/public/js/researcher/journal.js | UTF-8 | 2,169 | 2.609375 | 3 | [] | no_license | let isClicked = 0;
$(function(){
$(".stats").hide();
});
function uploadJournal(e){
e.preventDefault();
if (isClicked != 0) {
return;
}
isClicked++
let data = $("#collabForm").serializeArray();
let errCount = 0;
let invCount = 0;
let dataInsert = new FormData($("#collabFo... | true |
bda8b762d7684578d96021568b8ddfdc23b78e41 | JavaScript | hexlet-components/js-types | /index.js | UTF-8 | 644 | 3.21875 | 3 | [] | no_license | // @ts-ckeck
import * as pairs from '@hexlet/pairs';
/**
* Tagged data constructor
* @name attach
* @example
* attach('typeOfTag', data); // ('typeOfTag', data)
*/
export const attach = (tag, data) => pairs.cons(tag, data);
/**
* Get type of tagged data
* @name typeTag
* @example
* const tag = attach('simpl... | true |
9552a7633d5ee56ad73285acd1534ec66669704c | JavaScript | DevFabianMoreno/proyectosjs | /1-fundamentos/recursos/js/bases/alertas.js | UTF-8 | 142 | 2.625 | 3 | [] | no_license | alert('Hola mundo');
let nombre = prompt('Cual es tu nombre');
let seleccion = confirm("Esta seguro de borrar esto");
console.log(seleccion);
| true |
19f9584efb0de8a415270ccacc5342692173897c | JavaScript | MetehanYetkin/1030522917_BS436_WebProgramlama | /odev07/src/client/home.jsx | UTF-8 | 3,257 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react';
import { useHistory } from "react-router-dom"
export class Home extends Component {
constructor(props) {
super(props);
this.routeChange = this.routeChange.bind(this)
this.state = {
loginText : "",
usrValue: "",
psw... | true |
bd33fe9ffcb2f4e2fa37f445b13272bf23eeb142 | JavaScript | qlinhn3/qlinhn3.github.io | /LTWeb_HK1_2019_Thu6/Week08_JavaScriptCB_NC_23h_29_10_2018/week8_JS_SuNgocAnhKhoa_42.01.104.234/nâng cao/js/bai8.js | UTF-8 | 190 | 2.78125 | 3 | [] | no_license | function daochuoi(){
var s = document.getElementById("Chuois").value;
var kq="";
for(var i=s.length -1;i>=0;i--){
kq+=s.charAt(i);
}
document.getElementById("xuat").innerHTML = kq;
}
| true |
2980dfce0e9e1bcfbf3ee6fada8215f4c9c33110 | JavaScript | bcutrell/financeu | /public/javascripts/financeu_ui.js | UTF-8 | 2,871 | 2.8125 | 3 | [] | no_license | // TODO: use var exchangeCount = []
// to implement a running count of which exchange
// trades a taking place
var symbols = []
var socket = io.connect();
$(document).ready(function() {
$("#tickerForm").fadeIn(500);
getQuoteStream(socket);
getTradeStream(socket);
getQuoteData(socket);
getTickerInput(socket,... | true |
0819e623639150ce54e06ed2a812ccbe807c1da2 | JavaScript | 501981732/myblog | /src/other/array.js | UTF-8 | 5,909 | 3.734375 | 4 | [] | no_license | // Array
// 1. 返回数组最大值
const arrayMax = arr => Math.max(...arr)
const arrayMax2 = arr => Math.max.apply(null, arr)
const arrayMax3 = arr => arr.reduce((n1, n2) => n1 > n2 ? n1 : n2)
const arrayMax4 = arr => Reflect.apply(Math.max, Math, arr);
// 2. 返回数组最小值
const arrayMin = arr => Math.min(...arr)
const arrayMin2 = a... | true |
0ce8369bc413d73ca533e16bc4f96bd8463d6b5a | JavaScript | Brucegyx/Jamming | /src/Components/App/App.js | UTF-8 | 3,130 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Spotify from '../../util/Spotify.js';
import {SearchResults} from '../SearchResults/SearchResult';
import {SearchBar} from '../SearchBar/SearchBar';
import {PlayList} from '../Playlist/Playlist';
class App extends React.... | true |
4e7d87eca45648f01885c1362087581d171969c3 | JavaScript | ActionPHP/wpsegment | /segment/templates/default/js/script.js | UTF-8 | 2,291 | 2.828125 | 3 | [] | no_license | $(document).ready(function () {
$('#submit-segment-quiz').click(validateQuiz);
$(':radio').change(function(e){
var question_id = getQuestionIDFromAnswer( $(this).attr('name') );
changeQuestionColor(question_id, true);
})
});
function validateQuiz(){
if(totalQuestionsAnswered()){
submitSegmentQuiz... | true |
a66475edf3ffe19665223e270c7fda4ab55f21d9 | JavaScript | bradripple/Pokedex | /dbTest.js | UTF-8 | 13,811 | 3.046875 | 3 | [] | no_license | const db = require('./models');
const axios = require('axios');
// test data
const testGames = [
{name:'red'},
{name:'blue'}
];
const testTypes = [
{name:'water'},
{name:'fire'},
{name:'grass'},
{name:'normal'},
{name:'electric'}
];
const testMoves = [
{
name: 'Scratch',
... | true |
5e55133b72a82418f102c077d5e741cf82c8c593 | JavaScript | zubiroot1/LM2021 | /Recuperacion JS/FORMULARIO/main.js | UTF-8 | 1,928 | 3.265625 | 3 | [] | no_license | function validarFormulario() {
var cadenaError = "";
var str = document.getElementById("login").value;
var login = document.getElementById("login");
if (login.value == null || login.value.length == 0) {
cadenaError = "<li>Error login: campo vacío</li>";
} else if (login.value.length < ... | true |
7fdf84ffbf2006a0a0d5e217551a7b2951bea067 | JavaScript | atomicobject/ts-workshop | /exercises/exercise-0/insight.js | UTF-8 | 508 | 3.671875 | 4 | [] | no_license |
const subtractOne = (n) => {
if (n > 0) return n - 1;
};
const foo = subtractOne(0);
// There's a bug here. Do you see it? TypeScript does.
console.log(foo.toString());
// (Yes, of course you see it because you're an infinitely
// aware and wise programmer. Let's suspend disbelief for
// a moment and pretend we... | true |
a60a1fd7f34319f4e42bbcb8601fcbdf78e932ec | JavaScript | CainanB/GOTAPIpractice | /got.js | UTF-8 | 2,175 | 3.5625 | 4 | [] | no_license | // var chars = "https://www.anapioficeandfire.com/api/characters?page=43&pageSize=50";
// //2133 Chracters
// fetch(chars)
// .then(response => response.json())
// .then(data => {
// console.log(data);
// })
// .catch(error => {
// console.log(error);
// })
$(function ()... | true |
60f86fc777c130145fa08929eb5a4c217dc62f5f | JavaScript | SydPRetzel/HelpHub | /client/src/components/Chat/Message/index.js | UTF-8 | 737 | 2.515625 | 3 | [
"MIT"
] | permissive | import React from "react";
class Message extends React.Component {
render() {
// Was the message sent by the current user. If so, add a css class
const fromMe = this.props.fromMe ? "from-me" : "";
return (
<div className={`message ${fromMe}`}>
<div className="username">
<img
... | true |
6fee70354ef447d95534b331ab76dbcb928a184c | JavaScript | vishnu-codes/ColorRandom | /main.js | UTF-8 | 463 | 3.109375 | 3 | [] | no_license | const colors = ['#CAF4F4','#FCFFE9','#FFF2CC','#FDE0D9','#CAEFD1'];
const btn = document.getElementById("btn");
const color = document.querySelector(".color");
btn.addEventListener("click" , function () {
const randomNumber = getRandomNumber();
document.body.style.backgroundColor = colors[ randomNumber];
c... | true |
fcfb398b52792a50d164fa2ea8c61fd94c3a62b7 | JavaScript | drewbs/guardian_app | /js/my_guardian.js | UTF-8 | 684 | 2.640625 | 3 | [] | no_license | function myFunction() {
$(document).ready(function() {
var inputVal = $("#input_name").val();
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "http://content.guardianapis.com/search?q=" + inputVal + "&format=json&api-key=some_random_api_key",
success: function(data)... | true |
632d605a49cfac9a942b18188ba1a18c2fbe6e32 | JavaScript | crane0/node-test | /08IO.js | UTF-8 | 328 | 2.59375 | 3 | [] | no_license | const glob = require('glob')
let result
// 同步
// console.time('glob')
// result = glob.sync(__dirname + '**/*')
// console.timeEnd('glob')
// console.log(result)
// 异步
console.time('glob')
glob(__dirname + '**/*', function(err, res){
result = res
console.log('异步')
})
console.timeEnd('glob')
console.log(1 + 1) | true |
21095bf5e683e4f46b26f244d9e19afbc4dd953d | JavaScript | NoobOvO/webFront | /src/server/nodeserver.js | UTF-8 | 696 | 2.671875 | 3 | [
"MIT"
] | permissive | const http=require("http");
const url=require("url");
const app=http.createServer();
app.on("request",function (req,rsp) {
//text/plain 纯文本模式 text/html html模式
rsp.writeHead(200,{'content-type':'text/html;charset=utf8'});
let{query,pathname}= url.parse(req.url,true);
//query就是拿出?后面的参数 并以键值对的方式表示
//pathname... | true |
991b4930776cc84fe4814d698b33a22d7ae28263 | JavaScript | NikolaPerisic/algorithms-and-data-structures | /string-anagram.js | UTF-8 | 1,588 | 4.5625 | 5 | [] | no_license | /*
* Two words are anagrams of one another if their letters can be rearranged to form the other word.
* In this challenge, you will be given a string. You must split it into two contiguous substrings, then determine the
minimum number of characters to change to make the two substrings into anagrams of one another.
*... | true |
9d638a85f81029e69cd0b15b80f451d567e97b27 | JavaScript | LeVarneBV/CLI | /basics/init.js | UTF-8 | 3,475 | 2.515625 | 3 | [] | no_license | const shell = require('shelljs');
const git = require('simple-git/promise');
const path = require('path');
const fs = require('fs');
const inquirer = require('inquirer');
const { printMessage, printErrorMessage } = require('../messages');
module.exports = async function(project, options) {
switch (project) {
ca... | true |
7d0f0881468760ee2236520288df9e7cebaf8441 | JavaScript | strongdan/javascript-exercises | /calculator/calculator.js | UTF-8 | 550 | 3.609375 | 4 | [] | no_license | function add (n1, n2) {
return n1 + n2;
}
function subtract (n1, n2) {
return n1 - n2;
}
function sum (arr) {
let sum = 0;
for (let i = 0; i < arr.length; i++) {
sum += arr[i];
}
return sum;
}
function multiply (arr) {
let product = 1;
for (let i = 0; i < arr[i]; i++) {
product *= arr[i];
}
return prod... | true |
1748ade4b0caef7b4c5d52cc295e46798098011d | JavaScript | yang131323/practice | /node/nowCoder/swordOffer/five.js | UTF-8 | 544 | 3.8125 | 4 | [] | no_license | /**
* 5. 用两个栈实现队列
* 解题思路:一个栈用来写入,另一个栈用来输出,但是在输出的时候一定要把写入的那个栈清空
* @param {Number} node
*/
const stackOne = [], stackTwo = [];
function push(node) {
stackOne.push(node);
}
function pop() {
if (stackTwo.length <= 0 && stackOne.length <= 0) {
return null;
} else if (stackTwo.length <= 0) {
const len = st... | true |
916ce59f91e376a341b7d544ca1e0784453f8359 | JavaScript | WalterKstro/react-Hooks | /src/tests/components/useReducer/todoReducer.test.js | UTF-8 | 1,374 | 2.6875 | 3 | [] | no_license | import todoReducer from "../../../components/useReducer/todoReducer"
import state from "./dataTodos"
describe('Testing reducer todoReducer', () => {
test('should return a array state', () => {
const stateTodo = todoReducer(state,{})
expect(stateTodo).toEqual(state)
})
test('should ad... | true |
81ac872f59827ef72fee089d4c6109e99c1a8077 | JavaScript | musasesay/The-Complete-React-Web-Developer-Course-with-Redux- | /Section 1 - React Introduction/Section 1.4 - JSX Expressions/indecision-app/Public/scripts/app.js | UTF-8 | 1,869 | 3.6875 | 4 | [] | no_license | 'use strict';
//JavaScript Variables:
var userName = 'John Doe';
var userAge = 28;
var userLocation = 'London';
var user = {
name: 'Lillith Grace',
age: 30,
location: 'Nottingham'
};
//JSX Expression One:
var template = React.createElement(
'div',
null,
React.createElement(
'h1',
null,
... | true |
b6d7faea336050a6ea505ff308cafe2b80448619 | JavaScript | Davoleo/web-tests | /js/react/states.jsx | UTF-8 | 868 | 3.40625 | 3 | [] | no_license | let CheckBox = class extends React.Component {
constructor(props) {
super(props);
this.state = {checked: true};
//With React and ES6 - you need to bind the method to the class before referencing "this" in that method
this.changeCheckboxState = this.changeCheckboxState.bind(this);
... | true |
8f46a465308b288368a66fdc7d8779dfad3f822f | JavaScript | ReactLearning/reactGitHubProfile | /Card.jsx | UTF-8 | 2,554 | 2.734375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
class Card extends React.Component
{
constructor(props)
{
super(props);
this.state = {
avatar_url: '',
login:''
};
}
componentDidMount()
{
var component = this;
$.get("https://api.... | true |
e95d5a127c58868603d3744a1cdeb569a3f7607b | JavaScript | kristian-angelski/devise-expert-homeworks | /homework_01/task04/main.js | UTF-8 | 651 | 4.15625 | 4 | [] | no_license | Array.prototype.findMin = function () {
//връща минималния елемент в масива
let min = this[0];
for (let i = 1; i < this.length; i++) {
if (this[i] < min) {
min = this[i];
}
}
return min;
};
Array.prototype.findMax = function () {
//връща максималният елемент в масива
let max = this[0];
f... | true |
dd2ffd5164c13d39843b3b91ab9fe35ecf626e0e | JavaScript | thorntonjdt/Cornerstone | /src/components/CreateAccountForm/CreateAccountForm.js | UTF-8 | 4,669 | 2.515625 | 3 | [] | no_license | import React from 'react';
import Input from 'components/Input/Input';
import FilledButton from 'components/FilledButton/FilledButton';
import styles from './CreateAccountForm.css';
class CreateAccountForm extends React.Component {
constructor(props){
super(props);
this.state = {
role: props.chooseRo... | true |
48ec22447a84a7acc11f3c666cce010fda1d0c2b | JavaScript | Hamilsauce/rxjs-sandbox | /calendar (backup safe)/RenderEngine.js | UTF-8 | 1,780 | 2.609375 | 3 | [] | no_license | import ham from 'https://hamilsauce.github.io/hamhelper/hamhelper1.0.0.js';
class DOMinator {
constructor(rootSelector = '') {
this.root = typeof rootSelector === 'string' ? document.querySelector(rootSelector) : '';
this.watches = []
// this.DOM = this.eachNode(this.root, this)
setTimeout(() => con... | true |
cccd25cd20b7c9937163b774f1d3f7f8b70a19f0 | JavaScript | tansuluu/Opentravel | /src/main/resources/static/folderforindex/js/offers_custom.js | UTF-8 | 5,159 | 2.765625 | 3 | [
"MIT"
] | permissive | /* JS Document */
/******************************
[Table of Contents]
1. Vars and Inits
2. Set Header
3. Init Menu
4. Init Isotope Filtering
5. Init Search
6. Init More Options
7. Init Search Form
******************************/
$(document).ready(function()
{
"use strict";
/*
1. Vars and Inits
*/
var me... | true |
6e6351986d5b63602f156a05b0c2e3acdd0a64db | JavaScript | jiangchengxu/30DaysOfReact | /Code/13th_challenge/solution.js | UTF-8 | 1,866 | 2.90625 | 3 | [] | no_license | const CardHead = (props) => {
const {title} = props;
return (
<div className="card-head">
<h3>{title}</h3>
</div>
);
}
const CardBody = (props) => {
const {url, body} = props;
return (
<div className="card-body">
<img src={url} />
<p>{body}</p>
</div>
);
}
const Card = ... | true |
230dfcb21bce4225fee2e093aaa52c3d415aaf33 | JavaScript | getrudech/PROJECT2 | /JS/main.js | UTF-8 | 2,066 | 3.578125 | 4 | [
"MIT"
] | permissive | let button = document.getElementById("btn");
let birthYear = document.getElementById("year");
let birthMonth = document.getElementById("month");
let birthDay = document.getElementById("day");
let male = document.getElementById("male");
let female = document.getElementById("female");
const form = document.querySelector(... | true |
509f866b4d0f8a84221ab929ee65b9c7d7d11fdb | JavaScript | vhpoet/bakapunk | /index.js | UTF-8 | 4,662 | 2.96875 | 3 | [
"ISC"
] | permissive | var fs = require("fs");
var spawn = require('child_process').spawn;
var loki = require("lokijs");
var readline = require("readline");
var columnify = require("columnify");
require("colors");
// Music directory
var MUSIC_DIR = fs.readFileSync("music_dir.txt", {encoding: "utf8"});
// Distance metric based on ... | true |
153c067b1cf19e304ea3bc4c653697c878c2863d | JavaScript | BitApp/BitPal | /services/util/util.js | UTF-8 | 3,381 | 2.5625 | 3 | [
"MIT"
] | permissive | const crypto = require('crypto')
const language = {
zhcn:require("../locales/zh-cn.json"),
enus:require("../locales/en-us.json"),
zhhk:require("../locales/zh-hk.json")
}
var mOpbeat = null
var getWords = function(acceptLanguage, key){
acceptLanguage = acceptLanguage || ""
let lang = acceptLanguage... | true |
0e38cfe92d9ac64e6de40f23af4a5338bd05ed46 | JavaScript | jagatjeevan/problems | /test/array-intersection.test.js | UTF-8 | 440 | 2.609375 | 3 | [
"MIT"
] | permissive | const findIntersection = require("../src/array-intersection");
describe("Array Intersection", () => {
it("renders intersection", () => {
const a = [1, 3, 5, 9];
const b = [3, 9, 11];
expect(findIntersection(a, b)).toEqual([3, 9]);
});
it("renders duplicate intersections as well", () => {
var a1 ... | true |
c203edd4e40bf399574b5e68f65900ec007f0c34 | JavaScript | shanepower1/FYP | /src/screens/MyBookings.js | UTF-8 | 1,930 | 2.796875 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { Text, Card } from "react-native-elements";
import { useAuth } from "components/AuthContext";
import { getUser, getScheduledClass, getClass } from "functions/database";
import MyView from "components/MyView";
import { formatDate, formatTime } from "functions/f... | true |
fd7ce41cb2b36a86dc7c206d97e51f5c10e44e06 | JavaScript | WayneJz/COMP9041-18S2 | /Lab12/fetch_and_list_2/fetch.js | UTF-8 | 438 | 2.984375 | 3 | [
"MIT"
] | permissive | (function() {
'use strict';
const path = 'https://jsonplaceholder.typicode.com/posts';
fetch(path)
.then(response => response.json())
.then(data => data.reduce((parent, post) => {
const sublist = document.createElement('div');
sublist.textContent(post["title"]);
... | true |
89f8ec0ed65e1cd1da3fe340aab2af2ecbea4dcc | JavaScript | uufe-flyelephant/examples | /nodejs/03-eventloop/index.js | UTF-8 | 760 | 2.9375 | 3 | [] | no_license | const fs = require('fs');
const setTimeOutlogger = ()=>{
console.log('setTimeout logger');
}
const setImmediateLogger = ()=>{
console.log('setImmediate logger');
}
//For timeout
setTimeout(setTimeOutlogger, 1000);
//File I/O operation
fs.readFile('test.txt', 'utf-8', (data)=>{
console.log('Reading data 1');
}... | true |
b215f9798effb93d96bcad3249385e9f6ff36dea | JavaScript | daehoanshin/nodejs-lab | /easyspub/ch03_test10.js | UTF-8 | 332 | 3.703125 | 4 | [] | no_license | var users = [{name: '소녀시대', age: 20}, {name: '걸스데이', age: 22},
{name: '티아라', age: 21}];
for (var i = 0; i < users.length; i++) {
console.log('배열 원소 # ' + i + ' : ' + users[i].name);
};
users.forEach(function (elem, index) {
console.log('배열 원소 # ' + index + ' : ' + elem.name);
}); | true |
c622b4a1124f6b3a24910fa995d722e7efeaee65 | JavaScript | swirlingskirts/platformer-practice-game | /src/scenes/PlayScene.js | UTF-8 | 3,895 | 2.5625 | 3 | [] | no_license | import Phaser from 'phaser';
import Player from '../entities/Player';
import Enemies from '../groups/Enemies';
import initAnims from '../anims';
class PlayScene extends Phaser.Scene {
constructor(config) {
super('PlayScene', config);
this.config = config;
}
create() {
const map = this.createMap(... | true |
6bb44ece77eec875c9c300b2ffbc1ed3c4c5d1a0 | JavaScript | dhamotharang/source | /CPTS/.svn/pristine/dd/dd0d1e96d437a74ce1caa809a818f88b65a9227c.svn-base | UTF-8 | 1,358 | 2.53125 | 3 | [] | no_license | /**
* Load页面的方法
* @param boxId load进去的divId
* @param url load的Url
* @param paramJson
* @returns
*/
function LoadPage(boxId, url, paramJson) {
$(".layui-table-tips").remove();
var returnFlag = 0;
$.ajax({
url: contextPath + "/setLinkUrl",
dataType: 'json',// 数据类型
type: "POST",
data: { linkUrl:url },
... | true |
6c87bdc01b2a16aaf8d8601bf4fba97b8ea96c25 | JavaScript | johnnyg/timetabler | /timetable.js | UTF-8 | 3,669 | 2.765625 | 3 | [] | no_license | // Returns current week of the semester
function currentWeek() {
var today = new Date();
var diff = new Date (today.getTime()-O_WEEK.getTime());
var week = Math.floor(diff.getTime() / (1000 * 60 * 60 * 24 * 7));
if (today >= MID_BREAK) {
week--;
}
return week;
}
// Returns the week the timetabl... | true |
c501b2329838e626b793cb91c18395d45255e79a | JavaScript | knurdDongle/javascript-code-reuse-patterns | /source/components/composition/Mixins/PrivilegedMixin.js | UTF-8 | 2,160 | 2.84375 | 3 | [] | no_license | kind_of_module_exports("PrivilegedMixin", function () {
/*
- any function object that is a container of at least one public behavior
or acts as collections of more than one public behavior and is intended
to neither being invoked by the call operator >>()<< nor with the >>new<<
operator but always should... | true |
86d8fd7c5476fac1c5db0dc6d308ec968e8e80c7 | JavaScript | zmcadie/LHL_lectures | /2021/east_jun_21/W2D1/test/repeatNumbers.test.js | UTF-8 | 1,074 | 3.625 | 4 | [] | no_license | const expect = require('chai').expect
const repeatNumbers = require('../repeatNumbers')
// Create a function named repeatNumbers that will return a string (or null if no values passed) with each of the given values repeated the appropriate number of times, if there are multiple sets of values each set should be separa... | true |
9307ed407ef7b6facc94bb88e6f6cef0c0067da1 | JavaScript | bdmostafa/JS-problems | /wordCount.js | UTF-8 | 495 | 3.390625 | 3 | [] | no_license | let speech = "a set of words that is complete in itself, typically containing a subject and predicate, conveying a statement, question, exclamation, or command, and consisting of a main clause and sometimes one or more subordinate clauses.";
console.log(speech.length); // 255
let count = 0;
for (let i = 0; i < spee... | true |
994ad6bb58245ba7f8bf010c2438d0b256f5d047 | JavaScript | ianemcallister/sqrComCalc | /squareAPI.js | UTF-8 | 4,258 | 3.171875 | 3 | [] | no_license | /*
* SQUARE API
*
* This is module handles all of our square API needs
*/
// DECLARE DEPENDENCIES
let SquareConnect = require('square-connect');
let defaultClient = SquareConnect.ApiClient.instance;
// Configure OAuth2 access token for authorization: oauth2
let _oauth2 = defaultClient.authentications['oauth2'];
... | true |
68745332164436bb5a22c29163a502dff449eeb1 | JavaScript | dusigner/consulado | /src/Scripts/modules/_datalayer-inline.js | UTF-8 | 806 | 2.890625 | 3 | [] | no_license | /**
* click an element to GTM DataLayer
* Place attr data-grm html element and add class js-track-gtm
* example: class="js-track-gtm" data-gtm="Category|action|label|event"
*/
export const checkInlineDatalayers = () => {
$('body').on('click', '.-js-track-gtm', function() {
const gtmData = $(this)
.attr('data-... | true |
76ed57c5f388b93f610e3853c2ef0f0c6551683e | JavaScript | Enna08/Enna08.github.io | /scripts/note-hidden.js | UTF-8 | 2,393 | 2.890625 | 3 | [] | no_license | const unhideButton = document.getElementById('unhide');
const confirmButton = document.getElementById('confirm');
const returnButton = document.getElementById('return');
const heading = document.getElementById('heading');
function enableDisableSelection( primaryColor, selectedColor ){
const noteBoxDivs = document.... | true |
d80f9308d861df98699a9888ce30dbaac14f8fbb | JavaScript | gisellequarto/JavaScript-FirstSteps | /fundamentos/tipagemFraca.js | UTF-8 | 220 | 3.03125 | 3 | [] | no_license | let qualquer = "legal";
console.log(qualquer);
console.log(typeof qualquer);
//o fato de ter uma tipagem fraca, nao quer dizer que não exista tipo
qualquer = 5.48;
console.log(qualquer);
console.log(typeof qualquer); | true |
88dbbad26e89e2d913f5cf27dc434500529ab68b | JavaScript | dave-vazquez/node-server-testing-challenge | /__tests__/emoji_tests.js | UTF-8 | 750 | 2.9375 | 3 | [] | no_license | describe('emoji functions', () => {
describe('get emojis', () => {
it('should return a smile emoji', () => {
expect(emoji.get('smile')).toBe('😄');
});
it('should return a sad emoji', () => {
expect(emoji.get('sad')).toBe('😢');
});
it('should throw an error', () => {
expect(emoj... | true |
8b198338251c577c9eefb298564b8ca23ac62854 | JavaScript | phetsims/perennial | /js/common/getDataFile.js | UTF-8 | 481 | 2.65625 | 3 | [
"MIT"
] | permissive | // Copyright 2018, University of Colorado Boulder
/**
* Load a data file from perennial/data/
* @author Michael Kauzmann (PhET Interactive Simulations)
*/
const fs = require( 'fs' );
/**
* @public
*
* @param {string} listName - name of the perennial data file
* @returns {string[]} - list of the items in the p... | true |
a67b4aeee698db66cec54448b02612a34a9113a4 | JavaScript | jpallath/soul_eater | /src/AppComponents/MangaViewer.js | UTF-8 | 2,813 | 2.65625 | 3 | [] | no_license | import React, { Component } from "react";
import axios from "axios";
import configData from "../config.json";
class MangaViewer extends Component {
constructor(props) {
super(props);
this.state = {
mangaka: "",
series: "",
fullPages: [],
currentPage: 0,
};
this.go... | true |
a0a8bbcca0b8f6f35f70bca3db40d8d91346ed26 | JavaScript | pblz/travel-app | /src/client/js/populateSavedTrips.js | UTF-8 | 1,451 | 3.03125 | 3 | [] | no_license | /*
Get saved trips from localStorage and display in UI
*/
const fetch = require('node-fetch');
function populateSavedTrips() {
try {
//Get Element by ID
var tripElement = document.getElementById("mytrips");
// get trips from storage
var storedTrips = JSON.parse(localStorage.getIte... | true |
27261df66d299a466059a21d57fbe0217879e221 | JavaScript | robin-zhao/rzLearning | /javascript/language/invocation/apply-invocation-pattern.js | UTF-8 | 300 | 4.125 | 4 | [] | no_license | // example 1
var add = function(num1, num2) {
console.log(num1+num2);
}
array = [3,4];
add.apply(null,array); //7
// example 2
var obj = {
data:'Hello World'
}
var displayData = function() {
console.log(this.data);
}
displayData(); //undefined
displayData.apply(obj); //Hello World
| true |
7e2330fe90268d7851e695b1378ea8e7073e0b57 | JavaScript | EA-Grup1QP2016/Sand-Pit | /config/passport.js | UTF-8 | 1,958 | 2.53125 | 3 | [] | no_license | /*
* Define passport strategies, i.e. what to do with the credentials
* provided by the OAuth provider
*/
var User = require('../schemas/user.js');
var service = require('./service');
var FacebookStrategy = require('passport-facebook').Strategy;
// load our auth.js config parameters
var configAuth = require('./aut... | true |
5690b322ecc8eb008b9a2afbac652e2e0f85cfe2 | JavaScript | actarian/stipa | /src/js/accordion/accordion.component.js | UTF-8 | 775 | 2.546875 | 3 | [
"MIT"
] | permissive | import { Component } from 'rxcomp';
let ACCORDION_UID = 0;
export default class AccordionComponent extends Component {
onInit() {
this.items = {};
}
register(item) {
this.items[++ACCORDION_UID] = item;
}
unregister(item) {
const uid = Object.keys(this.items).reduce((uid, key) => {
if (this.items[key]... | true |
a55b2151ce0844342d5e79a76ca55799aa7167f7 | JavaScript | Zelechos/Pragmatic_NodeJs | /variables_entorno.js | UTF-8 | 691 | 3.5625 | 4 | [] | no_license | // Creando una Variable de entorno
// el operador logico || sirve para darle un valor por defecto a nuestra variable
let secret = process.env.SECRET || "secreto no existe";
let web = process.env.WEB || "web no existe";
// ejemplo
let token = process.env.SECURITY_TOKEN || "LAJSDBVF21347F62345F2B45F234Y5";
let github ... | true |
4fa1a06e957e6ea4b0ea83032ceb2208b013f609 | JavaScript | ZhangHang0310/project_03 | /assets/js/article/art_list.js | UTF-8 | 5,246 | 2.671875 | 3 | [] | no_license | $(function() {
var laypage = layui.laypage;
//定义一个查询参数的对象,将来请求数据时,
//需要将请求参数对象提交的服务器
var q = {
pagenum: 1, //页码值
pagesize: 3, //每页显示多少条数据
cate_id: "", //文章分类的 Id
state: "" //文章的状态
}
initList();
getInitCate()
//请求文章列表数据,并渲染数据
function initList() {
... | true |
39f1dda99483ea9477841c815c9e353d8582180b | JavaScript | dantebhang/Local-Library | /public/src/accounts.js | UTF-8 | 951 | 2.859375 | 3 | [] | no_license | function findAccountById(accounts, id) {
return accounts.find((account) => account.id === id);
}
function sortAccountsByLastName(accounts) {
return accounts.sort((account1, account2) =>
account1.name.last < account2.name.last ? -1 : 1,
);
}
function getTotalNumberOfBorrows(account, books) {
return books.reduce(... | true |
ace8498415e208b56dc714628235c3aefbc469e8 | JavaScript | amitamathkar/CMPE273_LAB2 | /Dropbox-mongoDB/kafka-back-end/services/login.js | UTF-8 | 2,155 | 2.515625 | 3 | [] | no_license | var mongo = require("../DbConnection");
var mongoURL = "mongodb://localhost:27017/dropbox";
var bcrypt=require('bcrypt');
var auth = require('passport-local-authenticate');
function handle_request(msg, callback){
var res = {};
console.log("In handle request:"+ JSON.stringify(msg));
/*
if(msg.username ==... | true |
209c755d2d3dfbf68f9cbd8ee73c08ebef98f8aa | JavaScript | pablopunk/aim | /src/draw.js | UTF-8 | 188 | 2.6875 | 3 | [] | no_license | const tau = Math.PI * 2
module.exports.circle = function (ctx, x, y, width, color = 'white') {
ctx.strokeStyle = color
ctx.beginPath()
ctx.arc(x, y, width, 0, tau)
ctx.stroke()
}
| true |
b8f86e5bac76461f53892d6f78d54e4e50f95147 | JavaScript | jclouise/eth-hot-wallet | /app/utils/common.js | UTF-8 | 156 | 2.65625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /* simple timer to resolve after ms milliseconds */
export const timer = (ms) =>
new Promise((resolve) => setTimeout(() => resolve('timer end'), ms));
| true |
13c271cf4116da40b4c3a156323e213c15e5d4f9 | JavaScript | piyush1104/AlgoPractice | /clement_video_problem_1.js | UTF-8 | 2,140 | 3.328125 | 3 | [] | no_license | // the question is here - https://www.youtube.com/watch?v=rw4s4M3hFfs
const blocks = [
{
gym: false,
school: true,
store: false,
},
{
gym: true,
school: false,
store: false,
},
{
gym: true,
school: true,
store: false,
},
{
gym: false,
school: true,
store: f... | true |
b2a73a55cf98c2e4444757cd1f2d45ef51bbe1b2 | JavaScript | fletchjeff/birthday-map | /code.js | UTF-8 | 10,249 | 2.59375 | 3 | [] | no_license | function addCommas(nStr) {
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
function first_draw_graphs(data, sort_type) {
... | true |
bc1c330ddeb4e53fea3e167cc42306e0c3e29670 | JavaScript | scovafoundation/scova | /src/Temp.jsx | UTF-8 | 119,119 | 2.515625 | 3 | [] | no_license | { classes:"verse", html: (
<p>
<strong><em>dis aliter visum</em></strong>
</p>) },{ classes:"verse", html : (
<p>
<strong>
<br/>
</strong> For Life, Liberty and the Longevity of Happiness
</p>) },{ classes:"verse", html : (
<p>
<em>Narrated to, lived, and explained by Anhad Singh Arora</... | true |
3b17470f2437e6e04ebd4f8d57138b76332c6fa0 | JavaScript | dominikhm/faireMiete | /scraper-table/altbau.js | UTF-8 | 4,298 | 2.515625 | 3 | [] | no_license | const puppeteer = require("puppeteer");
const chalk = require("chalk");
const fs = require('fs');
const error = chalk.bold.red;
const success = chalk.keyword("green");
const url = 'https://www.wien.gv.at/kulturportal/public/searching/search.aspx';
async function getSelectOptions(page, selector) {
const options = aw... | true |
f785b2c3502cdd5cd6633053ad889c9bd89af9c5 | JavaScript | serhii-martyniv/github-search | /src/api/api.js | UTF-8 | 1,676 | 2.546875 | 3 | [] | no_license | import React from "react";
const headers = {
"Authorization": `token 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`
}
export async function getUsers(currentPage, pageSize = 10) {
const response = await fetch(`https://api.github.com/users?per_page=${pageSize}`)
return response.json()
}
export async function ... | true |
d22a63e340df29bcc6a3df2b876fd075fd9d8188 | JavaScript | bici-fed/bici-transformer | /src/bici-transformers/src/components/BiciDatePicker/index.js | UTF-8 | 4,464 | 2.609375 | 3 | [] | no_license | /**
* @File: DatePicker日期选择
*/
import React, { Component } from 'react'
import { DatePicker } from 'antd'
import DateTimePicker from '../DateTimePicker'
import PropTypes from 'prop-types'
import _ from 'lodash'
import classNames from 'classnames'
import { getFormLabelStyle } from '../../utils/styleUtils'
import * as ... | true |
913011c22283b70b68d4e6429993f799fcecc757 | JavaScript | shunwuyu/lesson_md | /es6/jiqiao/8.js | UTF-8 | 235 | 3.796875 | 4 | [] | no_license | // 从数组中随机选择一个值
const elements = [24, 'You', 777, 'breaking', 99, 'full'];
const random = (arr) => arr[Math.floor(Math.random() * arr.length)];
const randomElement = random(elements)
console.log(randomElement) | true |
279b65593e959f8730bf98752b4220af28e725d6 | JavaScript | maximomartinezsoria/stock-time-series | /public/main.js | UTF-8 | 3,541 | 2.90625 | 3 | [] | no_license | 'use strict'
// Request to the node server every 5 minutes
request();
setInterval(request, 5 * 1000 * 60);
// The request
function request(){
fetch('http://localhost:3000/data')
.then(data => data.json())
.then(data => {
var data = data.data["Time Series (5min)"];
console.log(data);
... | true |
a6ae451c915cfc1d5bf37872cee5f501d58ca45f | JavaScript | iyaz-shaikh/GG_Replay_Parser | /GG_Replay_Parser/js/parser.js | UTF-8 | 7,968 | 2.625 | 3 | [] | no_license | // Your code here!
$(document).ready(function () {
$("#submit").click(function () {
onFileUpload();
});
});
function onFileUpload() {
var uploadedFile = document.getElementById("fileUpload").files[0];
if (uploadedFile != null) {
parseEntireReplayFile(uploadedFile);
}
}
function ... | true |
f89a85d26391e128050bf4dc0090eca2e9230f03 | JavaScript | patrickml/singularity | /lib/collection.js | UTF-8 | 5,594 | 2.53125 | 3 | [
"MIT"
] | permissive | import { Singularity } from './singularity';
import { Model as _Model } from './model';
import { Mongo } from 'meteor/mongo';
export class Collection {
/**
* @param {String} name Name of the Collection
* @param {Object} model model to transform each document
*/
constructor({ name, model, colle... | true |
b0927089029750e169eadd3db6b252f5500a0afd | JavaScript | KINyonji/Board_Spring | /Board/src/main/webapp/resources/user/user.js | UTF-8 | 3,750 | 2.640625 | 3 | [] | no_license | /* 유저 js */
$(document).ready(function() {
});
/*--------------------------------------------------------------
아이디 중복 확인
--------------------------------------------------------------*/
var IDChk = false;
function u_idCheck(){
let u_idValue = $("#u_id").val();
console.log(u_idValue);
if(!u_idValue){
//값이... | true |
7379c19622824131174cd7fced83d13dbf599eac | JavaScript | rotens/WDPAI-Projekt | /public/js/script.js | UTF-8 | 1,298 | 3.46875 | 3 | [] | no_license | const form = document.querySelector("form");
const oldPasswordInput = document.querySelector('input[name="old_password"]');
const newPasswordInput = document.querySelector('input[name="new_password"]');
const confirmedPasswordInput = document.querySelector('input[name="repeated_password"]');
function isCorrectPassword... | true |
5b7a17fab464757eaa5c5b0e11537ba521dc6f3e | JavaScript | yatinbajaj/Slack-Socket.io | /slack.js | UTF-8 | 3,689 | 2.796875 | 3 | [] | no_license | const express = require("express");
const namespaces = require("./data/namespaces");
const app = express();
const socketio = require("socket.io");
app.use(express.static(__dirname + "/public"));
const expressServer = app.listen(9000);
const io = socketio(expressServer, {
path: "/socket.io",
serveClient: true,... | true |
30e7797abee82b84a5935f9fe4e740cd00791596 | JavaScript | alanespinet/devices-control | /src/components/actions/add-device.js | UTF-8 | 3,315 | 2.578125 | 3 | [] | no_license | import { Component } from 'react';
import { connect } from 'react-redux';
import { asyncAddDevice } from '../../redux/actions/devices';
class AddDevice extends Component {
constructor(props){
super(props);
this.state = {
system_name: '',
type: '',
hdd_cap... | true |
f3e88d4770233ce44de6daef672febda07948d9e | JavaScript | mohammed52/express-news-plugin | /TUTS/6. PageArchiver Combined/5. SingleFile Core/scripts/content/wininfo.js | UTF-8 | 13,041 | 2.515625 | 3 | [
"MIT"
] | permissive | /*
* Copyright 2011 Gildas Lormeau
* contact : gildas.lormeau <at> gmail.com
*
* This file is part of SingleFile Core.
*
* SingleFile Core is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, ... | true |
0385587c6158d5ec103cf066a4d7e33cb97a1316 | JavaScript | enzo-billis/Chappie-DiscordBot | /commands/chappie.js | UTF-8 | 1,586 | 2.875 | 3 | [] | no_license | let badwords = require("../assets/badwords")
module.exports = class chappie {
static action(message) {
let args = message.content.split(' ')
args.shift()
if (args[0] === "maman") {
message.channel.send({
files: ["images/Chappie/chappie-mom.jpg"]
})
... | true |
3af3970cf6750fca1f678b00362f226c6db74934 | JavaScript | creationix/http-parser-js | /tests/parallel/test-http-agent-false.js | UTF-8 | 927 | 2.765625 | 3 | [
"MIT"
] | permissive | 'use strict';
require('../common');
var assert = require('assert');
var http = require('http');
// sending `agent: false` when `port: null` is also passed in (i.e. the result
// of a `url.parse()` call with the default port used, 80 or 443), should not
// result in an assertion error...
var opts = {
host: '127.0.0.1... | true |
ff76a3d70972bbe9f4f7bc0abd29980777c3cd36 | JavaScript | steveneross94/DS-Algo-Practice | /notes/stacksQueues/stacks.js | UTF-8 | 2,634 | 4.25 | 4 | [] | no_license | // stacks - LIFO
/*
ex) Browser History - Hitting back button to access history
google
udemy
youtube
Stacks have a top and bottom, and we can build them with arrays or linked lists
What are the trade offs for using array vs LL, and vice-versa?
- Both work quite well
- One major thing, arrays have cache locality (... | true |
3965eb9e187b793fc9696fe410050b02c779d332 | JavaScript | yogicoderanne/js_bits_and_pieces | /else_if_conditonals.js | UTF-8 | 285 | 4.15625 | 4 | [] | no_license | //ELSE IF Conditionals
//must be paired with a regualar if statement
//Example 1
/* Criteria =
3 - boss
2 - average
1 - needs work
<1 - bad
*/
let rating = 1;
if (rating === 3) {
console.log('You are a boss ass bitch!');
} else if (rating === 1) {
console.log('needs work');
}
| true |
1b8437b10623c74d51323c1c52134e2f45e26f25 | JavaScript | willashley23/Asteroids | /lib/game_view.js | UTF-8 | 2,643 | 3.171875 | 3 | [] | no_license | /* globals key */
const Game = require('./game.js');
const Utils = require('./utils.js');
const img = new Image();
const DIM_X = 800;
const DIM_Y = 605;
let speed = 1;
let difficultySetting = "easy"
function GameView(ctx) {
this.ctx = ctx;
this.game = new Game("easy");
this.onHomeScreen = true;
}
GameView.prot... | true |
c7f51feaabb7596f38554f4e2e2dc9168fa666ff | JavaScript | isorbitos/next-sultys01 | /components/contacts/contactMsg.js | UTF-8 | 4,026 | 2.71875 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import Notification from "../ui/notification";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
import {faEnvelope, faUser, faPencilAlt} from "@fortawesome/free-solid-svg-icons"
async function sendContactData(contactDetails) {
console.log(contactDe... | true |
3918d4e85eb7d62f33774a31933dd65daf2443e7 | JavaScript | BradleyNR/jest-testing-notes | /__tests__/function_practice.js | UTF-8 | 1,015 | 3.84375 | 4 | [] | no_license | var max = require('../function_practice').max;
var isVowel = require('../function_practice').isVowel;
var greaterThan = require('../function_practice').greaterThan;
//describe what a block of code should do
//what we're testing
//what we expect
describe('max function', function(){
test('should take two numbe... | true |
af78cee1f99f954931dc20b5d5a01ac60b7f5c8d | JavaScript | fynekot/vscode | /js/01localStorage.js | UTF-8 | 1,596 | 3.390625 | 3 | [] | no_license | "use strict";
//获取文本框对象
var txtKeyObj = document.querySelector('#txtKey');
var txtValueObj = document.querySelector('#txtValue');
var btnAdd = document.querySelector('#btnAdd');
var btnGet = document.querySelector('#btnGet');
var btnRemove = document.querySelector('#btnRemove');
var btnClear = document.querySelector('#... | true |
7fc80524dbb0c05397294cfbf9a77b1390efa314 | JavaScript | ycycorona/koa-study | /nodejs/event.js | UTF-8 | 521 | 3.09375 | 3 | [
"MIT"
] | permissive | const EventEmitter = require('events');
const myEmitter = new EventEmitter();
const consoleB = () => {
console.log('B');
}
// Only do this once so we don't loop forever
myEmitter.once('newListener', (event, listener) => {
if (event === 'event') {
// Insert a new listener in front
myEmitter.on('event', con... | true |
51f799ee843e6f5b305f4c40f22b00f5e607bb6a | JavaScript | Anknit/webionix | /THIRDPARTY/SVG/camera_files/asset-loader.js | UTF-8 | 7,348 | 2.546875 | 3 | [] | no_license | /** =======================================================================
* Vincent Hardy
* License terms: see svg-wow.org
* CC0 http://creativecommons.org/publicdomain/zero/1.0/
* ======================================================================= */
YUI.add("asset-loader", function (Y) {
sw = window.s... | true |
54c0d6c2f271179afb47d40b280bc7db467190c4 | JavaScript | AhmadMagdi/SeniorMonitoring | /BasicUITest/js/google.js | UTF-8 | 1,603 | 2.640625 | 3 | [
"MIT"
] | permissive | (function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://plus.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
//google+
var gpclass = (function(){
... | true |
5e7f52b214be83978eaab29de748f5dba9aa272e | JavaScript | pavlina-momchilova/Telerik-Academy-Homework | /JavaScript/9.String/Strings/Strings/1.ReverseString/1.ReverseString.js | UTF-8 | 296 | 3.84375 | 4 | [] | no_license | /*
* Write a JavaScript function that reverses a string and returns it.
*/
var str = 'sample';
function reverse(str) {
var len = str.length, reversedStr='', i;
for (i = len-1; i >=0 ; i-=1) {
reversedStr += str[i];
}
return reversedStr;
}
console.log(reverse(str)); | true |