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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d2fe1fc558ca75ea284b7e95d459049db6aab029 | JavaScript | playsign/Chiru-WebClient | /src/Namespace.js | UTF-8 | 1,993 | 2.53125 | 3 | [] | no_license | // For conditions of distribution and use, see copyright notice in LICENSE
/**
* Container for all classes, top level functions, etc.
*
* @version 0.1
* @namespace webtundra
* @memberOf window
* @author Toni Dahl
**/
(function ( namespace, undefined ) {
// Attributes
namespace.VERSION = '1.0 beta';
... | true |
1dce3cac0ca7ffbc000421ce2b6151e9595f7ae5 | JavaScript | alairfonseca/javascript-exercises-and-challenges | /javascript functions/exercise 4/index.js | UTF-8 | 184 | 3.203125 | 3 | [] | no_license |
function ordenarTexto(id) {
let texto = document.getElementById(id).value;
texto = texto.split('').sort().join('');
document.getElementById('resultado').innerHTML = texto;
}
| true |
5520588a5f6b828fb3d63f684a20a331f261f3a3 | JavaScript | AmirAminzadeh/Web | /list.js | UTF-8 | 1,537 | 3.40625 | 3 | [
"MIT"
] | permissive | // Data for the "HTML Lists" Page
var fruits = [ "Apples","Oranges","Pears","Grapes","Pineapples","Mangos" ];
var directory = [
{type: "file", name: "file1.txt"},
{type: "file", name: "file2.txt"},
{type: "directory", name: "HTML Files", files: [{type: "file", name: "file1.html"},{type: "file", name: "fil... | true |
e48b91fc0fddad2b0cd1ef5089e96edaded5ee6f | JavaScript | osiris25/example-callbacks | /index.js | UTF-8 | 894 | 3.21875 | 3 | [] | no_license | const colors = require('colors/safe');
const coaches = [
{
id:1,
name:"Adri"
},
{
id:2,
name:"Raulingg"
},
{
id:3,
name:"Ivy"
},
{
id:4,
name:"Carlos"
}
]
const saludar = ( allCoaches, usarcallback ) =>{
allCoaches.for... | true |
683dc64089d1e639e2fd6f9e0312f272aadb3f2f | JavaScript | BGoldburd/PCS-Class | /63/messageBox.js | UTF-8 | 3,822 | 2.625 | 3 | [] | no_license | var pcs = pcs || {};
pcs.messageBox = (function () {
'use strict';
const initialXOffset = -150;
const initialYOffset = -70;
let xOffset = initialXOffset;
let yOffset = initialYOffset;
let offsetAmount = 40;
let openMessages = 0;
let nextZIndex = 10000;
const boxHeight = 140;
co... | true |
fe4df0b951c1d547f1e413dff6dbcd53a062a00e | JavaScript | joshua-hurn/tic-tac-toe | /app.js | UTF-8 | 1,361 | 3.640625 | 4 | [] | no_license | let cells = document.querySelectorAll('.cell');
let currentPlayerSymbol = 'X';
let patterns = [
[cells[0], cells[1], cells[2]],
[cells[3], cells[4], cells[5]],
[cells[6], cells[7], cells[8]],
[cells[0], cells[3], cells[6]],
[cells[1], cells[4], cells[7]],
[cells[2], cells[5], cells[8]],
[cel... | true |
cc8112a7fd122dd5b01f8e796defbce12a75adfa | JavaScript | z0san/discord-groupme-sync | /bot.js | UTF-8 | 5,093 | 2.890625 | 3 | [
"MIT"
] | permissive | //setting up dependencies
var request = require('request');
var messages = [];
var Discord = require('discord.io');
var logger = require('winston');
var auth = require('./auth.json'); //token for discord bot
//setting up constants
var channelID = "[discord channel id]";
//url for getting mostrecet messages ... | true |
38dbd7f4d66fff9b4057cd3882283271391cfb77 | JavaScript | maru-dev4905/MaruTodoList | /js/remove.js | UTF-8 | 760 | 2.921875 | 3 | [] | no_license | const deleteBtn = document.querySelector(".delete-btn");
const allDeleteBtn = document.querySelector(".allClear-btn");
deleteBtn.addEventListener("click",()=>{
let todoListItem = document.querySelectorAll(".list-item");
let id = document.querySelector(".detail-id").textContent;
for(let i = 0; i < todoList... | true |
f5ea8a3e7bfd7050a6663e98463cd337beed96a9 | JavaScript | AmatoLuca/Rembrandt-Orient | /js/toggle-menu.js | UTF-8 | 626 | 2.640625 | 3 | [] | no_license | const toggle = document.getElementsByClassName('toggle')[0];
const label = document.getElementsByClassName('toggle__label')[0];
const drop_menu = document.getElementsByClassName('overlayer-menu')[0];
const body = document.getElementsByTagName('body')[0];
toggle.addEventListener('click', function() {
drop_menu.classL... | true |
0a1ac940589e14f689442e948b5dde887fe0a33d | JavaScript | silv3rr/pzs-ng.eu | /js/htmlchart.js | UTF-8 | 3,855 | 3.0625 | 3 | [] | no_license | /*
* Create actual chart from table data using ChartJS
*/
function buildChart(chartName, chartTitle, labelTitle, labels, data, horizontal) {
Chart.defaults.set('plugins.datalabels', {
color: '#FFF' // Default color
});
var ctx = document.getElementById(chartName).getContext('2d');
return new C... | true |
409fa4b8ce8df659c7dcc7c99119c675942edde2 | JavaScript | christianl3aron/asis | /src/main/webapp/resources/js/mantenimiento/modificaAsistencia.js | UTF-8 | 2,214 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* Created by Christian Baron on 16/03/2015.
*/
$('.clockpicker').clockpicker()
.find('input').change(function () {
console.log(this.value);
});
var input = $('#single-input').clockpicker({
placement: 'bottom',
align: 'left',
autoclose: true,
'de... | true |
2662d5257656735116b289f3811d090db0ccf432 | JavaScript | HamzaBhatti125/socio-connect | /client/src/actions/chatActions.js | UTF-8 | 1,091 | 2.515625 | 3 | [] | no_license | import axios from 'axios';
import {GET_CHATS, CHAT_LOADING, SEND_MSG, GET_ERRORS, CLEAR_ERRORS} from './types';
//Get All Chats
export const getChats = () => dispatch => {
// dispatch(chatLoading());
axios.get("api/chat")
.then((res) => {
dispatch({
type: GET_CHATS,
payload: res.data
... | true |
31648b6c314f6db2a2131de97ef050849561a10a | JavaScript | mboykin3/WorkingWithData3919 | /app.js | UTF-8 | 1,242 | 3.8125 | 4 | [] | no_license | 'use strict'
let myNumber = 10;
myNumber = 10e-1;
myNumber = 0x00F;
myNumber = 0o007;
myNumber = Infinity;
let myFirstName = "Melissa";
let myLastName = "Boykin";
let myFullName = "FirstName:\t${myFirstName} \nLast name:\t${myLastName}";
let fullName = `${myFirstName} ${myLastName}`;
console.log(myFullName);
'str... | true |
e3ca5b35b201a5072f55fcc83b4f827a1e5b9ef7 | JavaScript | jamisoncozart/Functional-RPG | /src/main.js | UTF-8 | 1,117 | 2.71875 | 3 | [
"MIT"
] | permissive | import $ from 'jquery';
// import 'bootstrap';
// import 'bootstrap/dist/css/bootstrap.min.css';
// import './styles.css';
import { storeState, changeState } from './../src/rpg'
// USER LOGIC
$(document).ready(function() {
const player = storeState({level: 1, health: 100, gold: 20, potions: 2, items: ['sword of jus... | true |
d87bc6988dd026423990825bf72112cd58bf1b00 | JavaScript | antoninadert/cinedantan | /src/helpers.js | UTF-8 | 1,880 | 2.703125 | 3 | [
"MIT"
] | permissive | import {POSTERS_CDN, POSTERS_CDN_MOBILE, POSTERS_CDN_XS} from './constants'
export const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
export const isIos = /iPhone|iPad|iPod/i.test(navigator.userAgent);
export function shuffle(arra1) {
var ctr = arra1.length, temp, index;
// While there ar... | true |
12018bbb2cbb82c1535bac4e260942b1ccc88fbb | JavaScript | rod-p-v/ca2-cbwa | /models/users.js | UTF-8 | 2,266 | 2.859375 | 3 | [] | no_license | const db=require("../db")();
const COLLECTION="users";
module.exports=()=>{
const get = async(email = null) => {
console.log ('inside users model' );
if(!email){
try{
const users=await db.get(COLLECTION);
console.log(users)
return {us... | true |
84c09236c082e49f34288b5b8f092842ca4086ef | JavaScript | sixfacearu/React_Project | /src/utils/number.util.js | UTF-8 | 265 | 2.59375 | 3 | [] | no_license |
const numberUtil = {
returnIgnoredRoundedValues : (number,decimalPoints) =>{
let regex = new RegExp('^-?\\d+(?:\.\\d{0,' + (decimalPoints || -1) + '})?');
return parseFloat(number.toString().match(regex)[0]);
}
}
export default numberUtil; | true |
f611b48afb09a8bdd660ea7555d134d2a8a3460b | JavaScript | aomineDev/node-practical-platzi | /platzi-social/store/remote.js | UTF-8 | 1,223 | 2.546875 | 3 | [] | no_license | const request = require('request')
function createRemoteDb (host, port) {
const URL = `http://${host}:${port}/mysql`
function list (table) {
return req('GET', table)
}
function get (table, id) {
return req('GET', `${table}/${id}`)
}
function query (table, q, join) {
return req('GET', `query/... | true |
92e91b8cd5db1c24858ab134badd6d8c12d29668 | JavaScript | geeksourabh/InterviewQuestionSite | /InterviewSite/Scripts/registration.js | UTF-8 | 2,868 | 2.546875 | 3 | [] | no_license | /// <reference path="jquery-1.10.2.js" />
var strongPasswordRegex = new RegExp('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})');
var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
do... | true |
494ed1d80656563b0289cb67590d31be5803853f | JavaScript | ksuboch/learn_js_ru | /031_datetime.js | UTF-8 | 4,315 | 4.15625 | 4 | [] | no_license | // создайте объект Date для даты 20 февраля 2012 года, 3 часа 12 минут
var date1 = new Date(2012, 1, 20, 3, 12);
console.log(date1);
// создайте функцию getWeekDay(date), которая выводит текущий день недели
// в коротком формате "пн", "вт", ... "вс"
function getWeekDay(date) {
var names = ["вс", "пн", "вт", "ср", "... | true |
4d9f01627c7c0a5004450268536ed7dbf6202bad | JavaScript | vinayak519/javascript-basic-workshop | /prototypes.js | UTF-8 | 823 | 4.78125 | 5 | [] | no_license | // Initialize a constructor function for a new Hero
//The this keyword will refer to the new instance that is created,
//so setting this.name to the name parameter ensures the new object
// will have a name property set.
function Workshop(name, level) {
this.name = name;
this.level = level;
}
let workshop1 = new... | true |
99b994fd0627486535885a48d52b00ba3408130a | JavaScript | SwapBlocks/paper-wallet | /third-party/lato-font/bin/rename.js | UTF-8 | 1,205 | 2.59375 | 3 | [
"OFL-1.1",
"MIT"
] | permissive | var path = require('path');
var fs = require('fs');
var file = require('file');
var _ = require('underscore');
var changeCase = require('change-case');
var filterExtensions = ['.eot', '.ttf', '.woff'];
var map = {
'lato-regular' : 'lato-normal',
'lato-italic' : 'lato-normal-italic'
};
var fontsPath = path.resolv... | true |
61ec1327e5232f5473e4b0b0e01d3ea46200ac2c | JavaScript | vframbach/project-00 | /main.js | UTF-8 | 3,657 | 3.421875 | 3 | [] | no_license | //player positions as they move around board
//written as percentages so size of board can be changed and game will still work
var player1Positions = [
{left: "50%", top: "0%"},
{left: "70%", top: "0%"},
{left: "90%", top: "0%"},
{left: "92%", top: "10%"},
{left: "92%", top: "30%"},
{left: "92%", top: "50%"},
{... | true |
59a7e312875483de57c684e03deb9fbccc954cbf | JavaScript | ampieschke/NoteTaker | /routes/apiRoutes.js | UTF-8 | 911 | 2.859375 | 3 | [] | no_license | const noteData = require("../db/db.json");
const fs = require("fs");
const path = require("path");
const DB_PATH = path.join(__dirname + "/../db/db.json");
module.exports = (app) => {
app.get("/api/notes", (req, res) => res.json(noteData));
app.post("/api/notes", (req, res) => {
console.log(req.body);
// ... | true |
488edfa7a0d0672e556d528dc0ee44922b945d00 | JavaScript | ox-it/sakai | /gradebook/app/ui/src/webapp/js/gradebook.js | UTF-8 | 24,349 | 2.828125 | 3 | [
"LicenseRef-scancode-generic-cla",
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | function clearIfDefaultString(formField, defaultString) {
if(formField.value === defaultString) {
formField.value = "";
}
}
// We sometimes want to have a default submit button that's not
// the first one in the form.
//
// USAGE:
//
// <h:inputText id="Score" value="#{scoreRow.score}"
// onkeypress="return ... | true |
de3335696e963e2fb0d6caf50f566208e5dd593e | JavaScript | satyam147/Learn_Js | /Day 7/main.js | UTF-8 | 2,567 | 4.5 | 4 | [] | no_license | // Advanced Array (Maps and Methods)
// Map list of iterable objects
let employee1 = {
name: 'Name1',
position: 'Position1',
salary: 10000,
}
let employee2 = {
name: "Name2",
position: "Position2",
salary: 20000
}
let employee3 = {
name: "Name3",
position: "Position3",
salary: 3... | true |
448ab4c9bdb6de5350739626a9f22f0b3b478824 | JavaScript | tatkuptcova/mesto | /src/components/Section.js | UTF-8 | 466 | 2.9375 | 3 | [] | no_license | export default class Section {
constructor({items, renderer}, elementsList) {
this._items = items;
this._renderer = renderer;
this._elementsList = elementsList;
}
rendererItems() {
this._items.forEach((item) => {
this._renderer(item);
});
}
add... | true |
23831e1f0693ab5f3ba30749200b3f0e481e9508 | JavaScript | ShaiGilboa/wksp-module-2-js-8-oop | /workshop/2-Books/exercise-2.4.js | UTF-8 | 4,791 | 3.671875 | 4 | [] | no_license | // From 2.3
// Copy over all of the code from 2.3...
class Book {
constructor(title, genre, author, read, startReadDate, endReadDate) {
this.title = title || '';
this.genre = genre || '';
this.author = author || '';
this.read = read || '';
if (read === 'yes') {
this.... | true |
cfb7e07eb0cc76e3fee52b97299efff3c1c283fa | JavaScript | learn-co-students/ember-objects-nyc-web-111819 | /tests/unit/lib/programmer-test.js | UTF-8 | 4,064 | 3.09375 | 3 | [] | no_license | /* jshint expr:true */
import { expect } from 'chai';
import { describe, it, beforeEach} from 'mocha';
import Programmer from 'ember-objects/lib/programmer';
import Conference from 'ember-objects/lib/conference';
describe("Programmer", function(){
var matz;
beforeEach(function(){
Conference.create();
matz ... | true |
a4f3e008b4b69b18e866e230431b6cf819f08604 | JavaScript | dastan1503/FPK | /build/js/script.js | UTF-8 | 1,260 | 2.796875 | 3 | [] | no_license | 'use strict';
(function () {
var formScreens = document.querySelectorAll('.form > div');
var buttonsNext = document.querySelectorAll('.button-next');
var buttonsPrev = document.querySelectorAll('.button-prev');
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototy... | true |
d4687e0b7efcd7c3fa0a624c9234c951556e8c15 | JavaScript | xiexuanzheng123/JavaScript | /src/js/generator/concept.js | UTF-8 | 411 | 4 | 4 | [] | no_license | // var x = 1;
// function *foo() {
// x++;
// yield;
// //console.log("x: " + x);
// }
// function bar() {
// x++;
// }
// var it = foo();
// it.next();
// console.log("x1: ", x);
// bar();
// it.next();
// console.log("x2: ", x);
/**
* 我们只是创建了一个迭代器对象
*/
function *foo(x, y) {
return x * y;
}
va... | true |
c0d70211d2557d03fc92948d317fa934e0c01fda | JavaScript | cpsloal/prototype_filesopensave_react | /app/components/FileOpen.js | UTF-8 | 2,480 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
const {dialog} = require('electron').remote
const fs = require('fs')
export default class FileOpen extends Component {
constructor (props) {
super(props)
this.state = { fileName: "This is where file content will be shown", fil... | true |
50704cd7e76b25977f01cbb0a2650f62866f9c09 | JavaScript | BocharovAleksandr/Yii2-Short-Link-Generator | /web/js/main.js | UTF-8 | 1,971 | 2.890625 | 3 | [] | permissive | $(function(){
// Нажатие на кнопку "Сгенерировать"
$('#js-send-form-button').click(function() {
var url = $('#js-url-field').val();
var urlRegExp = new RegExp('(?:(?:ht|f)tps?://)?(?:[\\-\\w]+:[\\-\\w]+@)?(?:[0-9a-z][\\-0-9a-z]*[0-9a-z]\\.)+[a-z]{2,6}(?::\\d{1,5})?(?:[?/\\\\#][?!^$.(){}:|=[\\]+... | true |
dc49d4a7a7310c7c57f4d32998b1214908aab1f8 | JavaScript | Hussein-dev-prog/Movie-DB | /index.js | UTF-8 | 2,491 | 3.046875 | 3 | [] | no_license | const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`OK`)
})
app.get('/test', (req, res) => {
res.send({ status: 200, message: "ok" })
});
app.get('/time', (req, res) => {
const date = ... | true |
716370082d19cb280d071b5ec6be5f85d5bf7806 | JavaScript | packoradoslaw/packoradoslaw.github.io | /fb.js | UTF-8 | 2,340 | 2.546875 | 3 | [] | no_license | window.fbAsyncInit = function() {
FB.init({
appId : '421424038643764',
cookie : true,
xfbml : true,
version : 'v3.2'
});
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
(function(d, s, id){
var js, fjs = d.getElement... | true |
a9a5f0248df6a2669f674a08d6e63f66e6f21647 | JavaScript | JoelYoy/javascrip-avanzado | /14-fetch.js | UTF-8 | 343 | 3.328125 | 3 | [] | no_license | /* Fetch nos permite hacer peteciones http desde javascrip */
/* Accedemos a un recurso de un servidor */
/* Json = Javascrip objecy Notatuon */
const peticion = fetch ('https://jsonplaceholder.typicode.com/todos/1')
.then(resp => resp.json()).then(data => {
console.log(data);
}).catch(e => {
console.log(e);
});
... | true |
3f68ac8f73d2de22470bca62fac4619c2457133d | JavaScript | algorithms-club/algorithms-normatov | /test/stack-spec.js | UTF-8 | 2,154 | 3.0625 | 3 | [] | no_license | 'use strict';
const algolib = require('../index.js');
var assert = require('assert');
describe('Stack', function () {
describe('#data structure', function () {
it('#should create proper data structure', function () {
let stack = new algolib.stack();
stack.insert.should.be.instanc... | true |
baeed1d7794d119c6e9a5cd787f11e1125aacad5 | JavaScript | emanulz/interdev-frontend | /apps/admin/cashAdvances/actions.js | UTF-8 | 1,030 | 2.546875 | 3 | [] | no_license | // ------------------------------------------------------------------------------------------
// MODULE IMPORTS
// ------------------------------------------------------------------------------------------
import alertify from 'alertifyjs'
export function checkClientProduct(client_prod){
let Ok = true
return Ok
}
... | true |
4acb758722ea49f74b36ea54b542ddcdc2cf7f1c | JavaScript | AlexandreCourtin/AlexWebJS | /THREEcube/utils.js | UTF-8 | 268 | 2.953125 | 3 | [] | no_license | function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
function rule3(v, vmin, vmax, tmin, tmax) {
var nv = Math.max(Math.min(v,vmax), vmin);
var dv = vmax-vmin;
var pc = (nv-vmin)/dv;
var dt = tmax-tmin;
var tv = tmin + (pc*dt);
return tv;
}
| true |
6bda35d006f61ba6a7c29d7dfc30c9aa41f0e9b7 | JavaScript | Aguardientico/learnyounode-solutions | /juggling_async.js | UTF-8 | 691 | 3.296875 | 3 | [
"MIT"
] | permissive | var http = require('http');
var results = new Array();
var complete = 0;
var getData = function(url) {
results.push(new Array());
var index = results.length - 1;
http.get(url, function(response) {
response.setEncoding('utf-8');
response.on("data", function(data) {
results[index].push(data);
})... | true |
395695f1d10dfb21854f24d71a94f3a1134c1697 | JavaScript | Effixes/gare_au_covid | /app/javascript/controllers/shuffle_controller.js | UTF-8 | 2,023 | 2.53125 | 3 | [] | no_license | import ApplicationController from './application_controller';
import { gsap } from "gsap";
export default class extends ApplicationController {
static values = {
cardCount: Number,
playersCount: Number
}
static targets = ['deck', 'avatar']
connect () {
this.shuffleCards();
}
... | true |
28bc23126d4f782c262b957b621acebbb38a5c42 | JavaScript | priyaastha/TheBestCatPage | /script.js | UTF-8 | 479 | 2.578125 | 3 | [
"MIT"
] | permissive | var app = new Vue({
el: '#app',
data: {
cats: {},
printableCats: {},
},
methods: {
getCats: async function () {
let data = await fetch('./cats.json');
this.cats = await data.json();
},
printCats: function () {
this.printableCats = Object.entries(this.cats).map(
([key, value]) => {
return... | true |
84af7d1c7706bd213510eefce1a10b8c0678d79f | JavaScript | chenjing1552/node.js | /01nodejs 基础/下午/06 fs.stat_1.js | UTF-8 | 218 | 2.765625 | 3 | [] | no_license | const fs = require('fs')
fs.stat('input.txt', (error, stats) =>{
if(error){
console.log(error)
} else {
console.log(`文件:${stats.isFile()}`)
console.log(`目录:${stats.isDirectory()}`)
}
}) | true |
976fa47f0614f0f9a41a4d655f47bcdd4baaf796 | JavaScript | Abhinav-Mani/Delivery-System-Backend | /Controllers/User.js | UTF-8 | 2,130 | 2.5625 | 3 | [] | no_license | const bcryptjs=require("bcryptjs");
const jwt=require("jsonwebtoken");
const secret= process.env.ACCESS_TOKEN_SECRET
let salRounds=Number(process.env.SALT_ROUND);
const pool= require("../util/database");
const { json } = require("body-parser");
module.exports.SIGNUP=(req,res)=>{
const username = req.body.usernam... | true |
f76ce0afe410c70a0fa53cceff1ba2999b828e17 | JavaScript | virresh/jsToDoApp | /scripts/script1.js | UTF-8 | 808 | 2.796875 | 3 | [] | no_license | new Vue({
el: '#events',
data: {
event: {
title : '', description : ''
},
events: []
},
ready: function() {
this.fetchEvents();
},
methods: {
fetchEvents: function() {
var events = [];
this.$set('events',events);
},
addEvent: function() {
if(this.event.title){
t... | true |
fba08c53cfb0813543c7f454e8124d204dbb2056 | JavaScript | jtfl2008/learnNote | /js/框架/vue/源码/mvvm/Compile.js | UTF-8 | 1,772 | 2.921875 | 3 | [] | no_license | class Compile {
constructor(el, vm) {
this.el = this.isElementNode(el) ? el : doucment.querySelector(el)
this.vm = vm
// 如果传入的根元素存在,才开始编译
if (this.el) {
// 1、把真实的Dom创建到内存中
let fragment = this.node2framgment(this.el)
// 2、讲模板中的指令中的变量和{{}}中的变量替换成真实的数据
this.compile(fragment)
... | true |
1f1672124e71fd2b6a4cd80251f517a0a0c3a3af | JavaScript | shiguera/visiotrack | /js/visiotrack.js | UTF-8 | 798 | 2.796875 | 3 | [] | no_license | /**
* visiotrack.js
* 13/04/2011
*/
/**
* Inicialización de variables
*/
window.onload = init;
idmanga = 1001;
parseurl();
var map = null;
var marcas = null;
function init() {
// Ajustar tamaños de pantalla
dibujapantalla();
// Dibujar mapa
dibujamapa();
// Dibuja marcas
dibujamarcas();
// Activ... | true |
9e74e2a682d5052fdd262eb63a0be0a04cc3c372 | JavaScript | sirisha-battula-au2/attainu-falcon1 | /assignments/week-21/Day-04-CC/index.js | UTF-8 | 747 | 3.90625 | 4 | [] | no_license | //Product of integers
var multiply = function(num1, num2) {
var result = 0;
// if any of the nums is 0, automatically it is zero
if (num1[0] === '0' || num2[0] === '0') {
return '0'
};
var length1 = num1.length - 1;
var length2 = num2.length - 1;
var counterI = 0;
var iBase10 =... | true |
538dd28e9322e34fcf5f65e6afcf7e3670669ea1 | JavaScript | pietekeann/car-filter-app | /src/components/sections/MainSection.js | UTF-8 | 1,869 | 2.515625 | 3 | [] | no_license | import React, { Fragment } from "react";
import classes from "./MainSection.module.css";
import DropDown from "../ui/DropDown";
import ContinuousSlider from "../ui/ContinuousSlider";
import CarSection from "./CarSection";
function MainSection(props) {
const [type, setType] = React.useState("Car");
const [year, set... | true |
8ec11f7375f6357e549b76964e724111946abdf8 | JavaScript | AndrewMasalski/helper | /server.js | UTF-8 | 1,624 | 2.765625 | 3 | [] | no_license | let express = require('express');
let app = express();
var cors = require('cors');
let fs = require('fs');
let db = fs.readFileSync('db.json');
let obj = JSON.parse(db);
let bodyParser = require('body-parser');
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(e... | true |
ced71717b2f7164c3e065d070470562cac8ea5ab | JavaScript | chaiguolong/javaweb_step1 | /javascriptlsCookbook/chapter7/js/recipe73_001.js | UTF-8 | 1,064 | 3.21875 | 3 | [
"LicenseRef-scancode-oreilly-notice"
] | permissive | function listenEvent(eventObj,event,eventHandler){
if(eventObj.addEventListener){
eventObj.addEventListener(event,eventHandler,false);
}else if(eventObj.attachEvent){
event = "on" + event;
eventObj.attachEvent(event,eventHandler);
}else{
eventObj["on" + event] = eventHandler;
}
}
function stopListening(eve... | true |
812668667765ff9f8847ad685cd2204bcf2d8e02 | JavaScript | MubeenHassan-OSO/assignment | /assignment_03/code/main.js | UTF-8 | 3,504 | 3.671875 | 4 | [] | no_license | class Tool {
constructor(strength, type) {
this.strength = strength;
this.type = type;
}
setStrength(strength) {
this.strength = strength;
}
}
class Rock extends Tool {
constructor(strength) {
super(strength, "r");
}
getType() {
return this.type;
... | true |
e4b18b4bcd6d3e68c491b9dfcd576badd016140c | JavaScript | learn-academy-2020-echo/lecture-notes | /react/react-state/src/components/Counter.js | UTF-8 | 866 | 3.109375 | 3 | [] | no_license | import React, { Component } from 'react'
class Counter extends Component{
constructor(props){
super(props)
this.state = {
count: 0,
banana: "banana"
}
}
addOne = () => {
// alert("Yo!")
this.setState({ count: this.state.count + 1 })
}
removeOne = () => {
if(this.state.co... | true |
6b85503873248744b881595226356e3ab98292b0 | JavaScript | teyweikiet/portfolio | /version/2/main.js | UTF-8 | 1,118 | 2.84375 | 3 | [] | no_license | // let scrollY = 0,
let body = document.querySelector("body");
// scrollable = document.querySelector('#scrollable'),
// isAnimating = false;
// isWheeling = False,
// frame = document.getElementById("frame");
// toggleMenu = (btn) => {document.querySelector('header').classList.toggle('change');}
tog... | true |
39f5ebae316cabaa9854a578dcee93c826c0c2af | JavaScript | EEMO22/react-practice | /cra/src/components/ReactState.jsx | UTF-8 | 1,621 | 3.390625 | 3 | [] | no_license | import { Component } from "react";
class ReactState extends Component {
constructor(props) {
super(props);
// state 선언
this.state = {
stateString: this.props.reactString,
stateNumber: 0
}
}
stateChange = (flag) => {
// direct, setSt... | true |
5228d7b2c72fc4960388baf9f1162dfe61eae7e8 | JavaScript | KaMalisauskas/Spiderpreme_API | /src/Modules/Index/indexService.js | UTF-8 | 1,490 | 2.5625 | 3 | [] | no_license | import RequestModel from './RequestModel'
import UserModel from '../Auth/UserModel'
class MainService {
findReqByUser(username) {
return RequestModel.find({username})
}
userExists(id) {
return UserModel.findOne({_id: id})
}
addRequest({username, url, keyword, email}) {
re... | true |
b9a6cfb5d02243e501cab0456844468b4766437d | JavaScript | EmanuelaMocci/js-snack-es6 | /snack-2/js/script.js | UTF-8 | 1,479 | 3.765625 | 4 | [] | no_license | // Creare un array di oggetti di squadre di calcio. Ogni squadra avrà diverse proprietà: nome, punti fatti, falli subiti.
// Nome sarà l’unica proprietà da compilare, le altre saranno tutte settate a 0.
const squadre = [
{
'nome': 'Inter',
'punti': 0,
'falli': 0
},
{
'nome... | true |
acec936025791e6f986d1f860fe38e39c732e674 | JavaScript | voxxtelum/jestbeta | /commands/roil.js | UTF-8 | 948 | 2.65625 | 3 | [] | no_license | const suvmj = require('../config/sudoers.json');
// Let's get some random number shit
const Random = require('random-js').Random;
const random = new Random();
exports.run = async (client, message, args) => {
if (suvmj.includes(message.author.id)) {
const messageAuthor = `<@${message.author.id}>`;
message.cha... | true |
893acd07655dfb711a1fc38d9a0b7f2cf186d261 | JavaScript | RachelShalom/color-game | /colorGame.js | UTF-8 | 3,225 | 3.59375 | 4 | [] | no_license | var squares = document.querySelectorAll(".square");
//this is the color that should be guessed
var guessingColor = document.querySelector("#pickedcolor");
var pickedColor = pickColor(squares.length);
var message = document.querySelector("#message");
var head = document.querySelector("h1");
var newcolorsButtons = docume... | true |
bd5aab66e83ffcf8df10a82e8e51ad3ab2c59fb5 | JavaScript | solo800/d3test | /sm_line/example.js | UTF-8 | 7,045 | 2.921875 | 3 | [] | no_license | /*
* The before setting a radial be sure to update the url which you will access your
* data from in the d3.json() function
*
* Additionally you will probably want to update the main container div which is
* currently set to access an element with id #graph-area
*/
(function() {
$(document).ready(function() {
... | true |
be29838458d0dc71c09e860a136d81c14bdcf4c1 | JavaScript | sythas/weather | /hooks/useForecast.js | UTF-8 | 1,138 | 2.75 | 3 | [
"MIT"
] | permissive | import { useState, useEffect } from "react";
const useForecast = (position) => {
const [forecast, setForecast] = useState(null);
const [error, setError] = useState(null);
useEffect(() => {
if (!position) return;
const fetchForecast = async () => {
const { latitude, longitude } = position;
... | true |
c8dd3f931ebd68ccbc1598d1ff9fb5c36d8107d6 | JavaScript | inblack67/Vanilla-JavaScript | /Symbols/index.js | UTF-8 | 931 | 4.15625 | 4 | [] | no_license | // primitve datatype -> can never be the same -> unique object keys (eg. object properties)
const sym1 = Symbol(1); // no 'new' as it does not have any ctor (primitive)
const sym2 = Symbol(1);
console.log(sym1);
console.log(sym2);
console.log(sym1 === sym2); // false, even with same identifiers
// console.log(`Symbol... | true |
00445791fbe1f99ecccde700056adc7c2003a6bf | JavaScript | stausholm/website | /src/resources/js/toasts.js | UTF-8 | 1,421 | 2.890625 | 3 | [] | no_license | export default function Toasts() {
this.toastsContainer = undefined
const init = () => {
if (document.body.classList.contains('toasties')) {
this.toastsContainer = document.querySelector('.toasts')
} else {
document.body.classList.add('toasties')
const toastsContainer = document.createEle... | true |
4b040064ce89c05a2976714f87b1279e1745b9e2 | JavaScript | lisahowdin/Read-Excel-file-and-display-in-HTML | /js/script.js | UTF-8 | 3,716 | 2.625 | 3 | [] | no_license | function handleFile(e) {
//Get the files from Upload control
var files = e.target.files;
var i, f;
var card_header_footer_color = $("#card_header_footer_color").val();
var card_profile_site_color = $("#card_profile_site_color").val();
var session_header = $("#session_header").val();
var mont... | true |
8ac10c9b827b1978669133510db2c41ed73dada6 | JavaScript | xiongyi1994/js_learning | /whetherANum.js | UTF-8 | 252 | 3.28125 | 3 | [] | no_license | function justNum(argument) {
if (typeof argument != "number" || argument > 20 || argument < 3) {
argument = 10
}
return argument
}
function main() {
argument = 2
argument = justNum(argument)
//console.log(argument)
console.log('.')
}
main() | true |
011e846c9cdbe7070dc79e5c55bca477a98c4c22 | JavaScript | training4developers/backbone_11172016 | /exercises/sync/www/js/data.js | UTF-8 | 732 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | var Widget = Backbone.Model.extend({
defaults: {
name: "Widget",
color: "black",
size: "small",
description: 'A small, black widget',
quantity: 10
}
});
var Widgets = Backbone.Collection.extend({
model: Widget
});
var widgets = new Widgets();
widgets.add(new Widget({
id: ... | true |
cfc3c73fe3aa21cd255f87d73958b0f6e6196b0b | JavaScript | Kolak8/lolmIndex | /js/common.js | UTF-8 | 4,428 | 3.046875 | 3 | [] | no_license | function $(selectorName){
return document.querySelector(selectorName);
}
function $$(selectorName){
return document.querySelectorAll(selectorName);
}
function width(){
return document.documentElement.clientWidth;
}
/* 轮播图通用函数 */
//获取轮播图DOM节点
function createCarousel(carousel_Id, carouselDatas){
... | true |
0c0ec668cf6360dd52c099852f193b8792ef3cd9 | JavaScript | manish-dalal/redux_curd_operation | /src/redux/reducer/items.js | UTF-8 | 2,078 | 2.625 | 3 | [] | no_license | import ActionTypes from '../constants/ActionTypes'
import findIndex from 'lodash/findIndex'
const initialState = {
items: [],
itemsApiInProgress: false,
totalItemCount: 1,
filters: {
search: '',
limit: 20,
skip: 0
}
}
const setItemsLocalStorage = items => {
localStorage.setItem('items', JSON.s... | true |
fe92bf421e8e00120cb2d19c442a32d000734229 | JavaScript | allenjwelch/beer-scraper | /server.js | UTF-8 | 2,468 | 2.578125 | 3 | [] | no_license | // Dependencies
const mongojs = require("mongojs");
// Require request and cheerio. This makes the scraping possible
const request = require("request");
const cheerio = require("cheerio");
// Database configuration
const databaseUrl = "scraper";
const collections = ["scrapedBeer"];
// Hook mongojs configuration to t... | true |
77aa9a1722cc6d7e0b7c3ea8f6ef715614aa64d7 | JavaScript | Ciro1690/Asteroids | /src/asteroid.js | UTF-8 | 585 | 2.765625 | 3 | [] | no_license | const Util = require("./util");
const MovingObject = require("./moving_object");
const DEFAULTS = {
COLOR: "#505050",
RADIUS: 25,
SPEED: 4
};
function Asteroid(options) {
options = options || {};
options.color = DEFAULTS.COLOR;
options.pos = options.pos;
options.radius = DEFAULTS.RADIUS;
... | true |
bec88fff56bd32a0d0fd0964db0a58a93316f5ba | JavaScript | Miguelus373/Restaurant-Page | /src/menu_load.js | UTF-8 | 574 | 2.75 | 3 | [
"MIT"
] | permissive | const menuLoad = (content, cakes) => {
content.innerHTML = `
<div class='menu-page'>
<h1 class='menu-head'>Pick your favorite Cake!</h1>
<div class="cakes-container">
</div>
</div>
`;
const container = document.querySelector('div.cakes-container');
cakes.forEach(item => {
const cake = docu... | true |
5e026d5d4f4d5f372df71b71452e6281e4776ab2 | JavaScript | jpmbvistro/codewars | /katas/kyu8/6-9-2021-0.js | UTF-8 | 300 | 2.65625 | 3 | [] | no_license | /*******************************************************
=======================Codewars=========================
Return Negative
https://www.codewars.com/kata/55685cd7ad70877c23000102
********************************************************/
function makeNegative(num) {
return Math.abs(num)*-1
}
| true |
408e00ec1d24ee7c41172b722a9686831e47278e | JavaScript | helentiaan/helen.github.io | /app.js | UTF-8 | 787 | 2.609375 | 3 | [] | no_license | const navSlide=()=>{
const burger = document.querySelector('.burger');
const nav = document.querySelector('.nav-links');
const navLinks = document.querySelectorAll('.nav-links li');
burger.addEventListener('click',()=>{
nav.classList.toggle('nav-active');
navLinks.forEach((link, index) ... | true |
c39493277456bf54f414c6516c9c663a1df08a06 | JavaScript | DevExpress/testcafe | /test/functional/fixtures/api/es-next/selector/testcafe-fixtures/selector-test.js | UTF-8 | 38,405 | 2.765625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // NOTE: to preserve callsites, add new tests AFTER the existing ones
import { Selector, ClientFunction } from 'testcafe';
fixture `Selector`
.page `http://localhost:3000/fixtures/api/es-next/selector/pages/index.html`;
const getElementById = Selector(id => document.getElementById(id));
test('HTMLElement snapsho... | true |
76eff0c989f0894dadd6818612b7501ce4bbb0a6 | JavaScript | ScottContini/Smiley-Game | /smiley.js | UTF-8 | 6,920 | 2.90625 | 3 | [] | no_license |
var smiley_screen_params = {
smiley_size : 100, // needs to agree with width/height from css file
num_smilies: 8,
level: 1
}
smiley_screen_params.live_smilies = smiley_screen_params.num_smilies;
var smiley = {
top_position : 0,
left_position : 0,
jump_speed : 2,
h_direction : 1,
v_direction : 1,
i... | true |
dcbba992150228f11a8611ac1851befba8177998 | JavaScript | andrewkihs/soundboard | /frontend/components/user_auth/signup_form.jsx | UTF-8 | 8,590 | 2.578125 | 3 | [] | no_license | import React from 'react';
import { closeModal } from '../../actions/modal_actions';
class SignUpForm extends React.Component {
constructor(props) {
super(props);
this.state = {
formNum: 0,
username: '',
password: '',
age: '',
gender: '',
displayName: '',
email: '',
... | true |
0d88f29ddb18f09af7623ee6312a3f444b3f9ffc | JavaScript | JannesMeyer/rac0r | /track_editor/js/vector.js | UTF-8 | 2,104 | 3.53125 | 4 | [] | no_license | var Vector = function(x, y) {
this.x = x;
this.y = y;
};
Vector.prototype.add = function(vec) {
return new Vector(this.x + vec.x, this.y + vec.y);
};
Vector.prototype.sub = function(vec) {
return new Vector(this.x - vec.x, this.y - vec.y);
};
Vector.prototype.skalar = function(vec) {
return this.x*vec.x + this.... | true |
032d22283a5174c1285a3c0ed97d7caa59d473cf | JavaScript | WiFindUs/wfu-website | /js/blog-theatre.js | UTF-8 | 10,990 | 2.9375 | 3 | [] | no_license | window.addEventListener('load', getImages);
window.addEventListener('load', getTheatre);
window.addEventListener('resize', $.debounce(250, resizeImages));
//$(window).resize( $.debounce(250, resizeImages) );
var thumbnails=[];
var images = [];
var imageContainers = [];
var theatre;
var prev;
var next... | true |
b979533ee998b99136878af760dc61a42786934e | JavaScript | quasikyo/canvas_collection | /typer/models/Drawer.js | UTF-8 | 1,872 | 4.03125 | 4 | [
"MIT"
] | permissive | /**
* Class that handles drawing onto a canvas.
*/
export class Drawer {
/**
* Constructs a new Drawer object.
* @param {HTMLCanvasElement} canvas the canvas object to draw on
*/
constructor(canvas) {
this._canvas = canvas;
this._context = canvas.getContext('2d');
} // cons... | true |
5d0125badbdd1e127f912d09949bf04168e7d0f6 | JavaScript | myhELO/assessment | /js/component/header.js | UTF-8 | 404 | 2.65625 | 3 | [] | no_license | /**
* Application header.
*/
component.header = function() {
component.apply(this, arguments);
};
assessment.extend(component.header, component);
/**
* Draw the header.
*
* @param {HTMLDivElement} parent
*/
component.header.prototype.decorate = function(parent) {
const heading = document.createElement('h1');... | true |
511af931cb7f97fae64a44c003855f048bd23153 | JavaScript | yoan-durand/Projet-PLIC-EasyTab | /src/public/js/Chord.js | UTF-8 | 265 | 2.8125 | 3 | [] | no_license | /* Class Chord
** Représente une note ou un accord,
** contient la liste des notes à jouer
*/
function Chord(list, strumming)
{
this._note_list = list; // List<Note>
this._strumming = strumming; // String ==> Direction du strumming Up/Down
} | true |
bb3ea9324c8ea1ccd4ad09aaf46b57ded2b00d5d | JavaScript | ianvo/mobile-quest | /server.js | UTF-8 | 2,225 | 2.6875 | 3 | [
"MIT"
] | permissive | var express = require('express');
var app = express();
var port = process.env.PORT || 8080;
var server = app.listen(port, function(){
console.log('Our app is running on http://localhost:' + port);
});
var io = require('socket.io')(server);
app.get('/', function(req, res){
res.sendfile('public/game.html');
});
//... | true |
8169147a1ff32b8f0e080794595882ea2da92000 | JavaScript | Chop-Bot/chop-tools | /src/structures/Command.js | UTF-8 | 5,084 | 2.5625 | 3 | [] | no_license | const Joi = require('@hapi/joi');
const merge = require('lodash.merge');
// TODO: Get rid of this nasty validation
const commandSchema = Joi.object()
.keys({
name: Joi.string()
.regex(/^[a-zA-Z0-9_-]+$/, 'name')
.min(1),
description: Joi.string()
.required()
.min(1),
u... | true |
3b012144d750324ee3c5745e53114599fbce13a6 | JavaScript | HackinwaleDev/LearnersDashboard | /graphics.js | UTF-8 | 31,830 | 3.1875 | 3 | [] | no_license | /**
* PROJECT TITLE:: LEARNERS ANALYTICS DASHBOARD
* DEVELOPER:: AKINWALE ADETOLA <hackinwale.developer@gmail.com>
* DATE:: MARCH 21, 2019
*
* ___________
* DESCRIPTION
* ___________
* THIS FILE HAS ALL THE CODE FOR THE WHOLE 12 CHARTS ON THE LEARNERS DASHBOARD IN ORDER.
*
*/
//Call Learner Dashboard here... | true |
50988f06317f4d890094181b53e668b0d16f07da | JavaScript | xiaomuxue/JS-of--study2 | /7月19号(平稳退化)/表格斑马线风格/stripeTables.js | UTF-8 | 992 | 2.921875 | 3 | [] | no_license | // JavaScript Document
/*这种方案相比直接用 css中的伪类的对比:
css中的伪类: xx:hover{} 这种用法不是每一种浏览器都支持。
我们现有的方案使用的是JS的DOM编程来实现的。 但这样做的缺点是:用行为层(即js代码)做了“表现层”(即css功能)的事,不是一种理想的工作方式。
更进一步的方案是使用 className来进行指定*/
function stripeTables(){
if( !yc.isCompatible()){return false;}
var tables=document.getElementsByTagName("table... | true |
9b58379897847b403c8d95969619aab174805f01 | JavaScript | Mpilo-Pillz/MpiloJavaScript | /ConceptPractice/restAndSpread/mixRestAndSpread.js | UTF-8 | 486 | 3.453125 | 3 | [] | no_license | // function unshift(array, a, b, c, d, e) {
// return [a, b, c, d, e].concat(array);
// }
// function unshift(...array) {
// return [...array];
// }
function unshift(...array) {
return [...array];
}
console.log(unshift(3,2,1));
const unshift = (array, ...items) => [...items, ...array]
... | true |
5c8686faf5a2c092ef0ed0cdb3f639098c6b7394 | JavaScript | wxqdoit/reche | /src/core/Event.js | UTF-8 | 1,585 | 2.859375 | 3 | [
"MIT"
] | permissive | export default class Event {
constructor (){
this.event = {};
this.xhrEvent = [
'onloadstart',
'onprogress',
'onabort',
'ontimeout',
'onerror',
'onload',
'onloadend',
'onreadystatechange'
];
... | true |
443d45c5a2777ae1cd4a5e05605650df18cc8fba | JavaScript | ann-amin/AminAnn_IMD3901_A3_Web | /app.js | UTF-8 | 2,291 | 2.796875 | 3 | [] | no_license | const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const socketIO = require('socket.io')(server); //hello I am new
const LISTEN_PORT = 8080; //make sure greater than 3000. Some ports are reserved/blocked by firewall ...
app.... | true |
4fbb213b0091a3d71503bdfe6ad9e0db86244dbb | JavaScript | cyh756085049/LeetCode | /hot100/heap/P295_MedianFinder.js | UTF-8 | 4,114 | 3.84375 | 4 | [
"MIT"
] | permissive | var MedianFinder = function() {
this.min_heap = new MinHeap();
this.max_heap = new BigHeap();
};
/**
* @param {number} num
* @return {void}
*/
MedianFinder.prototype.addNum = function(num) {
if (this.min_heap.heap.length === this.max_heap.heap.length) {
if (num > this.max_heap.heap[0]) {
... | true |
c42a95469ce19bbcc97ef851ef2d8c02eae32a49 | JavaScript | joproulx/Jaat | /Scripts/element/segment/LineSegment.js | UTF-8 | 1,906 | 2.515625 | 3 | [] | no_license | define([
'libs/ctor/ctor',
'element/segment/Segment',
'element/renderer/LineSegmentRenderer',
'common/Point'],
function (Ctor, Segment, LineSegmentRenderer, Point) {
var LineSegment = Ctor(Segment, function (_super) {
this.init = function () {
};
this.crea... | true |
d329840935d8d5e6884334ac9ed9fd37799fe86d | JavaScript | webpanjin/vue-router-study | /src/myVueRouter/history/hash.js | UTF-8 | 645 | 2.640625 | 3 | [] | no_license | import History from "./base";
export default class HashHistory extends History{
constructor(router){
super(router)
//确保首次访问地址为#/
ensureSlash()
}
//获取当前路由地址
getCurrentLocation(){
return window.location.hash.slice(1)
}
//监听hashchange 监听路由地址的变化
setUpListener(){
window.addEventListener('ha... | true |
472b445ade81051adec380c17acde510d53cfc23 | JavaScript | J-C-L-G/ES6 | /let/typeof_tdz.js | UTF-8 | 277 | 2.546875 | 3 | [] | no_license | /**
* Created by JCLG on 3/14/2016.
*/
'use strict';
{
// 'a' is not declared
if(typeof a === "undefined"){
console.log("cool");
}
// 'b' is not declared, but it is in TDZ
if(typeof b === "undefined"){ // Reference Error.
}
let b;
}
| true |
e198de685a14c3b32b988d118dea4c2f297e7f32 | JavaScript | nachoiacovino/itunes-top-100 | /src/redux/albums/albumsReducer.js | UTF-8 | 1,400 | 2.546875 | 3 | [] | no_license | import { ADD_ALBUM_TO_FAVORITES, GET_ALBUMS_FAIL, GET_ALBUMS_SUCCESS, REMOVE_ALBUM_FROM_FAVORITES } from './albumsTypes';
export const initialState = {
albums: [],
favorites: [],
loading: true,
error: null,
};
const albums = (state = initialState, { type, payload }) => {
switch (type) {
case GET_ALBUMS_... | true |
b8aeb4b041373f5f5c3d9964fafa31a8a2d29348 | JavaScript | inmahernandez/acme-supermarket-demo | /test/templateTest.js | UTF-8 | 1,336 | 2.8125 | 3 | [] | no_license | //TODO: Name test files the same as the component that they are testing,
//with the suffix .spec
var chai = require('chai');
var should = chai.should();
describe('templateTest', function() {
before('Before hook', function() {
// runs before all tests in this block
console.log('Do this before all test suites');
... | true |
18c7f81e3c4660a5a566307e956990b6f02a5217 | JavaScript | Fatemeh-Pakpour/hyf-homework | /javascript/javascript1/week2/weatherwear.js | UTF-8 | 579 | 3.21875 | 3 | [] | no_license | /*
*** Homework second Week / Hack Your Future, Javascript1,
* Author: Fatemeh Pakpour
* Weather wear
*/
function clothesToWear (temperature) {
if(temperature < 0) {
return "Wear a warm jacket, proper bootes and gloves."
}else if(temperature > 35) {
return "Stay home and be nak... | true |
0375ad8c3a46ec79c2fa21f5aef6b5c3deb4899e | JavaScript | sandratourjman/bloc-chat-react | /src/components/MessageList.js | UTF-8 | 2,653 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import './MessageList.css';
class MessageList extends Component {
constructor(props) {
super(props);
this.state = {
messages: [],
username: '',
content: '',
sentAt: '',
roomId: ''
};
this.messageRef = this.props.firebase.database().ref('messages');
}
... | true |
0967fb9497355768c0cffe2ea8523cb53a2f0343 | JavaScript | DuCalixte/udacity-projects | /vagrant/catalog/app/static/js/services/load_data-service.js | UTF-8 | 1,250 | 2.625 | 3 | [] | no_license | 'use strict';
define([], function() {
return ['$http', '$q', function($http, $q) {
var service = {}
service.loadCategories = function() {
var request = $http({
method: 'get',
url: 'http://localhost:8000/category/json',
params: {
... | true |
2712aad9c42082071bf60fbec9a797c53806213f | JavaScript | Algo-King/AlgoKing | /routes/api/challenges.js | UTF-8 | 1,820 | 2.890625 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const config = require("config");
// getting our user model
const Challenge = require("../../models/Challenge");
// create post request to add a challenge
router.post("/", async (req, res) => {
console.log("we are here");
const {
name,
p... | true |
a8f953a7abe31478cd9a3d3c0cec46024743611f | JavaScript | rlama7/OASIS | /Oasis/mysql/getRandomInt.js | UTF-8 | 544 | 3.546875 | 4 | [
"MIT"
] | permissive | /**
* getRandomInt.js - A program to generate a random number between min and max
* @author Ratna Lama
* @author
* @author
* @date 4/11/2019
*
* @description Generates an int random number between min and max range
*
* @param {*} min minimum number
*... | true |
9d5364adad55a7c545507b358ed9588c9061d72e | JavaScript | sam-in95/web | /modetour/script.js | UTF-8 | 394 | 2.75 | 3 | [] | no_license | const topBtn = document.querySelector('.top_btn');
window.addEventListener('scroll', function () {
let docuTop = document.documentElement.scrollTop;
console.log(docuTop);
if (docuTop > 300) {
topBtn.style.display = 'block';
} else {
topBtn.style.display = 'none';
}
});
function goTop() {
document... | true |