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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d3d638307b64ae7211be70b2b55a4191d3d868f9 | JavaScript | 17nis/MinitutorialsFront | /three/three.js | UTF-8 | 2,652 | 2.625 | 3 | [] | no_license |
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(
75,
window.innerWidth/window.innerHeight,
0.1,
1000
);
camera.position.z = 4;
var renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setClearColor("#e5e5e5");
renderer.setSize(win... | true |
024201f8eb2b2f8f67c69c8a04cab3d442f1634a | JavaScript | jaretogarato/jolt-react-test | /src/Cards.js | UTF-8 | 4,557 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import Card from './Card.js';
import './Card.css';
import { Grid } from 'semantic-ui-react';
import SearchBar from "./SearchBar.js"
import star from './images/star.svg';
import wars from './images/wars.svg';
import PagesControl from './PagesControl.js... | true |
ccb848c2077c7f3d22189da72552fd3671d3b7cb | JavaScript | barakbd/full_mean_friends | /server/models/Friend.js | UTF-8 | 555 | 2.5625 | 3 | [] | no_license | var mongoose = require('mongoose');
// ******************** Define a schema *******************
var FriendSchema = new mongoose.Schema({
first_name: {type: String, required: true, minlength: 3},
last_name: {type: String, required: true, minlength: 3},
age: {type: Number, required: true, min: 13, max: 120},
... | true |
47ec035e8edcafeff525d20e188c455afe9de4c7 | JavaScript | molin-zhao/mockgram | /Mockgram-Server/utils/converter.js | UTF-8 | 1,280 | 2.6875 | 3 | [] | no_license | const mongoose = require('mongoose');
const ObjectId = mongoose.Types.ObjectId;
exports.convertStringArrToObjectIdArr = (inputArr) => {
let outputArr = [];
inputArr.map((id) => {
outputArr.push(ObjectId(id));
});
return outputArr;
}
exports.convertStringToObjectId = (inputString) => {
if (i... | true |
a7e93125d5ef63596d14ab69ca81027c916259d0 | JavaScript | Matthew-Abebe/c0321-code-solutions | /array-manipulation-2/src/includes.js | UTF-8 | 307 | 3.375 | 3 | [] | no_license | /* exported includes */
function includes(array, value) {
if (Math.sign(array.indexOf(value)) > 0) {
return true;
} else if (Math.sign(array.indexOf(value)) < 0) {
return false;
} else if (Math.sign(array.indexOf(value)) === 0) {
return true;
}
console.log(array.indexOf(value));
}
| true |
e9846e7076841c81bdcc7247f24ada57ee1d92df | JavaScript | jenchinwang/JavaScriptLearning | /NameFinder.js | UTF-8 | 930 | 3.921875 | 4 | [] | no_license | /*jshint multistr:true */
var text = "Hey, how are you \
doing? My name is Jen-Chin. I \
have been called JC more \
frequently, instead of Jen-Chin \
, since I started working, but \
either way I am fine.";
var myName = "Jen-Chin";
var hits = [];
for (i = 0; i < text.length; i++) {
if (text[i] === myName[0]) {
... | true |
9a9a357800861b9dbdb7ed5c1d9a0dabba961a0a | JavaScript | kirkdc/blog | /src/reducers/postsReducer.js | UTF-8 | 236 | 2.6875 | 3 | [] | no_license | export default (state = [], action) => {
//cant use if statements. Have to use switch case statement for it to work
switch (action.type) {
case "FETCH_POSTS":
return action.payload;
default:
return state;
}
};
| true |
1c81b4c7421c8b6dd3fbdc5729851ffa87ab58b8 | JavaScript | AliaksandrZahorski/test2 | /src/sequence.js | UTF-8 | 514 | 3.5625 | 4 | [] | no_license | const sub = (arr, i) => {
const result = [];
for (var x = 0; x<i; x++) result.push(arr[x]);
for (var x = i + 1, il = arr.length; x<il; x++) result.push(arr[x]);
return result;
}
//const rise = arr => arr.slice(1).every( (e, i, a) => e > arr[i] );
const riseFast = arr => {
for (var x = 1,... | true |
1f9273fce21eeb3c784c2574276dd4fbc512e35f | JavaScript | OrganicInKG/OrganicInKG-Frontend | /src/components/Auth/tokensChecker.js | UTF-8 | 238 | 2.5625 | 3 | [] | no_license | export const tokensChecker = ()=>{
const accessToken = localStorage.getItem('accessToken')
const refreshToken = localStorage.getItem('refreshToken')
if(refreshToken && accessToken){
return true
}
return false
} | true |
de27fb1a9ee2b92287eefde2d089317ebba430fc | JavaScript | caixindong/JS_FullStack_Learn | /JSLearn/obj.js | UTF-8 | 461 | 3.78125 | 4 | [] | no_license | var xiaoming = {
name: '小明',
age: 22,
};
console.log(xiaoming.name);
//判断xiaoming这个对象是否有name这个属性,这个属性可能继承得到
console.log('name' in xiaoming);
//添加属性
xiaoming.birth = '1994-06-07';
console.log(xiaoming);
//删除属性
delete xiaoming['birth'];
console.log(xiaoming);
//判断一个属性是否是xiaoming自身拥有的,而不是继承得到的
console.log(xiaomin... | true |
a840c6f48e75b52c52ca96203c996650a0dade1c | JavaScript | ajeshh/controlFlowLab | /grade.js | UTF-8 | 298 | 3.328125 | 3 | [] | no_license | var grades = 82;
switch (true) {
case grades >=90:
console.log('Grade is an A');
break;
case grades >80:
console.log('B');
break;
case grades >70:
console.log('C');
break;
case grades >60:
console.log('D');
break;
case grades <60:
console.log('F');
break;
default:
console.log('not');
break;
} | true |
6ab5d2cb38db51c6a329989704bdaad1e5e2e922 | JavaScript | house9/SampleAspMvc3WithTelerik | /SampleAspMvc3WithTelerik/Scripts/src/FunWithNumericTextBox/sample_four.js | UTF-8 | 1,771 | 2.8125 | 3 | [] | no_license | // define the behaviours of the sample FOUR functionality
var sampleFourConstructor = function (spec) {
var that = {};
that.index = spec.startingIndex;
// ***************************************************
that.getSpec = function () {
return spec; // just for debugging
};
// *******... | true |
5d135508d3cb135e8ef255d65f1853caa011e207 | JavaScript | tylersears/i-did-this-myself... | /oldk/javascript/tomorrolandcount.js | UTF-8 | 2,236 | 2.953125 | 3 | [] | no_license | var date = Date || (new Object.constructor("return Date;"))();
var hypotheticaldate = 1450000000000;
var len = 71;
var start = 94;
rectMode(CENTER);
textAlign(CENTER, CENTER);
textFont(createFont("arial", 50));
noStroke();
var timercup = function(x, y) {
beginShape(LINES);
stroke(0);
vertex(x - 15, y + 50);... | true |
1c12be5b13d782cf6c7849c6d14c7c33d40d502d | JavaScript | IreneMercy/MTOTO | /js/main.js | UTF-8 | 12,841 | 2.515625 | 3 | [
"MIT"
] | permissive |
//Business Logic
function facets(adaptability,affectiveDisposition,emotionalExpression,emotionalPerception,emotionalRegulation,lowImpulsivity,peerRelations,selfEsteem,selfMotivation){
this.adaptability = adapt;
this.affectiveDisposition = affect;
this.emotionalExpression = emotionalE;
this.emotionalPerception... | true |
85cac953ccddd36aa99b456c7d6f0261f74f1db9 | JavaScript | priscyladepaula/react-bootcamp | /formulario-formik/src/Formulario.js | UTF-8 | 1,673 | 2.609375 | 3 | [
"MIT"
] | permissive | import React from 'react';
import { useFormik } from 'formik';
import './style.css'
const validate = values => {
const errors = {};
if (!values.name) {
errors.name = 'Campo obrigatório!';
}
if (!values.email) {
errors.email = 'Campo obrigatório!';
} else if (!/^[A-Z0-9._%+-]+@[A-Z0... | true |
f5a72f9f900f9439eac77a7b9686f599273be210 | JavaScript | dehavilland95/volleyball | /server.js | UTF-8 | 2,536 | 2.734375 | 3 | [] | no_license | var express = require('express'); // Express contains some boilerplate to for routing and such
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http); // Here's where we include socket.io as a node module
// Serve the index page
app.get("/", function (request, response) {
... | true |
85b5e09ba2119d7049a4b8d324677d1b5c36fa5c | JavaScript | Speedy37/attribution-sujet | /lib/password.js | UTF-8 | 799 | 2.75 | 3 | [
"MIT"
] | permissive | var crypto = require('crypto');
module.exports = {
chars : "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
generate : function(size, callback, chars) {
chars = chars || module.exports.chars;
crypto.randomBytes(size, function(ex, buf) {
if (ex) throw ex;
var password = ""... | true |
ddad8050b6f744816ca16f7491df35f6c5d8ddbe | JavaScript | Aryan-coder/ReactTodoApp | /src/reducer.js | UTF-8 | 279 | 2.53125 | 3 | [] | no_license | var initState={
user: {
uid: '',
name: '',
todos: []
}
}
function reducer(state=initState, action){
switch(action.type){
case 'SET': {
return({user: action.user})
}
}
}
export default reducer | true |
97706cb1a52d88300479055d32bdf6a0dd093e2b | JavaScript | TrungPhuNA/project | /typeScript/TypeScript/mjs/03-variable/02-array.js | UTF-8 | 170 | 3.296875 | 3 | [] | no_license | let arrNumber = [1, 3, 6];
let arrString = ["Phan", "Trung", "phú"];
let arrString2 = ["Phan", "Trung", "phú"];
arrString2.push("TypeScript");
console.log(arrString2);
| true |
f22cf1165cda0861424fc8e10db656668782946c | JavaScript | rishabh-gupta-au13/OtpLoginNodeJs | /utils/otp.util.js | UTF-8 | 625 | 2.53125 | 3 | [] | no_license | const fast2sms=require("fast-two-sms");
const {FAST2SMS}=require("../config")
exports.generateOTP=(otp_length)=>{
// Declare a digits variable
// which stores all digits
var digits="0123456789"
let OTP=""
for (let i =0; i<otp_length;i++){
OTP+=digits[Math.floor(Math.random()*10)];
}
... | true |
ec3fe05819ed2e0634afafb4439c5267199100be | JavaScript | Pipe12/testimonials_slider | /js/index.js | UTF-8 | 1,832 | 3.203125 | 3 | [] | no_license | const testimonials = [
{
id: 0,
quote: `“ I’ve been interested in coding for a while but never taken the jump, until now. I couldn’t recommend this course enough. I’m now in the job of my dreams and so excited about the future. ”`,
autor: `Tanya Sinclair`,
autorTitle: `UX Engineer`,
imageSrc: `./i... | true |
f9fc03ad40fd27b699262b199065f7785463c566 | JavaScript | CristhianCoaquira/platzi-curso-practico-javascript | /figuras.js | UTF-8 | 2,508 | 3.53125 | 4 | [
"MIT"
] | permissive | const perimetroCuadrado = (lado) => Number(lado) * 4;
const areaCuadrado = (lado) => lado * lado;
const perimetroTriangulo = (lado1, lado2, base) =>
Number(lado1) + Number(lado2) + Number(base);
const areaTriangulo = (base, altura) => (base * altura) / 2;
const diametroCirculo = (radio) => radio * 2;
const perim... | true |
cf24bec4d2c706e62dfe9ab5cbf91d9a0c96fa72 | JavaScript | ThompsonJonM/nu_code | /20170715-NodeContinued/weather.js | UTF-8 | 425 | 3 | 3 | [] | no_license | var weather = require("weather-js");
weather.find({search: "Anchorage, AK", degreeType: "F"}, function(err, result) {
//writes an error in the console if an error is found
if (err) {
console.log(err);
}
//prints data if no error
//uses stringify to print in string format
//use JSON.st... | true |
cde73c0980d5ebe05e19e027c217f81a091075d6 | JavaScript | dr34ke/wsei-javascript-zadania | /1_Zadania/obowiązkowe/4_Obiekty/js/app.js | UTF-8 | 1,147 | 3.6875 | 4 | [] | no_license | //zadanie 0a
city={
capital: "San Escobar",
population: "12321",
president: "Andrzej Duda",
primeMinister:["Adam", "Mateusz", "Andrzej"],
}
console.log(city.capital, city.population, city.president, city. primeMinister);
// zadanie 0b
timeMachine={
shape: "kolo",
model: "jakis",
... | true |
7bbeac8d2f8e31782c2c5c2553e272eddd586b16 | JavaScript | Eritz/weather-comp | /src/components/Weather/getIcon.js | UTF-8 | 168 | 2.59375 | 3 | [] | no_license |
const getIcon = (icon) => {
let iconString = icon;
iconString = iconString.toUpperCase().replace(/-/g, "_");
return(iconString);
}
export default getIcon; | true |
bd4ed4a8c64218f8f29ccf9de9da0f8d036f4dff | JavaScript | vmurali100/NodeJS-Training | /NodeJS/Childprocess/streams.js | UTF-8 | 450 | 3.125 | 3 | [] | no_license |
const stream = require('fs')
var readStream = stream.createReadStream('./data.txt');
var mystring = '';
readStream.on('data', chunk => {
console.log('---------------------------------');
console.log(chunk);
mystring += chunk.toString();
console.log('---------------------------------');
});
readStream.on('o... | true |
b6278a3196a836ddcc2b4f501b254e0f14dccd3b | JavaScript | dbucher97/boozefahrer | /server/game.js | UTF-8 | 13,561 | 2.65625 | 3 | [] | no_license | const {randomStack} = require('./stack');
const {getShape} = require('./common/shape');
const defaultSettings = {
shape: {name: 'Pyramid', rows: 5, total: getShape('Pyramid').getTotal(5)},
playerCards: 3,
lowest: 4,
bussize: 5,
maxPlayers: 12,
};
const idleState = {
name: 'idle',
previousState: '',
};
c... | true |
51f6edf2c759c4195d5b6288bf9addcb60eff40b | JavaScript | mttbrb/weather | /src/OpenWeatherMapAPI/open_weather_map.js | UTF-8 | 1,089 | 2.796875 | 3 | [] | no_license | var fetch = require('node-fetch');
const WEATHER_API_KEY = "bbeb34ebf60ad50f7893e7440a1e2b0b";
const NOW_API_STEM = "http://api.openweathermap.org/data/2.5/weather?";
const MULTI_DAY_API_STEM = "http://api.openweathermap.org/data/2.5/forecast?";
function zipUrl(zip) {
return `${NOW_API_STEM}zip=${zip},us&units=im... | true |
4a965914b3ca6301dd8132e245ea7c759c29d435 | JavaScript | TyPhyter/br-restaurant-app | /src/components/App/App.js | UTF-8 | 1,911 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Header from '../Header/Header';
import RestaurantList from '../RestaurantList/RestaurantList';
import DetailView from '../DetailView/DetailView';
import axios from 'axios';
class App extends Component {
state = {
restaurants: [],
... | true |
1a5a2254115b3f01f7ec8762fc53213d8d08e89d | JavaScript | charJKL/war-game | /engnie/player.js | UTF-8 | 623 | 2.578125 | 3 | [
"MIT"
] | permissive | function Player(resource){
Dispatcher.call(this);
this.settlers = resource.settlers;
this.max = resource.max;
this.food = resource.food;
this.wood = resource.wood;
this.stone = resource.stone;
this.gold = resource.gold;
this.attach('resource',this.addResource);
}
Player.prototype = Obje... | true |
709866d501dc492c619ada9cec44a8a456d50eca | JavaScript | Ferdiekri/EjerciciosAngularJS | /ejercicio08 - rutas/js/promesasController.js | UTF-8 | 2,250 | 3.328125 | 3 | [] | no_license | app.controller('promesasController', ['$scope', '$http', '$q', '$timeout', function($scope, $http, $q, $timeout,){
console.trace('promesasController');
$scope.titulo = "Promesas - Ejercicio";
$scope.sumar1 = 0;
$scope.resultado1 = 'Sumando...';
$scope.resultado2 = 'Sumando...';
$scope.resulta... | true |
da92b608f2a1a38283e709e9f4809c5f9aa48aaf | JavaScript | dmorr041/CEN4083 | /Nomaste/countMiami.js | UTF-8 | 3,035 | 2.59375 | 3 | [] | no_license | 'use strict';
// var mongoose = require("mongoose");
// var Post = require("./models/post");
const yelp = require('yelp-fusion');
const client = yelp.client('s50Uld4c1jKVF98wk_0LUJSipvCgdhX_33gRT5FMid4f1QOeY5ZWz50eLtkLr0FOPXyXBpnx8xzNVRCcNZg2HXBWqzdyKrHol2EpJaPjWvVMqHc9uZAahkGHEBsoW3Yx... | true |
66c48bcf41df7fd5ae637c8ddf7f60e831671318 | JavaScript | WoooTer/spring-tomcat-scaffold | /src/main/webapp/js/es-basic/es6/async/async.js | UTF-8 | 395 | 2.890625 | 3 | [] | no_license | const asyncSetTimeout = async function () {
var r1 = await new Promise((resolve, reject) => {
setTimeout(resolve, 1000, 'co 1000ms');
});
console.log(r1 + "\n\n");
var r2 = await new Promise((resolve, reject) => {
setTimeout(resolve, 500, 'co 500ms');
});
console.log(r2);
};
as... | true |
b7c2ccaf88ea1c5a128983b5de2f6688bfd1c3d6 | JavaScript | GoodIntentionsAssistant/gi | /src/Train/understand.js | UTF-8 | 3,648 | 3.015625 | 3 | [
"MIT"
] | permissive | /**
* Understand
*/
module.exports = class Understand {
/**
* Constructor
*
* @constructor
* @param {Object} App App instance
*/
constructor(App) {
this.App = App;
this.collections();
}
/**
* Load collections
*
* @todo Rename to something else? This doesn't look right here.
* @returns {boolea... | true |
fd50a87ecdb77e56f40b3717aedf588e28ae5355 | JavaScript | MizzzViolet/mizzzviolet.github.io | /memory_game.js | UTF-8 | 2,472 | 3.578125 | 4 | [] | no_license | var array = ['10','10','11','11','12','12','13','13','14','14','22','22','26','26','3','3','31','31','7','7','2','2','42','42'];
var values = [];
var id = [];
var flipped = 0;
// setInterval(function () {
// var d = new Date();
// var seconds = d.getMinutes() * 60 + d.getSeconds(); //convet 00:00 to seconds fo... | true |
c03441f50bda964b30c2c29a15cf507c46bd1bc4 | JavaScript | alvinsimzx/BananaInc | /app.js | UTF-8 | 3,115 | 3.078125 | 3 | [] | no_license | let sliderImages = document.querySelectorAll('.slide'),
arrowleft = document.querySelector('#arrow-left'),
arrowright = document.querySelector('#arrow-right'),
current=0;
var myIndex = 0;
// Scroll back to top button function
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (docume... | true |
fa879cedf31c9f91b10ffca69f221d3fc2b3d776 | JavaScript | karagiannis/miscellanea | /express-server-full/app.js | UTF-8 | 17,888 | 2.8125 | 3 | [] | no_license | var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var request = require("request");
var url = process.argv[2] || "http://46.101.232.43 ";
var username = process.argv[3] || "zeke";
var password = process.argv[4] || "coys";
var scraper = require("./lib/utility").scraper;
//scraper(url);
var loader = requi... | true |
b88392167eb77773910627d6add0835f8cc6272a | JavaScript | m-rawat/PasswordGenerator | /js/index.js | UTF-8 | 2,597 | 3.546875 | 4 | [] | no_license | const resultEle=document.getElementById("result");
const lengthEle=document.getElementById("length");
const upperEle=document.getElementById("uppercase");
const lowerEle=document.getElementById("lowercase");
const numberEle=document.getElementById("numbers");
const symbolEle=document.getElementById("symbols");
const bt... | true |
c38a1aa7d4fa465e92ada948af86696ac41e26dd | JavaScript | mypanda/require-first | /lib/math.js | UTF-8 | 209 | 2.75 | 3 | [] | no_license | define(['underscore'],function (_) {
return {
add:function () {
var result = 0;
_.each(arguments,function(num) {
result += num;
});
return result;
}
}
})
| true |
58617eb7ff1923583ffec775479e88ddf5c9bfd4 | JavaScript | old-wrmn/infoSoccer2 | /js/loader/pageLoader.js | UTF-8 | 1,597 | 2.625 | 3 | [
"MIT"
] | permissive | import match from './matchLoader.js';
import team from './teamLoader.js';
import comp from './compLoader.js';
// Load page content
function loadPage(path = {}) {
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4) {
const content = document.... | true |
94845d9d9e9a1f2e320976fc94f52d32ee672090 | JavaScript | Mugunthangit/foodz-api-hasura | /components/https/recommended_additional_fields/restaurant_cuisine.js | UTF-8 | 1,556 | 2.546875 | 3 | [] | no_license | var request = require('request');
require('dotenv').config()
module.exports = function(x,restaurantsunique_id,hasura_user_id){
function req_var(callback){
request({
url: 'http://data.hasura/v1/query',
method: 'POST',
headers: {'Content-Type':'application/json','X-Hasura-Role':'admin','X-Hasura-User-I... | true |
22dd37a70878f924bab5b23dadd764dbd1ec4225 | JavaScript | songsujeong/test | /javascript01/step04/test00.js | UTF-8 | 338 | 2.78125 | 3 | [] | no_license | "use strict"
var prompt = require('prompt'); //모듈 가져오기
prompt.start(); //시작
inputCommand() //호이스팅, 함수호출
function inputCommand(){
prompt.get(['command'], function(err, result){ // 1번
console.log(result.command); //사용자에게 입력받아라, 보조작업자
inputCommand();
})
}
| true |
0a20e03370a063b8bc4fbd04770607d339bbccd2 | JavaScript | kine1991/mern | /client/src/redux/book/book.reducer.js | UTF-8 | 2,740 | 2.640625 | 3 | [] | no_license | import bookTypes from './book.types';
const INITIAL_STATE = {
books: [],
book: null,
error: null,
isFetching: true,
countBooks: undefined,
countBooksIsResolve: false,
filterParams: {
genre: [],
author: [],
limit: 20,
page: 1
}
};
const bookReducer = (state = INITIAL_STATE, action) => {... | true |
25771f072d88791ce009db7e27df7429ddb6c0b9 | JavaScript | justeban/Codewar-Solutions | /0413-LAB2-alt-capital/solution.js | UTF-8 | 348 | 3.34375 | 3 | [
"MIT"
] | permissive | 'use strict';
function capitalize(s) { //eslint-disable-line
let oddS = s.split('');
let evenS = s.split('');
for (let i in oddS) {
if (!(i % 2)) {
oddS[i] = oddS[i].toUpperCase();
}
}
for (let i in evenS) {
if (i % 2) {
evenS[i] = evenS[i].toUpperCase();
}
}
return [oddS.... | true |
9b4dd2382fb04626e12a45293659913d3930e784 | JavaScript | LeTrongThang/Fingerprint | /site/controller/Server.js | UTF-8 | 407 | 2.625 | 3 | [] | no_license | 'use strict';
// init nodejs server
var http = require('http');
var server = http.createServer(function(request, response){
response.writeHead(200, {
"Context-type" : "text/plain"
});
// Show thông tin
response.write('Your URL is ' + request.url);
// Kết thúc
response.end();
... | true |
10f1e56d49557ea7895f65c0c27e2b4e731c30ba | JavaScript | kwicz/haiku-checker | /src/haiku.js | UTF-8 | 2,598 | 3.109375 | 3 | [
"MIT"
] | permissive | import { arrayExpression } from "@babel/types";
import { getChangedFilesForRoots } from "jest-changed-files";
// Business-Logic
export function HaikuLines(line1, line2, line3) {
this.line1 = line1;
this.line2 = line2;
this.line3 = line3;
}
// Check if each line has a number in it
HaikuLines.prototype.numberCh... | true |
6fd1e1623e9a5040988e3e47008e48183b8278dd | JavaScript | claudiamarz/cim640 | /final/farm_v2/empty-example/sketch.js | UTF-8 | 3,838 | 3.1875 | 3 | [] | no_license | var centerX = 0;
var centerY = 0;
var bgColor;
var currentBgImage;
var interfaceItems = [];
var languageButton;
function preload() {
bgImage = loadImage('assets/farm.gif');
}
function setup() {
var song = loadSound('assets/rooster.mp3');
var song1 = loadSound('assets/cow.mp3');
var song2 = loadSou... | true |
d5f8d27a2091e14b843797f1fe7190e33eef3965 | JavaScript | q9design/nimble-elements | /templates/bootstrap/world-zones/x-clock/created.js | UTF-8 | 1,393 | 3.09375 | 3 | [
"ISC"
] | permissive | //
// 2015.10.23 -- x-clock / created.js
//
//upg: stop ticking when removed.
//upg: support property change offsetHours, offset
//upg: support attribute change offsetHours, offset
//upg: support offset in seconds
//upg: day of week optional / format string attribute
// we could use moment and such for local form... | true |
653d21ca7fe251bbc33465c8470939d7c998cd69 | JavaScript | TrainingByPackt/Professional-Node.js | /Lesson06/Activities/Activity H/EggRecipe.js | UTF-8 | 1,560 | 2.890625 | 3 | [
"MIT"
] | permissive | const Person = require('./Person');
const Water = require('./Water');
const Temperature = require('./Temperature');
const sequence = require('./sequence');
const Promise = require('bluebird');
const Egg = require('./Egg');
module.exports = class EggRecipe {
constructor(person) {
this.person = person;
this.s... | true |
6c8cbe5414eb2a9840f5e63d5ed57ee8fd4b4808 | JavaScript | scottschindler/JavaScript-III | /assignments/this.js | UTF-8 | 1,981 | 4.71875 | 5 | [] | no_license | // /* The for principles of "this";
// * in your own words. explain the four principle for the "this" keyword below.
// *
// * 1. Window: All global JavaScript objects, functions, and variables are part of the window object
// * 2. Implicit: Dealts with objects. It's always the left of the invocation of the method invo... | true |
1d85aed347cd09384ec54abf5ee3f2f2a9103cdd | JavaScript | esiebomaj/Instant-Weather | /index.js | UTF-8 | 2,262 | 3.09375 | 3 | [] | no_license | const SOMETHING_LIGHT = "90ad1a751861d25727920ade4d222908";
const resultContainer = document.querySelector(".result-container");
window.addEventListener("keypress", (e) => handleSearch(e));
async function init() {
//checks local storage for search history and display result based on this history
const prevQuery ... | true |
972613415b5447e5dbb84e31d8b6f55b46c0d5bd | JavaScript | htong1/AllAboutLiterature | /thesaurus/thesaurus.js | UTF-8 | 1,572 | 3.328125 | 3 | [] | no_license | function getWord(){
let wordS = document.getElementById("wordSyno").value;
let outS = document.getElementById("outputSyno");
let outA = document.getElementById("outputAnt");
fetchSyno(wordS, outS, outA);
}
function fetchSyno(wordS, outS, outA){
let uRl = "https://www.abbreviations.com/services/v2/syno.php?uid=8055&tok... | true |
cc5c306185f88897e08a2f9e8d57aa9923895e4f | JavaScript | KorusMateusz/notesapp | /public/javascripts/notes-view-handlers.js | UTF-8 | 4,400 | 3.171875 | 3 | [] | no_license | const formatDate = (date) => new Date(date).toLocaleString("en",
{ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' , hour: "2-digit", minute: "2-digit"});
function convertNoteToHTML(text){
if(text) {
return text.replace(/(?:\r\n|\r|\n)/g, '<br>');
}
return "";
}
function convertNoteToJS(te... | true |
874808c30b6d644a5e5de78a81677fe2cc0efa5c | JavaScript | humbertodias/game-zelda-js | /scripts/characters/OldMan.js | UTF-8 | 453 | 2.984375 | 3 | [] | no_license | var OldMan = function (game, center) {
this.id = "old-man";
this.game = game;
this.size = { x: 16, y: 16 };
this.center = { x: center.x, y: center.y };
};
OldMan.prototype = {
draw: function (screen) {
var x = this.center.x;
var y = this.center.y;
var img = document.getElem... | true |
7f7551c4e27ca0d966795168e7e502022d0706c7 | JavaScript | xyrilletaya/Group5-ExpenseManager | /Group 5 - Expense Manager/public/js/chart-pie.js | UTF-8 | 3,833 | 2.765625 | 3 | [] | no_license | // Set new default font family and font color to mimic Bootstrap's default styling
Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#858796';
const chartPie = () => {
va... | true |
d7087a64be1cf8b432f47c0ce0bc2c49d41a6389 | JavaScript | SofianSaleh/codewars-leetCode | /LeetCode/Challenges/2020/October/Week 2/HouseRobberII.js | UTF-8 | 1,493 | 3.671875 | 4 | [] | no_license | // You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and it will automatically ... | true |
c7afe189b75de4f9972771c2f6e3ce6a5bd022aa | JavaScript | uk-gov-mirror/ministryofjustice.iis | /assets/javascripts/moreless/reveal.js | UTF-8 | 774 | 2.8125 | 3 | [
"MIT"
] | permissive | const $ = require('jquery');
const revealableItems = $('.reveal');
let revealControl;
(() => {
revealControl = ('#reveal');
revealHide();
$(revealControl).on('click', revealClickHandler);
})();
function revealClickHandler() {
if ($(revealControl).text() === 'more') {
$(revealControl).first().... | true |
69ef94b788485ef87f3c1f10d8462213ea1be21e | JavaScript | cvjso/Carbono-da-peste | /front-end/application/src/components/Home/index.js | UTF-8 | 4,969 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import Chart from 'chart.js'
import Navbar from "../Navbar";
import './styles.css';
const axios = require('axios');
export class Home extends Component {
constructor(props){
super(props);
this.myChart = null;
this.RequestPais = "Brazil";
... | true |
b3e5d1c4179deb3c8637968f02c05845d0017f4b | JavaScript | nhsz/citardauq-roots | /lib/index.js | UTF-8 | 725 | 3.234375 | 3 | [
"MIT"
] | permissive | /*
Numerically stable method for solving quadratic equations
Note: 'citardauq' is 'quadratic', reversed
Src: https://people.csail.mit.edu/bkph/articles/Quadratics.pdf, https://en.wikipedia.org/wiki/Quadratic_formula#Derivation_of_the_formula
*/
'use strict'
module.exports = (a, b, c) => {
let cComponent = 2 ... | true |
3610d804bdd91bc00327884def0c8269a1dba712 | JavaScript | MatthewRonaldJohnson/Employee-Tracker | /utlis/addData.js | UTF-8 | 3,763 | 3.53125 | 4 | [] | no_license | const inquirer = require("inquirer");
const cTable = require('console.table');
const findId = require('./findId')
const departmentQ = [{
type: 'input',
message: 'What is the name of the department?',
name: 'name' //add a validate?
}]
const roleQ = [
{
type: 'input',
message: 'What is ... | true |
a7ed30d3e8af55d81646968d9e9ea46a8767196a | JavaScript | Leonid-Krainov/FL-11 | /FL11_HW12/homework/src/app.js | UTF-8 | 4,727 | 2.984375 | 3 | [] | no_license | const rootNode = document.getElementById('root');
const todoItems = [{
isDone: false,
id: 12345,
description: 'Todo 1'
}];
let doneItems = [];
let creator = function (tag, text) {
let created = document.createElement(tag);
created.innerHTML = text;
return created;
};
let mainPage = function () {
while (... | true |
fd8088d4b9bfe812f88ac43c1045ae4d4b115fdc | JavaScript | shanadeshana/h5-raycaster-lab | /libraries/Raycaster/Thinkers/LinearThinker.js | UTF-8 | 1,591 | 2.5625 | 3 | [] | no_license | /** Interface de controle des mobile
* O876 Raycaster project
* @date 2013-03-04
* @author Raphaël Marandet
* Fait bouger le mobile de manière lineaire, à l'aide d'indication de vitesse
* Utile lorsqu'on a une indication de vitesse, mais pas de point de destination précis
*/
O2.extendClass('O876_Raycaster.Linea... | true |
319b04547c004819c6674e24b58185d11b200676 | JavaScript | XHLxiaohuli/callSystem | /src/static/js/public.js | UTF-8 | 592 | 2.640625 | 3 | [] | no_license | window.formHeight = function(search_h){
var winHeight;
// 获取窗口高度
if (window.innerHeight)
winHeight = window.innerHeight;
else if ((document.body) && (document.body.clientHeight))
winHeight = document.body.clientHeight;
return winHeight-(275+search_h);
};
// 时间转换
window.getdateTime=function(num){
var n... | true |
ae470ebf4d8cc15bf87758f295123ce3902fb4c4 | JavaScript | WickedMonkey95/JJA | /weather.js | UTF-8 | 3,029 | 3.09375 | 3 | [] | no_license | (function(){
var htmlFontSize = window.innerWidth/11.5
document.querySelector('html').style.fontSize = htmlFontSize+'px';
//窗口条件的时候重新执行
window.onresize = function(){
var htmlFontSize = window.innerWidth/11.5
document.querySelector('html').style.fontSize = htmlFontSize+'px';
}
})()
func... | true |
7fb5723fa8d28744fb18495eeec4ee5f3661f9f5 | JavaScript | jsms90/learning-angular | /intern_onboarding/001_testing/demo/test/spec/test.js | UTF-8 | 1,805 | 3.90625 | 4 | [
"MIT"
] | permissive | describe('The list of cities', function () {
it('is an array', function () {
expect(cities.list).toBeArray();
});
it('is an array of strings', function () {
expect(cities.list).toBeArrayOfStrings();
});
it('contains London', function () {
expect(cities.list).toContain('London... | true |
d7b64d32a2100c6966cf83c2af4f2a2900b2f757 | JavaScript | Wittle-South-LLC/immutable-inherit | /examples/MultipleInheritance.js | UTF-8 | 356 | 2.828125 | 3 | [] | no_license | /* MultipleInheritance.js - Tests multiple inheritance */
import BasicInheritance from './BasicInheritance'
// Extend the object and add a property on the new object
export default class MultipleInheritance extends BasicInheritance {
constructor(createFrom, val) {
super(createFrom)
this._val = val
}
get... | true |
988db4baa5184f7d6fd7450ff679155dc41d9ba8 | JavaScript | mori94ZUM/HTML-and-CSS | /JavaScript.js | UTF-8 | 180 | 3.5625 | 4 | [] | no_license | let name = "Linda"
let greeting = "Hi there"
function greetUser() {
let customGreeting = greeting + ", " + name + "!"
console.log(customGreeting)
}
greetUser() | true |
88afdf1526ff4ff83265a1655d80c79afd8d7ddd | JavaScript | LaunchPadLab/expose-env-middleware | /middleware.js | UTF-8 | 402 | 2.65625 | 3 | [] | no_license | function defaultTemplate (env) {
return `
window.process = {
env: ${ JSON.stringify(env) }
}
`
}
function exposeEnvMiddleware (getEnv, { template=defaultTemplate }={}) {
if (!getEnv || typeof getEnv !== 'function') throw new Error('Must provide getEnv() function')
return function (req, res) {
... | true |
0f5fc25ed9a2d7290c8bb38fb8ed40ab75b9e7dd | JavaScript | kylebarnett/React-Redux-App | /crypto-redux/src/reducers/index.js | UTF-8 | 848 | 2.546875 | 3 | [] | no_license | import { FETCHING_PRICE_START, FETCHING_PRICE_SUCCESS, FETCHING_MARKETCAP_START, FETCHING_MARKETCAP_SUCCESS } from '../actions';
const initialState = {
prices: [],
marketCap: [],
isFetching: false,
error: ''
}
export const reducer = (state = initialState, action) => {
switch (action.type) {
case FETCHIN... | true |
56f80f9e9c78fc34b453fbb04e75ca9a55c75fba | JavaScript | lilei1990/axutongxue.github.io | /cdn/dark-mode.js | UTF-8 | 1,535 | 2.921875 | 3 | [
"MIT"
] | permissive | function getCookie(name) {
var arr = document.cookie.split(';');
for (var i = 0; i < arr.length; i++) {
var arr2 = arr[i].split('=');
var arrTest = arr2[0].trim();
if (arrTest == name) {
return arr2[1];
}
}
}
function se... | true |
73af16e9ad6229fbee193a4f751c1f6dca4469d6 | JavaScript | viniciusbrg/web-developer-bootcamp | /front-end/javascript/basics/stalker-exercise.js | UTF-8 | 231 | 3.765625 | 4 | [] | no_license | var firstName = prompt("Your first name");
var lastName = prompt("Your last name");
var age = prompt("Your age");
console.log("Your full name is ".concat(firstName).concat(" ").concat(lastName));
console.log("Your age is " + age); | true |
0b0148a2e2c27a5839dfba3f4700fc4c0d198941 | JavaScript | Lamtaoui/esgi-javascript | /4IWJanvier/promise_system.js | UTF-8 | 4,374 | 3.46875 | 3 | [] | no_license | /**
* function Promise(callback) {
* let resolve, reject;
* setTimeout(function() {
* callback(resolve, reject);
* }, 0);
*
* this.then = function(uresolve, ureject) {
* uresolve && resolve = uresolve;
* ureject && reject = ureject;
* }
* this.catch = functi... | true |
f71d7cae415a1b204494a37ec49d3cd3d24c24d8 | JavaScript | PlainSight/adventofcode2015 | /day13/part1.js | UTF-8 | 1,519 | 3.21875 | 3 | [] | no_license | var fs = require('fs');
var input = fs.readFileSync('./input.txt', 'utf8').split('\r\n');
var people = {};
for (var i = 0; i < input.length; i++) {
//Alice would gain 2 happiness units by sitting next to Bob.
var extract = /([A-Za-z]+) would ([a-z]+) (\d+) happiness units by sitting next to ([A-Za-z]+)/.exec... | true |
a0a29777e8558a278b256aecd126bffbcdd43d78 | JavaScript | AlfredConlan/digitalcrafts-practice-exercises | /exercise-week2-day2.js | UTF-8 | 925 | 4.4375 | 4 | [] | no_license | // 1) In definining a for loop, what are the three expressions you need?
// 2) When would you use a while loop over a for loop?
// 3) Write a program to add all the numbers given in an array. for example input array [10,20,3,30,40,50]
// 4) What is a function and explain the advantages of writing a function
// 5) Rewri... | true |
a7f42efc084f9450e4eec751a4558c3cee894e8b | JavaScript | LWu93/Leslies-Algo-Practice | /Leetcode/May2020Challenges/cousinsInBinaryTree.js | UTF-8 | 1,764 | 3.5 | 4 | [] | no_license | // BFS to test if x and y are on the same level.
// to test for different parents,empty each queue's parent's left and right into an array.
// each level will have an array of children arrays. if x and y are on the same level but in different children arrays, they have different parents.
var isCousins = function(root, ... | true |
9a00881c7dfe7cb518ed8b5f838fccac094fe803 | JavaScript | patel1086/Employee-Wage-Node-JS | /if_else.js | UTF-8 | 1,563 | 4.125 | 4 | [] | no_license | //function for finding max and min in three numvers
function max(num1,num2,num3){
if(num1>=num2&&num1>=num3)
return num1;
else if(num2>=num1&&num2>=num3)
return num2;
else
return num3;
}
function min(num1,num2,num3){
if(num1<=num2&&num1<=num3)
return num1;
else if(num2<=num1&&num2<=num3)
... | true |
317d32b198eee9715718d65c46ecdedb60dd2fe8 | JavaScript | MonicaRolle/Practica-modulo-6-Algoritmo1 | /app2.js | UTF-8 | 3,855 | 4.59375 | 5 | [] | no_license | //ALgoritmo Calcular la letra aleatoria del DNI
// La entrada debe ser un número entre 0 y 99999999.
// Debemos calcular el resto de la división entera entre el número introducido y el número 23.
// Según el resultado, de 0 a 22, le corresponderá una letra de las siguientes: (T, R, W, A, G, M, Y, F, P, D, X, B, N, J,
/... | true |
c2464f3d5f84775bcc94d4e6c59f730b82abfac4 | JavaScript | tanasa-mircea/probleme | /second/1-maxim-minim/main.js | UTF-8 | 589 | 3.296875 | 3 | [] | no_license | let formSubmit = function(event) {
event.preventDefault();
let input = event.target[0].value,
inputVector = input.split(','),
min,
max = 0;
console.log(`Input vector is ${inputVector}`)
for (let index = 0; index < inputVector.length; index++) {
if (+inputVector[inde... | true |
cdb015aa31c6b3d24f0532dc3c304831c5aa3fd2 | JavaScript | redbubble-ash/JS | /Nov14/VolumeOfBox.js | UTF-8 | 187 | 2.734375 | 3 | [] | no_license | /*
Volume of a Box
https://edabit.com/challenge/ms3q5GYSpFpwxeFWX
*/
function volumeOfBox(sizes) {
return [...Object.values(sizes)].reduce((a,b)=>a*b,1);
}
// Note: Object.values(obj) | true |
14a584290ac2913ea9fb7915b4daac23c0e1d3e3 | JavaScript | RossBille/rtcss | /rtcss-core/src/Communication/Attributes/ReadOnlyTrackedAttribute.js | UTF-8 | 893 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Created by rossbille on 18/05/2015.
*/
export default class ReadOnlyTrackedAttribute {
constructor(datachannel,
name,
value,
onupdate) {
this.datachannel = datachannel;
this.name = name;
this.value = value;
this.onupdate = onup... | true |
a8353315946904a1ee751e1f1ddb1df209e2aef8 | JavaScript | idiazj06/Calculadora-react | /src/Calculator.jsx | UTF-8 | 2,363 | 3 | 3 | [] | no_license | import React, { useState } from 'react'
export const Calculator = () => {
const [result, setResult] = useState('')
const [calc, setCalc] = useState('')
const nums = [{ 'zero': 0 }, { 'one': 1 }, { 'two': 2 }, { 'three': 3 }, { 'four': 4 }, { 'five': 5 }, { 'six': 6 }, { 'seven': 7 }, { 'eight': 8 }, { 'n... | true |
734dff99c8c9b40384c35eedc1355d7542d5025c | JavaScript | future4code/Ana-Dias | /semana2/condicionais/index.js | UTF-8 | 2,702 | 4.0625 | 4 | [] | no_license | ////////////////Condicionais
//>>>>>>>>>>>>>>>>>Interpretação de código
//Questão 1
const respostaDoUsuario = prompt('Digite o número que você quer testar')
const numero = Number(respostaDoUsuario)
if (numero % 2 === 0) {
console.log('Passou no teste.')
} else {
console.log('Não passou no teste.')
}
//a. Ele p... | true |
d9d8ba7426cf2882fc5125124ac5e948c3ed0e20 | JavaScript | chingu-voyage7/Bears-Team-30 | /postgresDb/authHandlers.js | UTF-8 | 5,923 | 2.546875 | 3 | [] | no_license | const bcrypt = require('bcryptjs');
const saltRounds = 10;
const db = require('./index');
const {
makeQuery,
makeQueryInsertAuthInfo,
makeQueryInsertUser,
} = require('./pgHelpers');
const {
checkIfDuplicate,
getAuthInfo,
getUser,
checkUsername,
checkEmail,
checkId,
} = require('./authHelpers');
co... | true |
94848a368e75f3760bcb9c22302b16067a6a19db | JavaScript | kate-latushkina/basic-js | /src/dream-team.js | UTF-8 | 475 | 3.109375 | 3 | [
"MIT"
] | permissive | module.exports = function createDreamTeam(members) {
if (members == null || members == undefined || members == Number || !Array.isArray(members)) {
return false;
}
else {
let teamArr = [];
let result;
for (let i = 0; i < members.length; i++) {
if (typeof members[i] == 'string') {
tea... | true |
614259ef7eec56565809fa3084b189c92a926a1b | JavaScript | IanMFraser/url-shortening-landing-page-api | /server/server.js | UTF-8 | 1,044 | 2.578125 | 3 | [] | no_license | //load and initalize express server
const express = require('express');
const app = express();
const cors = require('cors');
const path = require('path');
require('dotenv').config();
//add express port
const PORT = process.env.PORT || 3001;
//connect to database
const connectDB = require('./config/db')
connectDB();
... | true |
39107688e0eb2bbb913fd3694a2c699ac97f8d50 | JavaScript | carloshssouza/UniversityStudies | /COM222/Trabalho06/e1/script.js | UTF-8 | 506 | 2.890625 | 3 | [] | no_license | const columnPages = document.getElementsByClassName("column-pages");
const columnBook = document.getElementsByClassName("column-book");
columnPages[0].addEventListener("click", (e) => {
e.preventDefault();
for (let i = 0; i < columnPages.length; i++) {
columnPages[i].style.backgroundColor = "lightgreen";
}
}... | true |
bef8a4cca96c13bee891173868beaa243c7395e0 | JavaScript | ShuvranilMondal/code-house | /js-file/file.js | UTF-8 | 3,225 | 2.625 | 3 | [] | no_license | let nav = document.getElementById("nav");
let navBtn = document.getElementById("nav-btn");
let navBar = document.getElementById("navbar");
let navbar=()=>{
nav.classList.toggle("nav-active");
}
navBtn.addEventListener("click",()=>{
navbar()
})
let img = document.getElementById('img');
let bgImageChnage=()=>{... | true |
21e0b72b3558b1c4b9fe35a5c799f5977045efe1 | JavaScript | eranfuchs1/DI_Bootcamp | /Week2/Day2/exercises/exercise_xp_gold/exercise_2/script.js | UTF-8 | 238 | 3.671875 | 4 | [] | no_license | let grade = parseInt(prompt("What's your grade?"));
if (grade > 90) {
console.log('A');
}
else if (grade > 80 && grade <= 90) {
console.log('B');
}
else if (grade >= 70 && grade <= 80) {
console.log('C');
}
else {
console.log('D');
}
| true |
67e467da454d44ec543f0834cbe89a3ae456145d | JavaScript | Mayankgupta688/TaviscaTraining | /JavaScript/StringLiterals.js | UTF-8 | 324 | 3.296875 | 3 | [] | no_license | var name = "Mayank";
var age = 20;
var designation = "Developer";
function getData() {
return "TEchnoFunnel"
}
console.log(`
The User Name is ${name} having age ${age}
and designated as ${designation} ${1 + 1} ${getData() + ' Company'}`
)
//The user name is Mayank having Age 20 and dei=signated as Devel... | true |
02c17e1f5046f11b897366270d17e9c351912883 | JavaScript | ztnice/Baidu-front-end-College-web | /html5/localstorge/localstorge.js | UTF-8 | 1,799 | 3.296875 | 3 | [] | no_license | //保存网站
function save(){
var site = new Object;
site.keyName =document.getElementById("siteKey").value;
site.siteName = document.getElementById("siteName").value;
site.siteUrl = document.getElementById("siteUrl").value;
//将对象转换为json
var jsonStr = JSON.stringify(site);
localStorage.setItem(sit... | true |
0b772b3c5652890750cc392d42eae10d4446e76d | JavaScript | muriithi/javascript | /functions/square.js | UTF-8 | 126 | 2.5625 | 3 | [] | no_license | function implicit() {
console.log(this);
console.log(arguments);
console.log(arguments.length);
}
implicit(); | true |
2829c0822eab5116daf855f806d46e466260c182 | JavaScript | correctiv/viz-simple-charts-legacy | /src/utils/get_chart_element.js | UTF-8 | 849 | 2.515625 | 3 | [
"MIT"
] | permissive | import 'd3'
/**
* return element to which a chart will be applied.
* if element not in `document`, it will be created
*
* this takes only care of the wrapper class if the selector
* element is not in the dom yet
*
* @param {string} selector - html querySelector
* @param {string} wrapper - wrapper classname (fo... | true |
300ad7a374a9a2e5a5fc8998ee121f0ff359ba88 | JavaScript | FreemapSlovakia/freemap-mapserver | /lib/tileCalc.js | UTF-8 | 4,142 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | // @ts-check
const turf = require('@turf/turf');
/**
* @typedef {import('./types').Tile} Tile
*/
module.exports = {
long2tile,
lat2tile,
tile2long,
tile2lat,
computeZoomedTiles,
tileRangeGenerator,
tile2key,
key2tile,
tileOverlapsLimits,
tileWithinLimits,
};
/**
*
* @param {number} lon
* @p... | true |
5960910bc0d90d2a462dc0b986a539904d5573c9 | JavaScript | yung6699/js-algorithm | /string/longestPalindrome.js | UTF-8 | 634 | 3.453125 | 3 | [] | no_license | function longestPalindrome (str) {
const reversedStr = str.split('').reverse().join('');
let result = '';
function expand (left, right) {
while (left >= 0 && right <= str.length && str[left] === str[right - 1]) {
left -= 1;
right += 1;
}
return str.slice(left + 1, right -1)
}
if (str... | true |
648bc1f9f7f35ecff933db0f7965a025395a9620 | JavaScript | roneystones/learning-chest | /jquery/product-page-with-interactive-colors/script.js | UTF-8 | 789 | 2.75 | 3 | [] | no_license | $(document).ready(function() {
$('.color-choose input').on('click', function() {
var headphonesColor = $(this).attr('data-image');
$('.active').removeClass('active');
$('.left-column img[data-image = ' + headphonesColor + ']').addClass('active');
$(this).addClass('active');
});
});
// d... | true |
b3b009721c81303d617e67c214cad9c62ad2e126 | JavaScript | SavenkovYS/Kekstagram | /docs/js/validation.js | UTF-8 | 2,170 | 3.328125 | 3 | [] | no_license | import submitForm from './formSubmit.js';
function setValidity() {
const hashtagsInput = document.querySelector('.text__hashtags');
const commentInput = document.querySelector('.text__description');
let userHashtags = [];
let userComment = '';
hashtagsInput.addEventListener('input', onHashtagInpu... | true |
630a6772d6ea500cc2ddfdfb451d108c7b289f83 | JavaScript | cul-it/scholars | /productMods/js/scholars-vis/rdf-helper-methods.js | UTF-8 | 2,202 | 3.046875 | 3 | [] | no_license | var RDF, RDFS, BIBO, FOAF, VCARD, VIVO;
function standardPrefixes() {
RDF = $rdf.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
RDFS = $rdf.Namespace("http://www.w3.org/2000/01/rdf-schema#");
BIBO = $rdf.Namespace("http://purl.org/ontology/bibo/");
FOAF = $rdf.Namespace("http://xmlns.com/foa... | true |
6ae6bcd3cec76227c57ec0ebd77a99bfb85b0752 | JavaScript | eddie3377/senators | /senate_house.js | UTF-8 | 3,256 | 2.5625 | 3 | [] | no_license | //document.getElementById("senate-data").innerHTML = JSON.stringify(data,null,2);
/*eslint-env browser*/
/*eslint "no-console": "off"*/
/*eslint "no-undef": "off"*/
/*global $*/
/*This is to descriminate by senate or house*/
var urlSenate = "https://nytimes-ubiqum.herokuapp.com/congress/113/senate";
var urlHouse = "ht... | true |
c89d07fe0a19899a3a9e4b1165782d2a9fe19ab5 | JavaScript | billg3/dumbo-web-031119 | /42-redux/airdnd/src/reducer.js | UTF-8 | 599 | 3.109375 | 3 | [] | no_license | // 1. Create a reducer
function reducer(state=defaultState, action){
// console.log(action)
// switch(action.type){
// case "ADD_CITIES":
// return {...state, cities: action.payload}
// default:
// return state
// }
const actions = {
ADD_CITIES: () => {
return {...state, cities: ... | true |
62d509cd874d893e3721cb7ab7db9c2dc63e98f3 | JavaScript | HannahArnold/challenges | /palendrome.js | UTF-8 | 284 | 3.453125 | 3 | [] | no_license | // isPalendrome = "Abigail"
// rev = isPalendrome.split("")
// console.log(rev)
// rev = rev.reverse()
// console.log(rev)
// rev = rev.join("")
// console.log(rev)
// if (isPalendrome == rev){
// console.log("its a palendrome")
// }else{
// ("it is not a palendrome")
// }
| true |