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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
aff8f1c8262db535e05a17e0720a8677aa0083a0 | JavaScript | patrickgalbraith/semillon | /src/common/components/Pagination.js | UTF-8 | 1,605 | 2.53125 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react'
import { Link } from 'react-router'
export default class Pagination extends Component {
renderPrev() {
const { currentPage, totalPages, direction } = this.props
const larr = String.fromCharCode(8592)
let delta = direction === 'asc' ? -1 : 1
if (cur... | true |
a2c420f7235f8cd258799f6024ad538f1af87bc2 | JavaScript | adrianojfn/g-wolf-gaming | /js/script.js | UTF-8 | 630 | 3.40625 | 3 | [] | no_license | // Recebe os elementos HTML em variáveis através de seu ID
let lForum = document.getElementById('loginForum');
let cForum = document.getElementById('cadastroForum');
// Função que remove a classe "d-none" do elemento #loginForum e adiciona ao elemento #cadastroForum caso já esteja visível
function loginForum() {
l... | true |
91035e6d1f33064feb9027222f019a62eac5bd27 | JavaScript | Aalekhjain2007/pro-31 | /sketch.js | UTF-8 | 1,661 | 2.734375 | 3 | [] | no_license | const Engine = Matter.Engine;
const World= Matter.World;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
var engine,world
var drops=[]
var maxDrops=100;
var umbrella1
var rand
var Thunder
var thunder1,thunder2,thunder3,thunder4
var thunderCreateFrame=0;
fun... | true |
6b6951905d26e545fd6588aeb177087cf75fb469 | JavaScript | yeasir99/To-do-list-app | /js/app.js | UTF-8 | 4,500 | 3.234375 | 3 | [] | no_license | function UiControlar() {}
UiControlar.prototype.addTaskToList = function(task) {
if (task.value === "") {
alert(`Before submit please inter task name`);
return;
}
const container = document.querySelector(".task-container");
const div = document.createElement("div");
div.className = "task-container_it... | true |
bffead35de7083476a212368ee93da201ece2705 | JavaScript | dalindev/LeetCode | /705__easy__design-hashset.js | UTF-8 | 2,470 | 4.125 | 4 | [] | no_license | /*
create 1000 bucket, use linked list inside, because linked list delete and add are O(1)
1. Swap
There is a tricky strategy we can use.
First, swap the element which we want to remove with the last element in the bucket.
Then remove the last element. By this way, we successfully remove the elem... | true |
2ff79661128aaaf4c8a9c07182bc8a0d93850a4a | JavaScript | pythonfirst/react-guidebook | /demo/react-hooks/src/hooks/useMousePosition.js | UTF-8 | 470 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react'
const useMousePosition = () => {
const [positions, setPosition] = useState({ x: 0, y: 0 })
useEffect(() => {
const updateMouse = (event) => {
setPosition({ x: event.clientX, y: event.clientY })
}
document.addEventListener('mousemove', updateMou... | true |
85bbfddbc703c92d4305fde8257bccaecfbf469c | JavaScript | party-uber/frontend | /src/services/auth.service.js | UTF-8 | 1,196 | 2.578125 | 3 | [] | no_license | import axios from 'axios';
async function login(email, password) {
const user = JSON.stringify({
email: email,
password: password
});
const res = await axios.post("https://partyuberauth.herokuapp.com/auth/login", user, {
headers: {
'Content-Type': 'application/json'... | true |
1dc36a62d0d0144dc95fda4d5dbc2c6b6d60a422 | JavaScript | David-Mavrodiev/Juniors-Bid-System | /public/js/timer.js | UTF-8 | 344 | 2.90625 | 3 | [
"MIT"
] | permissive | /*globals $ moment*/
$('.auction').each(function () {
var str = $(this).find('.time').text();
var parsed = moment(str);
var formatted = parsed.format('lll');
if (formatted !== 'Invalid date') {
$(this).find('.time').text('Ends at: ' + formatted);
}else{
$(this).find('.time').text('I... | true |
9fab0fc2713a36f26627f4adfc7fa380314fef54 | JavaScript | iwebexpert/corp-rostelecom-1 | /Sergey_Nikitin/lesson20/src/index.js | UTF-8 | 1,869 | 3.046875 | 3 | [] | no_license | import React from 'react';
import ReactDom from 'react-dom';
//Вариант 1
const element = React.createElement('h1', { className: 'react1', 'id': 'app1' }, 'Hello, React.js!');
//Вариант 2
//JSX
const element2 = <h1 className="react1" id="app1">Hello, React.js!!!</h1>;
var messagesData = ['Hello', 'Hi', 'Привет', 'Tes... | true |
a5611428706f9937e901a392bb758e9843df8e8f | JavaScript | ULL-ESIT-PL-1617/proyecto-pl-airam-jorge-kevin | /public/app/highlight.js | UTF-8 | 264 | 2.9375 | 3 | [] | no_license |
let removeHighLight = function(text) {
return text;
}
let updateHighLight = function(element) {
/*console.log(getSelectionCharacterOffsetWithin(element));
let range = document.createRange();
range.setR
element.innerHTML = element.innerHTML + "1";*/
}
| true |
8eb96b1387d569f019b29f9730c9fca0d87d3b21 | JavaScript | jennybehan/WebDevCurriculum | /Part 2. JavaScript/Quest 04. Hello, JavaScript/makestar.js | UTF-8 | 418 | 3.40625 | 3 | [
"MIT"
] | permissive | // input에 대한 typechecking 혹은 형변환 필요
var input = Number(window.prompt('star input'));
var star = '';
if (input) {
for (var i = 1; i <= input; i++) { // row
for (var j = 1; j <= input - i ; j++) { // white space
star += ' ';
}
for (var k = 1; k <= 2 * i - 1 ; k++) { // star
... | true |
103979baef701d9a3feb9cb4a60bbdbfb48b8aa3 | JavaScript | yiqianglin/nodejs | /cralwer.js | UTF-8 | 1,010 | 3.03125 | 3 | [] | no_license | var http = require('http');
var url = 'http://coding.imooc.com/';
var cheerio = require('cheerio');
function filterChapters(html){
var $ = cheerio.load(html);
var chapters = $('.bottom');
var courseData = []; //存放爬虫数据
chapters.each(function(item){
var chapter = $(this);
var c... | true |
6e2eaa77ab51f033fd5b72d3919b9bdc0702e3d3 | JavaScript | C-mccullo/mealer | /controllers/foodItemController.js | UTF-8 | 2,759 | 2.734375 | 3 | [] | no_license | const mongoose = require("mongoose");
const FoodItem = require("../models/FoodItemModel");
const Ingredient = require("../models/IngredientModel");
exports.getFoods = (req, res) => {
const userID = req.user._id;
// If no FoodItems for current user, send 204 status
FoodItem.find({ user: userID }).populate('ingred... | true |
04eee9930838b99de3589eb6cb2f6d2cb7d13251 | JavaScript | projetos-accenture-academy/omega-accenture-academy-2 | /scripts/login.js | UTF-8 | 1,375 | 3.328125 | 3 | [] | no_license |
//Gets user's info and tries to log them in
const UserLogin = async () =>
{
//erase possible existing error message
document.getElementById('login-error-warning').innerHTML = ""
let username = document.getElementById('username-input').value;
let password = document.getElementById('password-input').v... | true |
8527d2ff56c8d99219f8d01dbaa4d2e98ca7180f | JavaScript | hasansami75/Apply-JS | /factorialWhile.js | UTF-8 | 171 | 3.765625 | 4 | [] | no_license | function factorial(n){
var i=1;
var factorial = 1;
while(i<=n){
fact = fact * i;
i++;
}
return fact;
}
var result = factorial(5);
console.log(result); | true |
44d8da8e05fdff5b75e743cefef1c1219058277d | JavaScript | ArtemKha/stepik | /huffman.js | UTF-8 | 2,372 | 3.390625 | 3 | [] | no_license | function count(string) {
const str = string.split('')
const frequency = {}
str.forEach( ltr => {
if (ltr in frequency) {
frequency[ltr] += 1
} else {
frequency[ltr] = 1
}
})
return frequency
}
function toLeaves(obj) {
const sortable = []
for (let ltr in obj) {
sortable.pus... | true |
40204d08941081e2163e3db1ca79c681db8e76ca | JavaScript | jumireles/Initial-Pre-Work | /5-Introduction-to-JavaScript/106-Use_the_Conditional_(Ternary)_Operator.js | UTF-8 | 296 | 3.46875 | 3 | [] | no_license | //Learned how to use ternary operators (?:) which can help in re-writing if statements.
//such as condition ? statement if true: statement if false.
//Also recheck instructions and look at strict equality operators.
function checkEqual(a, b) {
return a == b ? true : false;
}
checkEqual(1, 2);
| true |
8eaed8ea3ed4738898baa68c43f37fbc99eab304 | JavaScript | bhaktijkoli/eshop | /resources/assets/js/scripts/modal.js | UTF-8 | 3,670 | 2.546875 | 3 | [
"MIT"
] | permissive | // Modal JS
window.modal = {
showModalDefault: function(title, message, button, callback="") {
$('body').append(`<div class="modal fade" id="dynamicDefaultModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class... | true |
1bf46bc3031d97809d36ac48112aa4506fbfbce8 | JavaScript | sjsaarinen/Elokuvakirjasto | /test/movie_list_test.js | UTF-8 | 3,259 | 2.921875 | 3 | [] | no_license | describe('Movie list', function(){
var controller, scope;
var FirebaseServiceMock;
beforeEach(function(){
// Lisää moduulisi nimi tähän
module('MovieApp');
FirebaseServiceMock = (function(){
var movies = [
{
name: 'Commando',
dire... | true |
7e178cb22fe30d6eef02861f9812c9653df2d434 | JavaScript | EdwardLea/cats | /controllers/cats.js | UTF-8 | 1,105 | 2.90625 | 3 | [] | no_license | const Cat = require('../models/cat')
function indexRoute(req, res) {
Cat
.find()
.then(cats => res.status(200).json(cats))
}
function createRoute(req, res) {
Cat
.create(req.body)
.then(cat => res.status(201).json(cat))
.catch(err => res.status(422).json(err.errors))
}
function showRoute(req, ... | true |
51abd1f8e05d78edcbc6cb23ea16b5a24f1d53f4 | JavaScript | GrzegorzNecka/oj-ciasteczkowy-potwor | /index.js | UTF-8 | 585 | 2.75 | 3 | [] | no_license | // Import stylesheets
import "./style.css";
const cookieInfo = document.querySelector(".cookie-info");
const getCookie = () => window.localStorage.getItem("cookie");
const setCookie = () => window.localStorage.setItem("cookie", "1");
const delCookieAlert = cookie => {
if (cookie === "1") {
cookieInfo.style.displ... | true |
b11c72836cc55b329d2ef6cd3edaf813d3f47875 | JavaScript | hotehrud/electron-reload | /main.js | UTF-8 | 1,344 | 2.5625 | 3 | [] | no_license | const { app, ipcMain, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')
const dgram = require('dgram');
const server = dgram.createSocket('udp4');
const { HOST, PORT } = require('./config/socket')
class App {
constructor () {
this.app = app
this.server = server
... | true |
14fce728e5096ebd3c00314db1b564eb3d0715f2 | JavaScript | Edd1525/cypress-ui-api-tests | /cypress/integration/run/data.spec.js | UTF-8 | 1,106 | 2.71875 | 3 | [] | no_license | describe('Write / Read data to JSON / Text file', () => {
it('Write data to JSON file', () => {
cy.writeFile('cypress/fixtures/data.json', {
name: 'Joe',
surname: 'Smith',
email: 'js@gmail.com',
password: 'joesmith'
})
cy.readFile('cypress/fixtures/data.json').then(user => {
... | true |
decbb5fec948b1a0df3eaf513cbc920d95a45a6e | JavaScript | AnikaRahman09/assignment3 | /assignment.js | UTF-8 | 1,644 | 3.65625 | 4 | [] | no_license |
//https://github.com/AnikaRahman09/assignment3
// kilometerToMeter
function kilometerToMeter(num){
var meter = num * 1000;
return meter;
}
var result = kilometerToMeter(9);
console.log(result);
// kilometerToMeter
// budgetCalculator
function budgetCalculator(watchAmount,phoneAmount,LaptopAmount){
... | true |
f5b8a5fba1da870cdf1a86b4f53862ad86dbc762 | JavaScript | KeithSilcock/mern-setup | /client/src/components/test.js | UTF-8 | 874 | 2.75 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
class Test extends React.Component{
componentDidMount(){
this.getUserData();
this.getArticle();
this.sendData();
}
async getUserData(){
const response = await axios.get('/api/user-data');
console.log(response)
... | true |
3a5d67cce2634d24c3aaebefa187f40a243a01c9 | JavaScript | marciamota/Project-3-Weather-Journal-App | /website/app.js | UTF-8 | 2,827 | 3.578125 | 4 | [] | no_license | /* Global Variables */
const apiKey = 'here goes your api key';
const apiUrl = 'http://api.openweathermap.org/data/2.5/weather?units=imperial';
// Create a new date instance dynamically with JS
let d = new Date();
let newDate = (d.getMonth()+1)+'-'+ d.getDate()+'-'+ d.getFullYear();
document.getElementById('generate'... | true |
8562f0aa9eecf8f7902627653caf9667528298c7 | JavaScript | Bharat-Kendre123/JsTraining | /session_test/Test2.js | UTF-8 | 1,571 | 3.828125 | 4 | [] | no_license | let user = {
name : 'bharat',
age : 27
};
user = 'Bharat';
for (let value of user){
console.log(value);
}
for(let key in user){
console.log(key);
}
console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
let arr2 = [1, 2, 3, 4, 5];
for(let key in arr2){
console.log(key);
}
co... | true |
9c58e166fa01be41e193d39f457077c0de18edfd | JavaScript | mikeaustin/impulse-js | /lib/runtime/union.js | UTF-8 | 1,345 | 3.140625 | 3 | [
"MIT"
] | permissive | "use strict";
/**
* @constructor Union
* @memberof module:impulse
*
* @summary A Union type that allows runtime parameter typechecking with different types.
**/
function Union(iterable) {
this.values = Array.prototype.slice.call(iterable, 0);
}
Union.of = function () {
return new Union(arguments);
};
Union... | true |
363fb48a874cfa364c9e27239f531a95a5e23a3c | JavaScript | seasarorg/gusuku | /Gusuku/WEB-INF/page/js/gusuku.js | UTF-8 | 745 | 3 | 3 | [] | no_license | var normalColor = "transparent";
var hoverColor = "#EEEEEE";
function mout(obj) {
obj.style.backgroundColor = normalColor;
}
function mover(obj) {
obj.style.backgroundColor = hoverColor;
}
function swapVisibility(elementId, anchorElement) {
var style = document.getElementById(elementId).style... | true |
b736677e5d6acd38ea75f8989f3ecabd4cfac5f8 | JavaScript | adilson-utiama/react-redux-fundamentos | /exercicios_webpack/ex/logger.js | UTF-8 | 142 | 2.578125 | 3 | [] | no_license | //Padrao do ES2015
export function info(text) {
console.log(`INFO: ${text}`);
}
// usando padrao CommonJS
// module.exports = { info } | true |
16ad30562da6a0d13eb2eee7168f6fc9dc8168e6 | JavaScript | rlaxognsk/myFirstPHPCRUD | /src/js/main.js | UTF-8 | 2,309 | 2.53125 | 3 | [] | no_license | var POFOL = POFOL || {};
POFOL.main = {
init: function () {
this.write();
this.delete();
},
write: function () {
var $write = $( '.article_write' );
$write.on( 'click', function () {
location.href = $( this ).data( 'href' );
} );
},
delete... | true |
35217a17b30206ef81b3a89423412815c8a5482f | JavaScript | sumedha1308/react-practise | /src/Clock.js | UTF-8 | 730 | 2.9375 | 3 | [] | no_license | import React from 'react';
class Clock extends React.Component {
constructor(props) {
super(props);
this.state = { date: new Date(), name: 'DD' };
}
componentDidMount() {
this.sumedha = setInterval(() => this.tick(), 1000);
}
componentWillUnmount() {
clearInterval(... | true |
c31874b046810972e40704a2e8601a3d56ea2fb4 | JavaScript | robbee72/javascript_termifiles | /Uppercase.js | UTF-8 | 281 | 3.390625 | 3 | [] | no_license | function Hello(name) {
function upper(str) {
return str.toUpperCase();
}
function speak(last_name) {
console.log( upper(name), last_name);
}
var public_api = {
say: speak
};
return public_api;
}
var o = Hello("Fred");
o.say("Coors"); // FRED Coors
| true |
1c62aaabde3f8e5f33c906d913adbd3668a9363e | JavaScript | miguelromeral/Formula1History | /F1_mvc/Scripts/googlemaps.js | UTF-8 | 951 | 2.640625 | 3 | [
"MIT"
] | permissive | // Where all the fun happens
function Initialize(lat, lng) {
// Google has tweaked their interface somewhat - this tells the api to use that new UI
google.maps.visualRefresh = true;
var location = new google.maps.LatLng(lat, lng);
// These are options that set initial zoom level, where t... | true |
346a9f7d29f6695d587f1eee618d7acfab8db15d | JavaScript | jonnysteiner/Automation-framework-tutorials-Puppeteer | /scraping.js | UTF-8 | 478 | 2.578125 | 3 | [] | no_license | const puppeteer = require('puppeteer');
(async () => {
const url = 'https://experitest.com/mobile-application-testing-news/';
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url, { waitUntil:'networkidle2'});
const data = await page.evaluate(() => {
const title = ... | true |
a026cb7a7e67beebf570c8f1aaa2a93b7e9a5620 | JavaScript | Yaroslav-95/spanish-checkers | /client/js/board.js | UTF-8 | 9,542 | 2.734375 | 3 | [
"BSD-3-Clause",
"BSD-3-Clause-Clear"
] | permissive |
var playerColor = "white";
var defaultSquareIDs = [
'a8', 'b8', 'c8', 'd8', 'e8', 'f8', 'g8', 'h8',
'a7', 'b7', 'c7', 'd7', 'e7', 'f7', 'g7', 'h7',
'a6', 'b6', 'c6', 'd6', 'e6', 'f6', 'g6', 'h6',
'a5', 'b5', 'c5', 'd5', 'e5', 'f5', 'g5', 'h5',
'a4', 'b4', 'c4', 'd4', 'e4', 'f4', 'g4', 'h4',
'a... | true |
a4d691abe9723373c647c6f719c0d6b3e72607dc | JavaScript | Luzu321/MinBucksBot | /commands/removerole.js | UTF-8 | 1,035 | 2.640625 | 3 | [] | no_license | const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return message.reply("You Must Have The Admin/Staff Role To Use !removerole.");
let rMember = message.guild.member(message.mentions.users.first()) || message.guild.membe... | true |
fc34e089ab4be5ecfaa26d8d96fd40c3533bccd5 | JavaScript | camilaPolania/ArtesaniasDeColombia-Web | /public/style/animacion.js | UTF-8 | 1,746 | 3.171875 | 3 | [] | no_license | // codigo referenciado de openprocessing
var nTiles = 8;
var nFrames = 128;
var phase = 0.0;
var phaseInc = 1.0 / nFrames;
// Draw sine wave
function drawWave(w, freq, amp, phase) {
push();
beginShape();
for (var x = -w / 2.0; x < w / 2.0 + 1; x++) {
vertex(x, sin(x / w * TAU * freq + phase) * amp);
}
endShape(... | true |
b66785ce6642bdcd912873565319bbd58bbb05ad | JavaScript | hyvents/IngresoUTN2018 | /5-InstruccionWhile/jsIteraciones (8).js | UTF-8 | 491 | 3.421875 | 3 | [
"MIT"
] | permissive | function Mostrar()
{
var contador=0;
var positivo=0;
var negativo=1;
var numero;
var flag=0;
while(flag==0)
{
numero=prompt("ingrese si para salir");
if(numero=="s")
{
flag=1;
}
else
{
numero=parseInt(numero);
if(numero>=0)
{
positivo=positivo+numero;
}
else
{
... | true |
ac0158045dadbe240bbbff06a64bb1ef834cc3de | JavaScript | SuneRadich/Knockout.ChekcedReverse | /checkedReverse.js | UTF-8 | 1,071 | 2.9375 | 3 | [] | no_license | /**
* Set the UI state to the opposite of a boolean value. ie. if the observable is true, the checkbox is not checked.
*/
ko.bindingHandlers.checkedReverse = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
var value = valueAccessor();
//Set the checkbox checked state... | true |
afaed5e950e353c6842e84b6d59042a0ba97c9e7 | JavaScript | lorrayneantonielle/FundamentosJS | /tipagemfraca.js | UTF-8 | 397 | 3.5 | 4 | [] | no_license | let qualquer = 'Legal'
console.log(qualquer)
console.log(typeof qualquer)
// variáveis podem mudar os tipos
// tipagem fraca quer dizer que a variável pode ser de qualquer tipo
// e não é necessário definir o tipo da variável
qualquer = 3.1516
console.log(qualquer)
console.log(typeof qualquer)
// evitar escolher no... | true |
0980e7656bcd074551027f4c5f454ba81a6dd726 | JavaScript | sheng1998/nodeNotes | /重学node基础/07_url模块(爬虫)/模拟浏览器操作-Puppeteer/获取小说标题,链接/index.js | UTF-8 | 1,655 | 2.875 | 3 | [] | no_license | const puppeteer = require('puppeteer');
let fs = require('fs');
;(async () => {
const browser = await puppeteer.launch({headless:false})
let page = await browser.newPage()
await page.goto('https://sobooks.cc/xiaoshuowenxue')
let totalPage = await page.$eval('.content-wrap .pagination ul li:last-child s... | true |
8c9868426b1527c2fcb87522bfb0a598b23d8531 | JavaScript | klyaba/Bookshelf | /resources/controller.js | UTF-8 | 9,050 | 3.078125 | 3 | [] | no_license | // Книги по умолчанию
var books = [{
image: 'http://www.booksiti.net.ru/books/58932900.jpg',
info: {
title: 'Страна багровых туч',
author: 'Аркадий и Борис Стругацкие',
year: '1957'
}
},
{
image: 'http://rusbuk.ru/uploads/book/1515510/bd575f039aafbea20ed97370adc0fe867c71e... | true |
3258022122b4d2cb8f3789d75aa5347ef50ea3e1 | JavaScript | MartinLoera/Problemas_JS | /js_5.js | UTF-8 | 189 | 3.234375 | 3 | [] | no_license | let num = 0
let acum = 0
while (num <= 100) {
if (num % 2 != 0) {
console.log(num)
acum++
}
num++
}
console.log(`Existen ${acum} numeros impares entre 0 y 100`)
| true |
bb1557f20e36207a725b12bb69aa728dd285f847 | JavaScript | tonygurnick/herokucore | /src/core/services/authentication/chkauth.js | UTF-8 | 267 | 2.609375 | 3 | [] | no_license | "use strict";
require("colors");
module.exports=function(req, res, next) {
console.log("CHKAUTH:".blue);
if (req.isAuthenticated()) {
console.log("AUTHORISED".green);
return next();
}
console.log("UNAUTHORISED".red);
res.redirect("/login");
}; | true |
a2d276e782d76255cf0cc63fdda403644057b3b2 | JavaScript | zachwolf/CoffeeScript-Timer | /dev/demo.js | UTF-8 | 1,260 | 2.921875 | 3 | [] | no_license | // Generated by CoffeeScript 1.4.0
(function() {
var Slider, Timer;
Timer = (function() {
function Timer(tick, context) {
this.tick = tick;
this.context = context != null ? context : this;
this.interval = 1000;
this.enable = false;
this.timerId = 0;
}
Timer.prototype.sta... | true |
7b27a9b13fa8ff5bb7775e584691eaf4c76c0e5a | JavaScript | amritdanewalia/EquityTradingApplication | /EquityTradingApplication/EquityTradingApplicationUI/src/components/app.js | UTF-8 | 1,423 | 2.625 | 3 | [] | no_license | import React from 'react';
import TodoHeader from './todoHeader';
class App extends React.Component {
constructor(props) {
super(props);
this.state={
todos: [],
value:""
};
}
push(event){
event.preventDefault();
var oldTodos = this.state.todos.slice();
oldTodo... | true |
4096f44f16882888afd3c94cd937ffae39353a9e | JavaScript | jdb409/benchmark | /server/seed.js | UTF-8 | 1,187 | 2.609375 | 3 | [] | no_license | const request = require('request')
const csv = require('csvtojson')
const db = require('./db')
const { Candidate, Company } = db;
//csv receievs a stream from the csv and processes each row before moving on to the next one
const seed = () => {
csv()
.fromStream(request.get('https://s3.amazonaws.com/simpl... | true |
3a2ac4143e38a5c1ea71abc1e74467e4a89d079d | JavaScript | shinyford/celtxstamp | /public/javascripts/application.js | UTF-8 | 687 | 2.625 | 3 | [] | no_license | // Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
if ( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
try { return new ActiveXObj... | true |
dd67001a140c6b1e263b11e4a2018d68c5bfe91d | JavaScript | woqi/woqi-weather | /index.js | UTF-8 | 1,581 | 3.15625 | 3 | [] | no_license |
// var apiName = "http://api.jirengu.com/getWeather.php"
// var http = require('http')
// http.get(apiName, (res) => {
// const { statusCode } = res;
// const contentType = res.headers['content-type'];
// let error;
// if (statusCode !== 200) {
// error = new Error('Request Failed.\n' +
// ... | true |
8dc0880f628424029ef66095a039f48c2353967c | JavaScript | brenermarina/FluffyDoughBakery | /src/components/Desserts/AvailableDesserts.js | UTF-8 | 1,150 | 2.59375 | 3 | [] | no_license | //import { useEffect, useState } from 'react';
import Card from '../UI/Card';
import DessertItem from './DessertItem/DessertItem';
import classes from './AvailableDesserts.module.css';
const DUMMY_DESSERTS = [
{
id: 'm1',
name: 'Apple & Blackberry Crumble',
description: 'Best pie you ever tried!',
... | true |
fffc9c9512ea0a5d237877310fc9c88b809a996d | JavaScript | ipch4/shifumijs | /script.js | UTF-8 | 986 | 3.375 | 3 | [] | no_license | function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min +1)) + min;
}
function shiFuMi(arg) {
var possibleChoices = ['pierre', 'feuille', 'ciseaux'];
var choice = possibleChoices[getRandomIntInclusive(0, 2)];
v... | true |
1f5474cc4a7925fc9fddf9dd1cc31d5a3c873c07 | JavaScript | MatthewPhinney/five-bells-sender | /test/quoteUtils.test.js | UTF-8 | 2,516 | 2.515625 | 3 | [] | no_license | /* eslint-env node, mocha */
'use strict'
const assert = require('assert')
const nock = require('nock')
const quoteUtils = require('../src/quoteUtils')
const connector = 'http://connector.example'
describe('quoteUtils.getQuoteFromConnector', function () {
it('gets the quote', function * () {
const quoteNock = no... | true |
fd27854aa91ff6a055730a72671777f527064b34 | JavaScript | danimur92/BedApp2 | /controllers/patient.controller.js | UTF-8 | 1,499 | 2.671875 | 3 | [] | no_license | const Patient = require('../server/models/patient.model');
// 1. Simple version, without validation or sanitation
exports.test = function (req, res) {
res.send('Greetings from the Test controller!');
};
// 2. Create new product --> POST localhost:1234/products/create
// Write in body, with x-www-form tagged
exp... | true |
07d7bf0415abe8fe980dd16dc59d4feb7c9702cc | JavaScript | HoangHip/demo-web | /docs/js/index.js | UTF-8 | 1,732 | 3.421875 | 3 | [] | no_license | // let message = 'Welcome to my website'
// const is unchanged var
// const welcome = function() {
// alert(message)
// }
// const sum = function(a, b) {
// return a+b;
// }
// const sum2 = (a, b) =>a + b
// const handleClick = () => {
// alert('Click')
// }
// let string = 'abc'
// window.onclick = h... | true |
98df1668416f91a19e26eca0ee42a2acde9d7bb8 | JavaScript | anharfathoni/server_e-commerce | /controllers/itemController.js | UTF-8 | 2,073 | 2.78125 | 3 | [] | no_license | const Item = require('../models/Items.js')
class itemController {
static addItem(req, res) {
let data = JSON.parse(req.body.data)
let { name, price, stock, category, description } = data
let link = req.file.cloudStoragePublicUrl
let newItem = { name, price, stock, category, description, link }
... | true |
d113d8aef47cd5dc4ca9412ee19601232d591ab3 | JavaScript | p4co86/smartMeter | /src/main/client/plotData.js | UTF-8 | 7,207 | 2.734375 | 3 | [] | no_license | /**
plot N Lines of data on the same graph
this is a more complete version of plotDJ
the data is expected as N-Dimensional array with
data.xLabels:
data.x
data.y1
data.y* ...
data.yn
*/
var plotN = function (data, targetdiv, title) {
console.log ('in plotN (data, '+targetdiv+', '+title+')');
var
title = ty... | true |
38faaa4c1b8c2c0630e8dbf8598506841ede6d7a | JavaScript | VitoMakarevich/library-client | /src/components/author.js | UTF-8 | 1,293 | 2.546875 | 3 | [] | no_license | import React from 'react';
import '../styles/author.scss'
const Author = ({author, handleUpdate, handleDelete, handleFirstNameChange, handleLastNameChange}) => (
<div className="author">
<form className="author__inner" onSubmit={handleUpdate}>
<div className="form-group">
<label... | true |
b7e6527d0697c8cc7cb1054d2decd5409c3d6fc0 | JavaScript | Faktura179/Projekt-Serwerowe | /static/js/Player.js | UTF-8 | 4,883 | 2.640625 | 3 | [] | no_license | class Player extends THREE.Object3D {
constructor(name, modelSrc, textureSrc, scale, position, rotationy) {
super()
this.name = name
this.pos = 0
this.nextBlock
this.moves = 0
this.isMoving = false
this.extraValue = 0
this.extraRolls = 0
var th... | true |
27d30dcd461c1bbaa9c16f0b2ad9b009894e412d | JavaScript | 985616770/zixue | /learning/reading notes/you don't konw JS book/THIS&OBJECT PROTOTYPES/3.object2.js | UTF-8 | 711 | 3.453125 | 3 | [] | no_license | var myObject = {
a: 2,
b: 3
};
Object.defineProperty(myObject, Symbol.iterator, {
enumerable: false,
writable: false,
configurable: true,
value: function() {
var o = this;
var idx = 0;
var ks = Object.keys(o);
return {
next: function() {
return {
value: o[ks[idx++]],... | true |
e06baa3685a5da2ebae08baa1523f66ff446493d | JavaScript | jorgelisari1/md-links | /lib/links.js | UTF-8 | 3,840 | 2.765625 | 3 | [] | no_license | const path = require('path');
const fs = require('fs');
const fetch = require('node-fetch');
const isValidRoute = route => fs.existsSync(route);
const itsAbsolute = route => path.isAbsolute(route);
const changeToAbsolute = relativeRoute => path.resolve(relativeRoute);
const isFilePath = (route) => {
const stats ... | true |
848d6750f82b3a8e48e3fdbf8669aac342520818 | JavaScript | Bryant-Wang24/jest | /src/utils/permission.js | UTF-8 | 1,448 | 2.609375 | 3 | [
"MIT"
] | permissive | import store from '@/store'
/**
* @param {Array} value
* @returns {Boolean}
* @example see @/views/permission/directive.vue
*/
export default function checkPermission(value) {
if (value && value instanceof Array && value.length > 0) {
const roles = store.getters && store.getters.roles
const permissionRol... | true |
a54e89f94e1b0228af4b9bfcca024adccbaccb22 | JavaScript | laurengibbonz/web2class5 | /fetch.js | UTF-8 | 2,894 | 3.171875 | 3 | [] | no_license | const api = '8bd32c8b25477b92c6a32c7c6b7faa13',
unit = 'metric';
let lat = '-22.9028',
long = '-43.2075',
url = `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${long}&exclude=hourly,minutely,alerts&appid=${api}&units=${unit}`;
console.log(url);
document.querySelector('#cities').addEventL... | true |
2348e3e5dbb5ad05010c6af0175fef2d5165315e | JavaScript | Anieto86/proShop | /backend/controllers/productController.js | UTF-8 | 888 | 2.5625 | 3 | [] | no_license | //*recordar primero sacamos las rutas del servidor unsando router = express.Router(); y a hora vamos a enviar la funcionalidad de las rutas a los controladores
//todo llamamos al modelo para hacer las busquedas en la rutas
import Product from "../models/productModel.js";
import asyncHandler from "express-async-handler"... | true |
481b142b7ed41b3c5163962d3e4ac6e782fbe5da | JavaScript | loquacious-credenza/Lantern | /Client/Src/actions/waypoint-actions.js | UTF-8 | 1,175 | 2.78125 | 3 | [] | no_license | 'use strict';
import { ADD_WAYPOINT, CONFIRM_IN_RANGE } from '../constants/action-types';
import {
SERVER_URL,
SERVER_PORT
} from '../constants/network';
/**
* Add geolocation data to the activeTrip.
* The payload is pushed into the `activeTrip.waypoints` array.
* @param {object} payload object with gelocatio... | true |
ff08b553b28e6b3ea2a677d3dc3ec2a7ecfc3cbc | JavaScript | psantwani/chess-oops | /Pieces/IPiece.js | UTF-8 | 3,438 | 3.296875 | 3 | [] | no_license | const Pawn = require("./Pawn");
class IPiece {
constructor(name, color, position) {
this.name = name;
this.color = color;
this.initialPosition = position;
this.currentPosition = position;
}
checkIfMoveWithinBounds(startPosition, endPosition) {
let x1 = startPosition[0];
let x2 = endPosit... | true |
dacc2b9d25d12a6d3f47ea6379251a08a13cb4cf | JavaScript | barlesh/client-server-ws | /server/app/server.js | UTF-8 | 518 | 2.59375 | 3 | [] | no_license | const WebSocket = require("ws");
console.log("Server: Listening to the fans....");
const wss = new WebSocket.Server({ port: 8080 });
wss.on("connection", function connection(ws) {
ws.on("message", function incoming(message) {
console.log("Server: received: %s", message);
if (message == "Yalla!") {
co... | true |
63038a65265b0ae5e41c6a2f29ab87689268c283 | JavaScript | Nitinjha121/imdb-clone | /src/reducers/searchReducer.js | UTF-8 | 536 | 2.546875 | 3 | [] | no_license | const intialState = {
getSearchData: [],
pageCount: {},
isLoading: true,
error: "",
};
const searchReducer = function (state = intialState, action) {
switch (action.type) {
case "GET_SEARCH":
return {
...state,
getSearchData: action.payload.getSearch.data.results,
pageCount:... | true |
ce10a7c0eb0c6e587d9e1b668d89632ac9fbbb0e | JavaScript | Alisalucy/- | /仿京东/js/index.js | UTF-8 | 1,412 | 2.671875 | 3 | [] | no_license | // JavaScript Document
$(function(){
//初始化
var size=$(".tupian li").length;
for(var i=0; i<size; i++){
$(".yuan").append("<li></li>")
}
$(".tupian li").eq(0).show();
$(".yuan li").eq(0).addClass("on");
//yuan圆点居中对齐 outerwidth是元素的内外间距总长度
var numwidth=$(".yuan").outerWidth()/2;
$(".yuan").css... | true |
884f803e4b1d3cebcba871f5b15fc4e8d9bddb47 | JavaScript | abdellah711/chattariro | /client/src/hooks/useStickyState.js | UTF-8 | 332 | 2.59375 | 3 | [] | no_license |
import {useState,useEffect} from 'react'
const useStickyState = (initialState,key) => {
const [state, setState] = useState(()=> (JSON.parse(localStorage.getItem(key)) ?? initialState))
useEffect(() => {
localStorage.setItem(key,state)
}, [state])
return [state,setState]
}
export default use... | true |
173b02aea5d36789bb9270e9e496f8290a20e05d | JavaScript | katana-tran/leetcode-algorithms | /longest-common-prefix.js | UTF-8 | 906 | 3.53125 | 4 | [] | no_license |
//https://leetcode.com/problems/longest-common-prefix/submissions/
/**
* @param {string[]} strs
* @return {string}
*/
var longestCommonPrefix = function(strs) {
if (strs.length < 1){
return ""
} else if (strs.length === 1){
return strs[0]
}
let longestPrefix = strs[0]
let curren... | true |
0b8a12038d7353172f3b062316cc42e94f8e1754 | JavaScript | newbiet21379/Sapo-Trainee | /Ex11_ReactJS_2/front-end/src/Component/AddCategory.js | UTF-8 | 3,131 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import CategoryDataService from '../Service/category.service';
import moment from 'moment';
export default class AddCategory extends Component {
constructor(props) {
super(props);
this.newCategory = this.newCategory.bind(this);
this.handleChange = this.handleChange.bind... | true |
ee592c966ba1ae9128b47c8c663009e41fc6673f | JavaScript | devcoder111/One-menu | /public/reducers/currencies.reducer.js | UTF-8 | 739 | 2.671875 | 3 | [] | no_license |
var initialCurrenciesState = {};
export function _currencies(state = initialCurrenciesState, action) {
// please use redux devtools from chrome/firefox ext
// console.log('_currencies reducer called with state ', state , ' and action ', action);
switch (action.type) {
case 'GET_CURRENCIES_REQUEST':
r... | true |
b546f5cb5c3365b2ff2fb3506de7d2010889d1e7 | JavaScript | blonardi/BautistaLonardi2 | /tarea6/script.js | UTF-8 | 512 | 3.9375 | 4 | [] | no_license | //Creo una constante con un objeto $numeros y le asocio la seleccion del boton.
const $numeros = document.querySelector('.button');
//Creo la funcion de click en el boton con el objeto $numeros
$numeros.onclick = function(){
// Creo la variable de nums con numeros random hasta 10 y con Math.floor que los redondea a en... | true |
5a0bb3a5d2ea02e90a95f7c1fe2f96b2aa6f0989 | JavaScript | therouv/sulu | /src/Sulu/Bundle/AdminBundle/Resources/js/components/Tabs/Tabs.js | UTF-8 | 1,456 | 2.53125 | 3 | [
"MIT"
] | permissive | // @flow
import React from 'react';
import type {ChildrenArray, Element} from 'react';
import Tab from './Tab';
import tabsStyles from './tabs.scss';
type Props = {
children: ChildrenArray<Element<typeof Tab> | false>,
onSelect: (tabIndex: number) => void,
selectedIndex: ?number,
};
export default class T... | true |
ad10f8ed2382e89764fc27cd950ed8323a7ff07d | JavaScript | jordanbtucker/neodon-json6 | /test/unit/json6.js | UTF-8 | 809 | 2.859375 | 3 | [
"Artistic-2.0"
] | permissive | 'use strict';
var json6 = require('../../lib/index.js');
describe('json6', function() {
it("json6('{}') is {}", function() {
expect(json6('{}')).to.deep.equal({});
});
it("json6('[]') is []", function() {
expect(json6('[]')).to.deep.equal([]);
});
it("json6('0') is 0", function() {
expect(json6... | true |
b05d0899e879837cc1b711795da452e072312d6b | JavaScript | PylonOni/EcardWebsite | /DLIC06_20FTT1798-20FTT1805/jsfile/temp2.js | UTF-8 | 8,232 | 2.609375 | 3 | [] | no_license | function selectMsg(id) {
var msgBtns = document.getElementsByClassName("greetMsg");
var i;
for (i = 0; i < msgBtns.length; i++) {
msgBtns[i].disabled = false;
}
var selectedBtn = document.getElementById(id);
selectedBtn.disabled = true;
}
function preview() {
//START ex... | true |
418407cac22731382f37dd83d7f7b65aa69a29e5 | JavaScript | ritwizsinha/Xmeme | /client/src/components/CreatePost/index.js | UTF-8 | 1,276 | 2.515625 | 3 | [] | no_license | import { useState } from 'react';
import './style.css';
import Modal from '../Modal';
import { SERVER_URL } from '../../constants';
import axios from 'axios';
const CreatePost = () => {
// State controlling the visiblity of modal
const [open, setOpen] = useState(false);
// Post function to be passed to th... | true |
47f305541a93df49543a28e4a5c5719586550612 | JavaScript | switch0303/algorithm016 | /Week_08/231_power-of-two.js | UTF-8 | 276 | 2.859375 | 3 | [] | no_license | // 231. 2的幂
// https://leetcode.com/problems/power-of-two/discuss/
// https://leetcode-cn.com/problems/power-of-two/
// math, bit-manipulation
/**
* @param {number} n
* @return {boolean}
*/
var isPowerOfTwo = function (n) {
return n > 0 && (n & (n - 1)) === 0;
};
| true |
b075e1dfcd8c6fb367fb5ffada51d4031f7eefc8 | JavaScript | jonchr/Flashcards | /ClozeCard.js | UTF-8 | 498 | 3.375 | 3 | [] | no_license |
function ClozeCard (text, cloze) {
if(!(this instanceof ClozeCard)) return new ClozeCard(text, cloze);
//the entire text
this.fullText = text;
//the cloze text e.g. GW
this.cloze = cloze;
//The partial phrase without the cloze.
//Throws and error if the cloze doesn't appear in the text
if(text.indexOf(cloz... | true |
5f288263a3b050d6ac2a71a4c937bc6817b13a46 | JavaScript | stone-yang/algorithms-datastructures-javascript | /datastructures/array.js | UTF-8 | 5,947 | 3.921875 | 4 | [] | no_license | /**
* 数组 Array
* Notes: 数组是一种有序的线性结构,一般情况下按固定的长度储存,其中每个元素的存储空间是连续的并且类型一致,
* 故可以通过索引(即元素的偏移量)来随机访问元素。这种结构的插入、删除操作较慢,需要移动后续所有元素。
* 然而,ECMAScript中的数组与其它多数语言中的数组结构有很大区别。在ECMAScript中,数组被实现成了一种特殊的对象,
* 相对于其它语言的结构性能较低。它的长度可修改,如果修改了length属性后整个数组的长度也将相应发生改变
*/
/**
* CustomArray
* @property {Array} dataStore 储... | true |
3d0cab079d2d1f038b082755ecd118307d05ebbe | JavaScript | nmuldavin/loginApp | /src/client/store/reducers/ping/ping.js | UTF-8 | 613 | 2.53125 | 3 | [] | no_license | /**
* @module store/reducers/pingPong
* reducers for ping state
*/
import actionTypes from '../../actionTypes';
/**
* ping - Reducer controlling ping store
* @param {Object} state={ isPinging: false } - Current ping state
* @param {Object} action - Store action
* @return {Object} new ping state
*/
const ping... | true |
350acdfa64130e1c47d7b6c4d42b7c855df226d8 | JavaScript | eugeniosegala/fullstack-express-react-docker | /server/tests/filterHelper.test.js | UTF-8 | 475 | 2.53125 | 3 | [] | no_license | const filterByTerm = require('../app/helpers/filterByTerm');
describe("Filter function", () => {
test("it should filter by a search term (link)", () => {
const input = [
{ id: 1, url: "https://www.google.com/" },
{ id: 2, url: "https://www.amazon.co.uk/" },
{ id: 3, url: "https://en.wikipedia.o... | true |
c16fb4ea3ebc035a5d845e9df677f148f6a1e895 | JavaScript | sys2007/ppt.js | /ppt.js | UTF-8 | 31,035 | 2.828125 | 3 | [] | no_license | /*
* ppt.js
* v1.0
* 简易幻灯片
* 适用于IE9+、其他现代浏览器
* http://mwlmt.cc/
* 2017-04-02
*/
; (function () {
//公共方法类
function methods() { }
methods.prototype = {
//绑定事件
on: function (ele, type, fn) {
ele.addEventListener(type, fn, false);
},
//设置样式的方法
setCss: function (ele, obj) {
if (this.getType(obj) =... | true |
eb0cbfb72ff3faeafe483ea4b4bc07aa29dab9cf | JavaScript | naecoo/linkedom | /esm/dom/token-list.js | UTF-8 | 1,455 | 2.9375 | 3 | [
"ISC"
] | permissive | import {OWNER_ELEMENT} from '../shared/symbols.js';
const update = ({[OWNER_ELEMENT]: ownerElement, value}) => {
ownerElement.setAttribute('class', value);
};
/**
* @implements globalThis.DOMTokenList
*/
export class DOMTokenList extends Set {
constructor(ownerElement) {
super();
this[OWNER_ELEMENT] = ... | true |
77475d4007bb00d0e08867db706bce0cf8f6b9c1 | JavaScript | CaoXuanQuy1985/Codegym_Projects | /Module_1/Luyen_Tap_Vong_Lap_01/js/bai_tap_5.js | UTF-8 | 940 | 3.859375 | 4 | [] | no_license | let locFib, locResult, result = "";
let sum = 0;
window.init = init();
function init(){
locFib = document.getElementById("fib");
locResult = document.getElementById("result");
}
function generateFib(){
let first = 0, second = 1, newFib;
let count = 0;
let arrFib = [];
arrFib.push(first);
... | true |
114e13cd1fb380a2ec91293d699025f736d0dfbd | JavaScript | gastonpesoa/Ejercicios-Apunte-Programacion-Inicial-Js-UTN-FRA | /3-Iteraciones/Resueltos/jsResuelto-Iteraciones-4.js | UTF-8 | 578 | 4.3125 | 4 | [] | no_license | /*
4) Crear un programa que imprima los números de 0 a 100 indicando en cada uno de ellos
si el número es divisible por 3 o no.
*/
function Mostar()
{
var numero1;
var numero2;
var resto;
numero2 = 3;
for(numero1 = 0 ; numero1 <= 100 ; numero1++)
{
resto = numero1 % numero2;
console.log("numero:" + numero1)... | true |
c508fcb660f8f508e359b83c91df632fe2823d9b | JavaScript | AwesomeDevTeam/FormLogic | /src/CalendarFormField.js | UTF-8 | 2,564 | 2.796875 | 3 | [
"MIT"
] | permissive | import immutableObject from "./immutableObject";
import FormField from "./FormField";
/**
* @param {Object} p Parameters object
* @param {String} [p.label=""] Field label
* @param {String} p.name Field name
* @param {Number} [p.value=""]
* @param {Boolean} [p.required=false]
* @param {Boolean} [p.disabled=false]... | true |
4a01644ea610334b4d8a902a1f652a6770109652 | JavaScript | tsabunkar/javascript_basic_interview | /array-methods/forEach.js | UTF-8 | 1,797 | 4.75 | 5 | [] | no_license | let arrNum = [1, 2, 3, 4];
let flag = false;
arrNum.forEach((num) => {
// if (num === 2) {
if (num === 12) {
flag = true;
}
});
// You can make the flag to change its value when condition is statisifed inside
// callback fun of ForEach loop
// console.log(flag);
// !--------------------------------------... | true |
4f9243a14db980a75795b52141a4a10e57332041 | JavaScript | Kretsul-Vitaliy/goit-js-hw-06 | /js/task-01.js | UTF-8 | 291 | 3.34375 | 3 | [] | no_license | const itemsEl = document.querySelectorAll('.item');
console.log(itemsEl);
console.log(`Number of categories: ${itemsEl.length}`);
itemsEl.forEach(item => {
console.log(`Category: ${item.querySelector('h2').textContent}`);
console.log(`Elements: ${item.querySelectorAll('li').length}`);
}); | true |
09cf6db49ae271f5f677c8a5afe4bac8afaf4fc3 | JavaScript | tahdjerit/tpaw2017 | /tp5/meteo.js | UTF-8 | 2,427 | 2.96875 | 3 | [] | no_license | window.onload = function(){
document.getElementById("searchCity").addEventListener("submit", function(event){
event.preventDefault(); // pour annuler le rechargement de la page
var city = document.getElementById("city").value;
searchCity(city);
});
}
function searchCity(_city){
conso... | true |
5b5c40be30d2811ccc4cf16646eaef92937edea6 | JavaScript | meadoch1/websim | /assets/js/sim.js | UTF-8 | 1,437 | 2.53125 | 3 | [] | no_license | import * as d3 from "d3"
import {joinChannel} from "./socket.js"
export default class Sim {
constructor(socket, root, xmax, ymax) {
this.socket = socket;
const width = Math.max(700, innerWidth),
height = Math.max(500, innerHeight)
var x = d3.scaleLinear()
.domain... | true |
d1762a3eb954da8341b4fee775467f42bbf36e29 | JavaScript | regalaurence/CO2-calculator | /script.js | UTF-8 | 472 | 3.015625 | 3 | [] | no_license |
function kmAdded() {
var numberkm = document.getElementById('numberkm');
var text = numberkm.value;
var transport = document.getElementById('transport');
var transportation = transport.value;
var item = document.createElement('li');
var label = document.cre... | true |
1ae29231dab74bf2d83245a97b56c977c66bea71 | JavaScript | gurvan-d/tic-tac-toe | /public/js/client.js | UTF-8 | 5,117 | 3 | 3 | [
"MIT"
] | permissive | var socket = io.connect("localhost:8080");
var tictactoeCases = document.getElementsByClassName("case");
var player = "O";
var joueur;
document.getElementById("player").textContent = "Waiting for an other player...";
// Connect the client
socket.on('connection', clientName => {
client = clientName;
if (client... | true |
3810a74b0a2bfba56ba92575426b5d87375e6da2 | JavaScript | Sestri4kina/JS-practice-makes-perfect | /test/sum-sequence-test.js | UTF-8 | 333 | 2.609375 | 3 | [] | no_license | /**
* Created by Sestri4kina on 16.01.2017.
*/
var assert = require('assert');
var sequenceSum = require('../src/js/codewars-sum-sequence');
describe('sequenceSum', function(){
it('returns sum of the sequence', function(){
assert.equal(sequenceSum(2,2,2), 2);
assert.equal(sequenceSum(2,6,2), 12);... | true |
0940520cfc4b4e6888a036f61b73a5544681f6ce | JavaScript | nhattruongniit/learn-javascripts | /array/moveCardTrello.js | UTF-8 | 290 | 2.6875 | 3 | [] | no_license |
const lists = {
'list-1': {
id: 'list-1',
title: 'list 1',
cards: ['card-1', 'card-2', 'card-3', 'card-4'],
},
}
const swap = (sourceIndex, destinationIndex) => {
const newCards = [...list.cards];
}
const result = swap(1, 2);
console.log('swap: ', result, columns ) | true |
cb71dee84500987a73f1362a89b720105c3a3ed9 | JavaScript | rebaccazzz/mockMenu | /src/actions/menulist.js | UTF-8 | 1,008 | 2.578125 | 3 | [] | no_license | import axios from 'axios';
function requestStart(){
return {
type:'REQUEST_MENU_START'
}
}
function requestSuccess(response) {
return {
type:'REQUEST_MENU_SUCCESS',
data: response.data
}
}
function requestFail(error) {
return {
type: 'REQUEST_MENU_FAIL',
err... | true |
d48103cd6aed5ff5ed442a5d658679bbdf9da3df | JavaScript | Barneybean/Ramen | /controllers/ramenController.js | UTF-8 | 2,279 | 2.78125 | 3 | [
"MIT"
] | permissive | var express = require("express");
var router = express.Router(); //middleware
// Import the model (cat.js) to use its database functions.
var ramenModel = require("../models/ramenModel");
//
router.get("/", function(req, res) {
//ramen.selectAll takes only one argument, cb a call back function, so following func... | true |
095f0c4af7639d4ae48d2c44d7a1a3401363ff80 | JavaScript | nablarch/nablarch-toolbox | /src/main/script/jsp_verifier/test/jsp_verifier_test.js | UTF-8 | 2,263 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | "use strict";
var assert = require("assert")
, JspVerifier = require("../lib/jsp_verifier.js");
describe("JspVerifier", function() {
describe("Verifierの追加のディレクトリを指定せずに生成した JspVerifier#verify(html, path) を呼び出した場合", function() {
beforeEach(function() {
this.sut = new JspVerifier({"verifiers": {"TagUsa... | true |
1c280731b1aafdb5f1f5d95f1cb27daf0b3b8cc8 | JavaScript | hannakoivisto/continousLearningFront | /src/components/Form.jsx | UTF-8 | 4,158 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react'
import { createTopic } from '../service/apiclient'
export default class Form extends Component {
state = { title: '', description: '', timetomaster: '', timespent: '', source: '', startlearningdate: '', inprogress: true };
titleChanged = e => {
console.dir(e.tar... | true |