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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
99e392c5160a2fffac3fad51ffa1e346673c72df | JavaScript | Quadrified/All-Code-Training | /JavaScript/Brad Tutorial (Es6)/bradTutorial.js | UTF-8 | 5,054 | 4.0625 | 4 | [] | no_license | //Traversy media
// Strings
const s = "Hello world"
console.log(s.length);
console.log(s.toUpperCase());
console.log(s.substring(0, 5));
console.log(s.substring(0, 5).toLowerCase());
console.log(s.split(""));
console.log(s.split(', '));
console.log(s+ ' Omer');
const list = 'Omer, Quadri, Mohammed';
console... | true |
ded99cecadd385d076cbb7fd9444dab2c7b73e68 | JavaScript | nirajno1/System-code-adminstrator | /SystemCodeAdmin/WebContent/js/utils.js | UTF-8 | 885 | 2.984375 | 3 | [] | no_license | function getXMLObject() //XML OBJECT
{
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); // For Old Microsoft Browsers
}
catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); // For Microsoft IE 6.0+
}
catch (e2) {
xmlHttp = false ; ... | true |
a4dd8f2c934f49c7605f8ed83b5cdefb7ff69561 | JavaScript | tsucchyy/tsucchyy.github.io | /src/App.js | UTF-8 | 884 | 2.640625 | 3 | [] | no_license | import React from 'react';
//import logo from './logo.svg';
//import './App.css';
function App() {
return (
<div className="text-center">
<Clock />
</div>
)
}
class Clock extends React.Component {
constructor(props) {
super(props);
let now = new Date();
this.state = {
time: `${n... | true |
ca89121c0d25e1826ca73afc4ba6057280d00c77 | JavaScript | maugares/W2-homework | /src/transform.js | UTF-8 | 1,201 | 3.0625 | 3 | [] | no_license | groupAdultsByAgeRange = (adultInfo) => {
if (adultInfo.length < 1) {
return {};
}
const groups = adultInfo.reduce(adult => {
if (adult.age < 18) {
return {};
} else {
const from18to20 = adultInfo.filter((adult) => adult.age >= 18 && adult.age <= 20);
const from21to30 = adultInfo.fil... | true |
468dabc3363db03648444afe019544459f7f0f24 | JavaScript | marcosfsch/quality-assurance | /pscheduler-crawler/bin/jsonltools.js | UTF-8 | 465 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
const _ = require('underscore');
var arrayToJsonLines = function ( arr ) {
var out = "";
if ( typeof arr == "undefined" ) {
return out;
} else {
if ( !_.isArray( arr ) ) {
arr = [arr];
}
arr.forEach( function( row ) {
if ( typeof row == "undefi... | true |
a8f281beed13e82dff26be94737a854d8876debe | JavaScript | ajevann/string-metrics | /src/url-check.js | UTF-8 | 890 | 2.6875 | 3 | [] | no_license | /**
* (http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?
* ([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?
*/
const diff = require('../utils/array-difference')
/**
* /\b([^\s]+@[^\s]+)\b/g
*/
function run(sourced, current) {
let regex;
regex = /\b(www.|... | true |
baedf0bb0a719ec20a177ee4f93d49cbfeddc3dc | JavaScript | Inna-KLB/recipes | /src/assets/js/modules/createRecipePage.js | UTF-8 | 5,320 | 2.78125 | 3 | [] | no_license | import scrollToUp from "./scroolToUp";
import showModal from "./showModal";
import changeRecipe from "./changeRecipe";
// Создание страницы рецепта
const createRecipePage = (link, recipe, container, id) => {
const oldContainer = document.querySelector(container),
header = document.querySelector('#header');
... | true |
723ce50aa655634928eb37e3f59262fb5c496332 | JavaScript | mariamv29/HTML-generator | /src/generate-site.js | UTF-8 | 536 | 2.59375 | 3 | [] | no_license | const fs = require("fs");
// TODO: Create a function to write README file
const writeToFile = (fileName, teamArray) => {
return fs.writeFileSync("./dist/index.html", teamArray, (err) => {
// if there's an error, reject the Promise and send the error to the Promise's
if (err) {
return err;
... | true |
6820b80e14870be2bc19335d65177aa79a20987a | JavaScript | mazetuski/04_Practica_Frontend_Avanzado | /src/components/loading/loading-component.js | UTF-8 | 263 | 2.609375 | 3 | [] | no_license | import loadingImg from 'assets/loading.png';
export const createLoading = () => {
const loading = document.createElement('div');
loading.classList.add('loading-wrapper');
loading.innerHTML = `<img src="${loadingImg}" alt="Cargando">`;
return loading;
};
| true |
f887a212cd2a5c8f5994af387f79c860e06b058b | JavaScript | lgferreyra/CursoIngresoJS | /8-TPs/jsAdivinaElNumero1.js | UTF-8 | 1,226 | 3.828125 | 4 | [] | no_license | /*Al comenzar el juego generamos un número
secreto del 1 al 100, en la pantalla del juego
dispondremos de un cuadro de texto para ingresar
un número y un botón “Verificar”, si el número
ingresado es el mismo que el número secreto se dará
por terminado el juego con un mensaje similar a este:
“Usted es un gana... | true |
d17ca81d8685579dc210bdd07ee197f55dc0af76 | JavaScript | n3ville/117198-code-and-magick | /js/stat.js | UTF-8 | 3,237 | 3.203125 | 3 | [] | no_license | 'use strict';
var CLOUD_HEIGHT = 270;
var CLOUD_X = 100;
var CLOUD_Y = 10;
var GAP = 10;
var LEFT_GAP = 145;
var BAR_HEIGHT = 150;
var DISTANCE = 50;
var BAR_WIDTH = 40;
/**
* Показываем облако
* @param {Object} ctx - Объект холста, на котором рисуем
* @param {number} x - начальная координата по оси x
* @param {nu... | true |
80d972f24536ed28b3770be71d1b1dba393d7493 | JavaScript | DeathMelody/NodeJS | /Test/Context.js | UTF-8 | 218 | 2.640625 | 3 | [] | no_license | var pet = {
words:'...',
sperk:function(sperk){
console.log(sperk+''+this.words);
console.log(this === pet)
}
}
var dog = {
words:'wang'
}
// pet.sperk.call(dog,'sperk')
pet.sperk('xi'); | true |
5d6a06df95c6bc7eda4842e59f53c00c4e1c8832 | JavaScript | Turnermb/cheeses-api-frontend | /src/components/Main.js | UTF-8 | 1,650 | 2.640625 | 3 | [] | no_license | import {useEffect, useState} from 'react'
import {Route, Switch} from 'react-router-dom'
import Index from '../pages/Index'
import Show from '../pages/Show'
function Main(props){
const [cheeses, setCheeses] = useState(null)
const URL = "https://cheeses-api-backendmt.herokuapp.com/cheeses/"
const getCheeses = as... | true |
30a6c446487d00a366ac5f580b6f0dc389ba246d | JavaScript | qwop/userscript | /monolith/101/87671.user.js | UTF-8 | 2,485 | 2.546875 | 3 | [] | no_license | // ==UserScript==
// @name anti marketgid on any site [crossbrowser]
// @namespace http://userscripts.org/scripts/show/87671
// @version 1.1.1
// @history 1.1.1 Добавлена опция запрета/разрешения автоапдейтера.
// @history 1.1 Добавлен автоапдейтер для Firefox
// @history 1.0 Финальный кроссбраузе... | true |
f6c02b06849880adb9e515e724dc4735404436c4 | JavaScript | kenmori/chromeExtensions | /ex2/myscript.js | UTF-8 | 437 | 3.203125 | 3 | [] | no_license | function changeColor (color){
//第1引数: null 現在のタブに対して、
//第3引数: callback これが終わったら実行される関数
chrome.tabs.executeScript(null, {
"code" : "document.body.style.backgroundColor='"+ color +"'"
})
}
document.getElementById('red').onclick= function(){
changeColor('red');
}
document.getElementById('yell... | true |
8366680beeb895cf08b6711817aa6fe6511278ca | JavaScript | gitkamrul/javascript-practice | /08.type-conversion.js | UTF-8 | 463 | 4.6875 | 5 | [] | no_license |
// String Conversion
let value = true;
alert(typeof value); // boolean
value = String(value); // now value is a string "true"
alert(typeof value); // string
// Numeric Conversion
let str = "123";
alert(typeof str); // string
let num = Number(str); // becomes a number 123
alert(typeof num); // number
// Boole... | true |
d172bd8226863d7f36f655281ab05c50c3f01a7f | JavaScript | SquidwardTentacles/noteBook | /video/buffer/buffer.js | UTF-8 | 1,830 | 3.640625 | 4 | [] | no_license | // 创建一个buffer实例 new buffer不推荐使用 静态方法
// let buf = new Buffer(5)
// let buf = Buffer.alloc(5);
// let buf = Buffer.from('buffer', 'utf8');
// console.log(buf);
// 静态方法 是否支持某种编码
// console.log(Buffer.isEncoding('utf8'));
// console.log(Buffer.isEncoding('gbk'));
// 判断是否是buffer对象
// let buf = Buffer.from('hello');
// cons... | true |
18f573ad417539908b71a1666e73770c34f20e3b | JavaScript | flexwilly/BmiCalc | /test.js | UTF-8 | 1,256 | 3.46875 | 3 | [] | no_license | let height = document.getElementById("height");
let weight = document.getElementById("weight");
let bminum = document.getElementById("bmi-num");
let reset = document.getElementById("reset");
const username = document.getElementById("username");
//button
const calculate = document.getElementById("calculate");
let bmi... | true |
44d3457fce6d75d11b3f50a7ef0001debf3e7a55 | JavaScript | trungvt/HTML5-BattleShip | /BattleShips/js/SpaceShip.js | UTF-8 | 908 | 2.640625 | 3 | [] | no_license | enchant();
var SpaceShip = Class.create(Sprite, {
initialize: function() {
Sprite.apply(this, [56, 150]);
this.image = Game.instance.assets['res/images/rocket.png'];
this.animationDuration = 0;
this.addEventListener(Event.ENTER_FRAME, this.update);
this.addEventListener(Event.TOUCH_MOVE, this.updateTouch);
... | true |
0e11b5843c7a944b52a87cb3ed2c943fcfb4cd51 | JavaScript | JustinZhao000/personal-resume | /personal/project/zhe800/js/index.js | UTF-8 | 4,336 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* Created by Administrator on 2016/8/7.
*/
//鼠标移入移出事件
$('#toolbar .drop').hover(function(){
$('#toolbar .drop .dropmenu').fadeIn();
$('#toolbar .drop>a').addClass('active');
},function(){
$('#toolbar .drop .dropmenu').fadeOut();
$('#toolbar .drop>a').removeClass('active');
});
//主导航的点击事件
$('.main_... | true |
1ad388032ae310a9de1c4205ec91ab457afe7693 | JavaScript | igorgoroshit/ember-l10n | /lib/utils/file-exists.js | UTF-8 | 208 | 2.5625 | 3 | [
"MIT"
] | permissive | /* jshint node:true */
'use strict';
let fs = require('fs');
module.exports = function fileExists(file) {
try {
fs.accessSync(file, fs.F_OK);
} catch (e) {
return false;
}
return true;
};
| true |
7d6d93dc278bcebd871f8f427f88f737c27e3dca | JavaScript | suraj491/pizzashop | /routes/userRoute.js | UTF-8 | 1,542 | 2.546875 | 3 | [] | no_license | const express=require("express");
const { findByIdAndDelete } = require("../models/userModel");
const router=express.Router();
const User=require("../models/userModel")
router.post("/register",async(req,res)=>{
const {name,email,password}=req.body
const newUser=new User({name,email,password})
try {
newU... | true |
8f53969c0a51c46d8cea2f6bc1bd3ab3542c2409 | JavaScript | heshan0131/deck.gl | /src/lib/utils/count.js | UTF-8 | 1,955 | 3.65625 | 4 | [
"MIT"
] | permissive | const ERR_NOT_OBJECT = 'count(): argument not an object';
const ERR_NOT_CONTAINER = 'count(): argument not a container';
/**
* Deduces numer of elements in a JavaScript container.
* - Auto-deduction for ES6 containers that define a count() method
* - Auto-deduction for ES6 containers that define a size member
* - ... | true |
bbd01ee1b79837dfe96b84d9ac93e41baaf24a9e | JavaScript | gxlzlihao/ClassManagement | /app/assets/javascripts/index/index_everyday_grade.js | UTF-8 | 7,352 | 2.515625 | 3 | [] | no_license | $(document).ready(function(){
$('button#btnClearUserData').click(function(){
$.ajax({
type: 'POST',
url: '/index/clear_user_data' ,
complete: function( obj ){
console.log( obj );
var _answer = ob... | true |
d015f4227ec253ce8d31248e79d427dfc54539c7 | JavaScript | tipsysquid/ThirdWheel | /app/controllers/account.js | UTF-8 | 8,693 | 2.515625 | 3 | [] | no_license | const crypto = require('crypto');
var Q = require('q');
var mongoose = require('mongoose');
var Account = mongoose.model('Account');
const server_token = '662fc8d3-1067-46e2-a28d-c52900e76078';
/**
* Accepts an email and password field.
* The email address must be unique.
* @param {*} req
* @param {*} res
* @pa... | true |
e34fdd52d8bc3732ac9ddad5a2bb4da5a81b1386 | JavaScript | Azurekuz/ThePress | /ui_viewers.js | UTF-8 | 1,726 | 2.625 | 3 | [
"MIT"
] | permissive | class ui_viewers{
constructor(context, xLoc, yLoc, initView = 0){
this.game = context;
this.xLoc = xLoc;
this.yLoc = yLoc;
this.curViewers = initView;
this.targetViewers = this.curViewers;
this.rngRange = [1, 3];
this.phaserText = null;
... | true |
fb103aad868496d0939ff25e188e018fd44f988f | JavaScript | ibreeze2017/vox-cli | /lib/utils/util.js | UTF-8 | 926 | 2.953125 | 3 | [
"MIT"
] | permissive | function flatObject(obj) {
if (!obj || typeof obj !== "object") {
return {};
}
Object.keys(obj).map(key => {
const item = obj[key];
if (typeof item === "object") {
obj[key] = JSON.stringify(item);
}
});
return obj;
}
function setConfig(obj, key, value) {
let keyPath = key.split(".");
... | true |
28be0d2db4de17d729bd5b8cf06e4a1d42997505 | JavaScript | dolphius21/Learn-JavaScript | /37_Using_Promises/03_Weather_description.js | UTF-8 | 852 | 3.953125 | 4 | [] | no_license | const getWeatherDescription = (city) => {
return new Promise((resolve, reject) => {
if (!city || typeof city !== 'string') {
reject('City must be a string');
}
if (!['amsterdam', 'tokyo'].includes(city.toLowerCase())) {
reject('City must be Amsterdam or Tokyo');
}
// simulate network r... | true |
b2fb55c5b04c0da281b639a35ca5f6b6dc2d21fa | JavaScript | barinovalexey/keksobooking | /js/data.js | UTF-8 | 2,509 | 2.765625 | 3 | [] | no_license | 'use strict';
(function () {
var PIN_WIDTH = 50;
var PIN_HEIGHT = 70;
var MAP_WIDTH = 1200;
var MAP_HEIGHT = 704;
var avatarNumbers = ['01', '02', '03', '04', '05', '06', '07', '08'];
var types = ['palace', 'flat', 'house', 'bungalo'];
var times = ['12:00', '13:00', '14:00'];
var features = ['wifi', 'd... | true |
900a48ee93344eb905bba7c1e80874d6953b3641 | JavaScript | trishymay/exercises | /LeetCode/copyListWithRandomPointer.js | UTF-8 | 1,046 | 3.296875 | 3 | [] | no_license | function RandomListNode(label) {
this.label = label;
this.next = this.random = null;
}
var copyRandomList = function(head) {
if (!head) return head;
var current = head;
var ind = 0;
var pointers = [];
while (current) {
current.index = ind++;
pointers.push(new RandomListNode(current.label));
c... | true |
a8541617a4eceeec5ce8d075838534b9332d2f6e | JavaScript | KhrystynaKurylas/forecast | /assets/js/jsDaily/weatherServiceDaily.js | UTF-8 | 1,985 | 2.96875 | 3 | [] | no_license | function getWeatherDataDaily(lang, fnOK, fnError) {
navigator.geolocation.getCurrentPosition(locSuccessDaily, locErrorDaily);
function locSuccessDaily(position) {
// Check cache
var cacheDaily = localStorage.weatherCacheDaily && JSON.parse(localStorage.weatherCacheDaily);
var currDateDa... | true |
0152b72e89cf4db7fc53aff5ad434633872413f3 | JavaScript | jeffhoelter/testing-workshop | /api/demo/integration/__tests__/users.js | UTF-8 | 1,203 | 2.71875 | 3 | [
"MIT"
] | permissive | import axios from 'axios'
import startServer from '../start-server'
let server
beforeAll(() => {
return startServer().then(s => {
server = s
})
})
afterAll(done => {
server.close(done)
})
test('can get users', () => {
return axios.get('http://localhost:3001/api/users').then(response => {
//console.l... | true |
1e27927eb9ff12eeb8e7bca9c2289b2bc377ba30 | JavaScript | zaimeali/Saylani-Web-Assignment-4 | /chapter-solve/chapters12-13/ch12q6.js | UTF-8 | 154 | 3.234375 | 3 | [] | no_license | var greeting;
var hour = 13;
if (hour < 18) {
greeting = "Good day";
}
else{
greeting = "Good evening";
}
alert(greeting);
alert("Error Fixed");
| true |
46f73563e0120cb6eb9878ce6e58658b40dd48af | JavaScript | luyulong/vjform | /package/features/provider/events.js | UTF-8 | 1,527 | 2.578125 | 3 | [
"MIT"
] | permissive | import feature from "../../feature";
const resolveHandlers = (origin = {}, events) => {
return Object.keys(events).reduce((pre, key) => {
const current = pre[key] || function() {};
pre[key] = function() {
const pro = new Promise(resolve => {
resolve.apply(null, arguments);
});
even... | true |
19930c774512104b84fdb8bce345e13b12cd301f | JavaScript | Apthox/World-Scope | /public/javascript/leaderboard.js | UTF-8 | 552 | 2.78125 | 3 | [] | no_license | $(document).ready(function() {
function load_leaderboard() {
console.log("Loading Leaderboard!");
for (var i = 0; i < leaderboard.length; i++) {
console.log(leaderboard[i]);
$("#pos-list").append("<li class='list-group-item'>" + (i + 1) + "</li>");
$("#name-list"... | true |
2b1c079da63e182d392a0067b770857174f933df | JavaScript | david-diep/student-grade-table | /components/grade-table.js | UTF-8 | 1,921 | 3.203125 | 3 | [] | no_license | class GradeTable{
constructor(tableElement, noGradesElement){
this.tableElement = tableElement;
this.noGradesElement = noGradesElement;
}
updateGrades(grades){
if(grades.length===0){
if (this.noGradesElement.classList.contains("d-none")) this.noGradesElement.classList.remove("d-none")
} el... | true |
8e8d42715e0e76ff3b9ab7f886bb5ec504146a7a | JavaScript | tanish2k09/musicbender-discord | /helpers/effects.js | UTF-8 | 4,001 | 2.703125 | 3 | [] | no_license | /* This file is responsible for handling the effects map
* and that includes reading, writing, updating and removing any effects.
*
* NOTE: Only admins must be able to use CRUD operations on the effects map.
*/
const fs = require('fs');
const ytdl = require('ytdl-core');
const vid_cache = "./vid_cache/";
const jso... | true |
84512c7db12115e972d63279431da170ec122d08 | JavaScript | m4dlogos/poc.sealreport | /Repository/Views/Scripts/Chart.ext.js | UTF-8 | 3,587 | 2.75 | 3 | [] | no_license | // Création d'un nouveau modèle qui hérite du modèle doughnut
(function(){
Chart.defaults.doughnutWithText = Chart.defaults.doughnut;
Chart.controllers.doughnutWithText = Chart.controllers.doughnut.extend({
// Draw the representation of the dataset
draw: function(ease) {
Chart.controllers.doughnut.prototype... | true |
b43bbb027759c08d8027a7a091a1e3554ddc63e8 | JavaScript | majkel89/exercises-training | /src/datatypes/prototypes.spec.js | UTF-8 | 1,302 | 3.859375 | 4 | [] | no_license | describe('Prototypes', () => {
describe('constructors', () => {
// define your answers to make tests pass
it('can be used to produce objects', () => {
function Person(first, last, age){
this.first = first;
this.last = last;
if (age){
this.age = age;
}
}
Person.prototype.age = 18;
... | true |
d6d9bfdda694cfa24471b76d44c3cf50c2a505ed | JavaScript | zhongz132/Rifeel-LOaF | /src/data/Utils/Game.js | UTF-8 | 1,721 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Game.js by zhongz132@gmail.com
*
* Base declaration and data of game element in the game
*/
import Immutable from "immutable";
import LocationData from "./../Locations/LocationData.js";
import CharacterData from "./../Characters/CharacterData.js";
import SkillData from "./../Skills/SkillData.js"
import Playe... | true |
64fcae3e14de0385e725444faecbf0deaf22af2f | JavaScript | abiaqiou/leetcode-javascript | /tests/hash_table/0001_two_sum.test.js | UTF-8 | 418 | 2.625 | 3 | [
"MIT"
] | permissive | const twoSum = require('../../problems/hash_table/0001_two_sum')
test('0001 twoSum test 01', () => {
const result = twoSum([2, 7, 11, 15], 9)
expect(result).toStrictEqual([0, 1])
})
test('0001 twoSum test 02', () => {
const result = twoSum([3, 2, 4], 6)
expect(result).toStrictEqual([1, 2])
})
test('0001 twoS... | true |
96da680e387ad8545faf091d4f5f414b0d2fe615 | JavaScript | nurav1997/Country_Code_API | /routes/routes.js | UTF-8 | 702 | 2.609375 | 3 | [] | no_license | var express = require('express');
const { response } = require('..');
var router = express.Router();
var getCountry = require('../services/getCountry');
//regex to check only for numbers
var reg = new RegExp('^[0-9]+$');
//post router searh
router.route('/search').post(async (req, res) => {
if (reg.test(req.body... | true |
46188bdafb80ea03301fcb78ba9e4da6e2433032 | JavaScript | kardish515/track-suggester | /js/scripts.js | UTF-8 | 843 | 2.734375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$("#formOne").submit(function(event) {
var question1 = parseInt($("#question1").val());
var question2 = parseInt($("#question2").val());
var question3 = parseInt($("#question3").val());
var question4 = parseInt($("#question4").val());
var question5 = parseInt($("#que... | true |
6eec092eefed7effba9c1503da91ec0b94b5bac6 | JavaScript | xiatian12345/GenerativeCodeDesign | /P_2_1_2_03/main.js | UTF-8 | 1,417 | 2.8125 | 3 | [
"MIT"
] | permissive | let winWH = 600;
let canvas = null;
let oneSize = 30;
let gridCount = Math.ceil(winWH / oneSize) + 1;
let randPos = [];
let colors = [];
let alpha = 200;
function setup() {
canvas = createCanvas(winWH, winWH);
mousePressed();
rectMode(CENTER);
noFill();
strokeWeight(4);
}
function draw() {
background(255);
fo... | true |
27a2eb8e5ebfd8875fd6bccfe5c625e5b6fd37e4 | JavaScript | rjrajshinde/Basics-of-ReactJS | /src/components/List/NameList.js | UTF-8 | 776 | 3 | 3 | [] | no_license | import React from "react";
function NameList() {
const names = ["king", "joker", "yoyo"];
const nameList = names.map((name) => <h2>{name}</h2>);
const persons = [
{ id: 1, name: "raj", age: 12 },
{ id: 2, name: "om", age: 22 },
{ id: 3, name: "yo", age: 14 },
];
const personList = persons.map((p... | true |
f43b8b06c202a195ee4054824757c17c38fa5c65 | JavaScript | Kabooley/todoMVC_VanillaJS | /script/Controller.js | UTF-8 | 10,165 | 2.828125 | 3 | [] | no_license | (function (window) {
var Controller = function (view, model) {
var self = this;
this.model = model;
this.view = view;
self.view.bindEventListener(
namespace.ADD_NEW_TODO,
self.addNewTodo.bind(self)
);
self.view.bindEventListener(
namespace.TOGGLE_ALL_CLICKED,
self.tog... | true |
312e0c69341111c9c43d1f1007a23514b9c8a3fd | JavaScript | convergent-health-app-team/health_web_app | /src/components/FoodCardGroup.js | UTF-8 | 2,412 | 2.625 | 3 | [] | no_license | import React, { Component } from "react";
import FoodCard from "./FoodCard";
import { Card } from "semantic-ui-react";
export default class FoodCardGroup extends Component {
state = {
cardsToDisplay: [1, 2, 3, 4],
foods: [
{
id: 1,
name: "Hawaiian BBQ Chicken",
decription: "Main... | true |
7aaf47f03c48c4926f5936098aaa214f886eb66f | JavaScript | vikzh/todo-app | /frontend/src/App.js | UTF-8 | 634 | 2.515625 | 3 | [] | no_license | import logo from './logo.svg';
import './App.css';
import React, {useState, useEffect} from 'react';
import axios from "axios";
function App() {
const [list, setList] = useState([]);
const getTodos = () => {
axios
.get('http://127.0.0.1:8000/api/')
.then(res => {
setList(res.data);
... | true |
7ef3be122473ed8a4a72effbe8d0ef50b8e3ccc4 | JavaScript | IlyaTrat/sorter | /src/index.js | UTF-8 | 1,087 | 3.234375 | 3 | [] | no_license | class Sorter {
constructor() {
this.info = [];
this.compFunct = (a, b) => a - b;
}
add(element) {
this.info.push(element);
}
at(index) {
return this.info[index];
}
get length() {
return this.info.length;
}
toArray() {
return this.info;
}
/* sort(indices) {
indices.... | true |
2cd2926098f101508bf704af04d2e425b66f20f3 | JavaScript | jerrybarolo/CoderByte | /Medium/PrimeMover.js | UTF-8 | 453 | 3.703125 | 4 | [] | no_license | function isPrime(num)
{
var prime = num != 1;
for(var i = 2; i < num; i++)
{
if(num%i == 0)
{
prime = false;
break;
}
}
return prime;
}
function PrimeMover(num)
{
if(num == 1) return 2;
var contaPrimi = 1;
var i = 3;
var result = 0;
while(contaPrimi < ... | true |
002932b0fca7425a013974937fc680cbe1f2c471 | JavaScript | FlyingCetacean/2020-2021-2_CS239 | /作业7/Project/static/js/PieChartPlot.js | UTF-8 | 10,662 | 2.578125 | 3 | [] | no_license |
function plot_pie_chart(table, i, data_legend, tp) {
// 删除旧的SVG,若无svg,selectAll()方法会创建一个空选择集并返回
if (!d3.select("body").selectAll("svg").filter('.myPieChartSVG').empty()) {
d3.select("body").selectAll("svg").filter('.myPieChartSVG').remove();
// console.log("Remove pie chart...");
}
v... | true |
6e4359db9f096f162bfb36344de9c3cde22c2aac | JavaScript | hjofford/Tic-Tac-Toe | /ttt.js | UTF-8 | 11,413 | 3.09375 | 3 | [
"MIT"
] | permissive | // Set variables
const xClass = 'x'
const oClass = 'o'
const computerClass = 'o'
const winCombo = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
]
const winDiagDoublePts = [
[0, 4, 8],
[2, 4, 6]
]
const cellEl = document.querySelectorAll('[data-cell]')
// const cell = document.q... | true |
4d1d0e80bb4f74a8ec23b1024c292fd18b25c080 | JavaScript | MnkdMs/curso_web | /JAVASCRIPT/02_OOP/25_asincronia.js | UTF-8 | 515 | 3.34375 | 3 | [] | no_license | /**
* ASINCRONIA
*
* Proceso que consumen tiempo:
* - bloqueante
* - no bloqueabte
*
* Bucle con una Cola de eventos
*
*/
// proceso bloqueante de 1 seg
// siguiente proceso
// proceso no bloqueante de 1 seg
// siguientes procesos
setTimeout( () => console.log('Mensaje 1'), 0)
consol... | true |
44e77125feeb224dbd8a0c4d4667938eeeb732f0 | JavaScript | seanohue/pinwheel | /src/Util/RandomUtil.js | UTF-8 | 2,323 | 3.3125 | 3 | [
"MIT"
] | permissive | 'use strict';
const { Random } = require('rando-js');
const Broadcast = require('../Broadcast');
/**
* A wrapper around rando-js
* See {@link https://github.com/seanohue/rando} for documentation.
*/
class RandomUtil extends Random {
/**
* Check to see if a given percent chance occurs
* @param {number} perc... | true |
e7ac781839325fd9c047fa43fa8be90d728e3087 | JavaScript | StrikerBow/DAM-1 | /Ejercicio 4/script.js | UTF-8 | 1,667 | 3.328125 | 3 | [] | no_license | alert("Este script sirve para saber que letra se le asocia a su DNI");
let dni;
let arrayLetras=["T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E"];
const blankSpaces = /\s/;
let posicion;
//do while para que se ejecute una vez minimamente.
do{
dni = window.prompt("Typee s... | true |
061b8f87bdbd3060cc194a57b58c4f70b2a7b540 | JavaScript | hisptz/scorecard-app | /packages/app/src/modules/Main/Components/ScoreCardManagement/Components/DataConfiguration/Components/DataGroups/Components/DataGroup/utils.js | UTF-8 | 639 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | export function getChunkChildIndex(chunkSize = 2, chunkIndex, childIndex) {
return chunkSize * chunkIndex + childIndex;
}
export function customChunk(list = []) {
const chunks = [];
const listToModify = [...list];
const i = 0;
while (listToModify.length > 0) {
if (listToModify[i]?.dataSources > 1) {
... | true |
b9cea92ebaa294c32d1f58018a2223f00eb59621 | JavaScript | sahiljain2497/Wiki-Search-App | /myscript.js | UTF-8 | 1,081 | 2.78125 | 3 | [
"MIT"
] | permissive | function addInput(){
$(".main").html("<input type='text' id='search' name='search' autofocus>");
}
$(".main").keypress(function(e) {
if(e.which == 13) {
$(".result").empty();
searchwiki();
//alert('You pressed enter!');
}
});
function searchwiki(){
var title=docum... | true |
a24faf56165cbd9657fa8d30c757983320cd1705 | JavaScript | superman285/Web-frontend_Notes | /JS进阶全栈/课堂笔记/面向对象-设计模式/课件/装饰者2/js/DecoratorDrag.js | UTF-8 | 771 | 2.734375 | 3 | [] | no_license | class DecoratorDrag {
constructor(obj) {
this.obj = obj;
this.obj.elements.header.onmousedown = e => {
let x = e.clientX - this.obj.elements.container.offsetLeft;
let y = e.clientY - this.obj.elements.container.offsetTop;
document.onmousemove = e => {
... | true |
3156dc81749b2ac87701c95f50d57af5f46081d8 | JavaScript | iac-nyc/FSJS | /basics/divFor.js | UTF-8 | 1,448 | 2.6875 | 3 | [] | no_license | var html = '';
for(var i=1;i<=10;i++){
html += "<div>" + i + "</div>" + "<br>";
}
document.write(html);
/*
//CSS
@import url('http://necolas.github.io/normalize.css/3.0.2/normalize.css');
body {
background: #fff;
max-width: 980px;
margin: 50px auto;
padding: 0 20px;
font: Helvetica Neue, Helvectica... | true |
eacb44e58a5c0e07f4ced3d9cfa50686900a81d4 | JavaScript | FelixGonzalo/TramiteDocumentarioEPISI_Frontend | /src/redux/archivoDucks.js | UTF-8 | 5,449 | 2.578125 | 3 | [] | no_license | import alert from '../helpers/alertas'
import valida from '../helpers/validaciones'
const dataInicial = {
array : []
}
const GET_ARCHIVOS = 'GET_ARCHIVOS'
export default function archivoReducer(state = dataInicial, action) {
switch(action.type){
case GET_ARCHIVOS:
return {...state, array: action.payloa... | true |
e8920c1c06512ed698f7cbf95c32789ae70ceca3 | JavaScript | amartinsavia/toDos | /apiToDo.js | UTF-8 | 3,194 | 2.609375 | 3 | [] | no_license | const express = require("express");
const app = express();
const body_parser = require("body-parser");
const path = require('path');
var port = process.env.PORT || 3000;
app.use(body_parser.urlencoded({ extended: true }));
app.use(body_parser.json());
// Configurar cabeceras y cors
app.use((req, res, next) => {
re... | true |
4722c7fd805fac2658c4c59e66bff8c71e1154b4 | JavaScript | misafric/final-project | /resources/js/cart-app/components/App.jsx | UTF-8 | 5,264 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, {useState,useEffect} from 'react';
function App() {
const csrf_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
const today = new Date();
const tomorrow = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+(today.getDate()+1);
const [{dataSet,loaded},setD... | true |
883b3f6410039161108ec91cb69e68ba4d1d9538 | JavaScript | Anticafe-coworking/site-privatisation | /components/utils.js | UTF-8 | 2,893 | 3.234375 | 3 | [] | no_license | export const startHour = (start, end) => {
let hours = ["Heure de début"];
let i = start ? start : 8;
let limit = end ? end : 23;
for (i; i <= limit; i++) {
hours.push(`${i}:00`)
}
return hours
}
export const endHour = (start, end) => {
let hours = ["Heure de fin"];
let i = sta... | true |
7a6832c0b43c3bd3244baad53e85bc2c0cc6a821 | JavaScript | wggodfrey/civ6-drafter | /client/reducers/dlcs.js | UTF-8 | 330 | 2.53125 | 3 | [] | no_license | const dlcsReducer = (state = [], action) => {
switch (action.type) {
case 'INIT_DLCS':
return action.payload;
case 'TOGG_DLC':
return state.map((dlc, i) => (i === action.payload
? { ...dlc, active: !dlc.active }
: dlc));
default:
return state;
}
};
export default dlc... | true |
3716cb8bbb01ed92f986232dd424bb83f118a696 | JavaScript | harpreet1602/Web-Development-Pepcoding | /callback asynchronous/serialread.js | UTF-8 | 494 | 2.859375 | 3 | [] | no_license | const fs=require("fs");
let sum1=0,length=8,filename=1;
function serialread(err,data)
{
if(!err)
{
filename++;
let arr=data.split("\n");
// console.log(arr);
for(let k=0;k<arr.length;k++)
{
sum1+=parseInt(arr[k]);
}
if(filename>length)
... | true |
00e3194a0ab2f80c3b282f1aa96c99dc4563a2bc | JavaScript | PantelisFan/numerical-systems | /src/server.js | UTF-8 | 3,322 | 2.65625 | 3 | [] | no_license | const controllers = require('./controllers');
const http = require('http');
const mongoCtrl = require('./mongodb');
//Creating the server
http.createServer((req, res) => {
res.setHeader('Content-Type', 'application/json');
// res.end(JSON.stringify({ a: 1 }, null, 3));
// res.write('Server running... | true |
4d59ef829fa04cf3ab4a6a909645f63cb3542518 | JavaScript | sidd-oo/Etch-A-Sketch | /srcipt.js | UTF-8 | 1,400 | 3.703125 | 4 | [
"MIT"
] | permissive | // Select Reset Button
let resetButton = document.querySelector('#reset-btn');
//Select Grid DIv
let gridContainer = document.querySelector('#grid');
//Prompts user for grid size and calls the createGrid function.
function main(){
let grid_size = prompt("Choose Grid Size: ", "24");
create_grid(grid_size);
... | true |
9dedb6a7c3334efa138a5bfa986a5d1f14df3f47 | JavaScript | eosite/openyourarm | /glaf-web/WebContent/scripts/plugins/bootstrap/wslider/js/slideshow-jq.js | UTF-8 | 89,317 | 2.640625 | 3 | [
"MIT"
] | permissive |
// console.log calls wont fatal-error when it doesn't exist
// TODO: put this in the weebly editor js
if (!window.console) {
window.console = {};
}
if (!window.console.log) {
window.console.log = function(){};
}
// ------------------------------------------------------------------------------------------------... | true |
77ecc537deaffc50d4e28c3da7d6e98fdfa85fad | JavaScript | nnabuihegabriel/convertFahrToCelsius | /script.js | UTF-8 | 395 | 3.265625 | 3 | [] | no_license | document.getElementById("button")
addEventListener("click", convertFahrToCelsius, false);
function convertFahrToCelsius () {
var degF = document.getElementById("fValue").value;
var degC = (degF - 32 ) * (5/9);
let answer = Number(degC.toPrecision(6))
document.getElem... | true |
afa8a7fdb89bdb4eff43b2dc71dbeae2fbcb26f7 | JavaScript | maria028/Wechat-ScratchCard | /src/pages/index/luck.js | UTF-8 | 2,400 | 2.71875 | 3 | [] | no_license | class Luck {
//构造器
constructor(page, options) {
this.page = page;
this.canvasId = options.canvasId ;
this.width = options.width;
this.height = options.height;
this.maskColor = options.maskColor;
this.size = options.size;
this.scale = options.scale;
this.totalArea = this.width * this.... | true |
99c25c11bc1d20f4e1352604df14e0193cec92cf | JavaScript | jorgevrgs/pizza-delivery | /helpers/password.js | UTF-8 | 613 | 2.734375 | 3 | [] | no_license | /**
* @module helpers.password
*/
// Dependencies
const crypto = require("crypto");
const config = require("../config");
// Container for all the helpers
const helpers = {};
// Create a SHA256 hash
helpers.hash = function (str) {
if (typeof str == "string" && str.length > 0) {
const hash = crypto
.crea... | true |
1222821eac0fcddbf8ee0a1f13d8b9ed6e6a3f60 | JavaScript | turab007/Mercedes_API | /backend/scripts/permissions.js | UTF-8 | 1,300 | 2.6875 | 3 | [] | no_license | //Import the mongoose module
var mongoose = require('mongoose');
mongoose.Promise = global.Promise;
//Set up default mongoose connection
var mongoDB = 'mongodb://127.0.0.1/my_database';
mongoose.connect(mongoDB);
//Get the default connection
var db = mongoose.connection;
//Bind connection to error event (to get not... | true |
fe450998634b2ff3d8d26421dd56156ae2cea287 | JavaScript | multiplex/multiplex.js | /src/lib/collections/map.js | UTF-8 | 5,125 | 3.359375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import IterableIterator from '../iteration/iterable-iterator';
import Collection from './collection';
import HashTable, {HashTableIterator} from './hash-table';
import isArray from '../utils/is-array';
import error from '../utils/error';
import forOf from '../utils/for-of';
import count from '../utils/count';
import de... | true |
fd110cc758c02f1cf88ad1e3cec6d0d1a6404844 | JavaScript | Andres-Atehortua/lab-dom-ironhack-cart | /starter-code/js/index.js | UTF-8 | 2,148 | 3.28125 | 3 | [] | no_license | let cart = document.querySelector('#cart tbody');
let calc = document.getElementById('calc');
let del = document.querySelectorAll('.btn-delete')
let prod = document.querySelectorAll(".product")
let createBut = document.getElementById('create')
console.log(prod)
console.log(del)
function updateSubtot(product) {
// Ite... | true |
a3208a9f3e6a345b44f3a9ce644dbb8640749517 | JavaScript | fossabot/ml-api-adapter | /src/lib/hapi/plugins/rawPayloadToDataUri.js | UTF-8 | 1,595 | 2.546875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | const getRawBody = require('raw-body')
const encodePayload = require('@mojaloop/central-services-stream/src/kafka/protocol').encodePayload
const requestRawPayloadTransform = (request, payloadBuffer) => {
try {
return Object.assign(request, {
payload: JSON.parse(payloadBuffer.toString()),
dataUri: enc... | true |
27a608811d9fef07a4f5d8aa5aedc2040a8848fa | JavaScript | HimanshuGupta08/HackerRank-React-Basic-Skill-Test | /HackerRank-React-Skill-Test-Basic-master/Slideshow Part/src/components/Slides.js | UTF-8 | 1,156 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, {useState} from 'react';
function Slides({slides}) {
const [ currentIndex, setCurrentIndex ] = useState(0);
function handleNext() {
setCurrentIndex(currentIndex+1)
}
function handlePrevious() {
setCurrentIndex(currentIndex-1)
}
function handleRestart() {
... | true |
d23833f45b24a3ede62d72b95567166c1efbb797 | JavaScript | zaucy/grpc-chat-demo | /server/src/main.js | UTF-8 | 3,109 | 2.671875 | 3 | [] | no_license | // Built-in Modules
const {EventEmitter} = require("events");
// Dependency Modules
const grpc = require("grpc");
const jsonwebtoken = require("jsonwebtoken");
// Local modules
const {
ChatService,
LoginResponse,
ChatMessage
} = require('@grpc-chat-demo/proto');
// Local module variables
const DEFAULT_CHANNEL... | true |
917ff2c7003a01a7853b25394d9807156a6cae08 | JavaScript | Rhaxis/4A00EZ61-3002-ecmascript-ekholm-ville | /homework/2020-35/e03-e013/e13.js | UTF-8 | 172 | 3.53125 | 4 | [] | no_license | function abs (number) {
if (number < 0) {
return number * (-1)
} else {
return number
}
}
console.log(abs(-7)) // outputs 7
console.log(abs(7)) // outputs 7
| true |
0c4da807399ab7a87175abeaccfb3a377fe5d01e | JavaScript | TomYang1993/leetcode-ES6-js-solutions | /268-missing-number.js | UTF-8 | 235 | 3.171875 | 3 | [] | no_license | var missingNumber = function(nums) {
let distinctSum = nums.length * (nums.length + 1) / 2;
let actualSum = 0
for(let i = 0; i < nums.length; i++) {
actualSum += nums[i];
}
return distinctSum - actualSum;
}; | true |
412d8bac14b890c0df14dfabe073866fe7d66595 | JavaScript | wfadam/dynamics_node | /time.js | UTF-8 | 595 | 3.046875 | 3 | [] | no_license | function timeDiff(diff) {
let msec = diff;
let dd = Math.floor(msec / 1000 / 60 / 60 / 24);
msec -= dd * 1000 * 60 * 60 * 24;
let hh = Math.floor(msec / 1000 / 60 / 60);
msec -= hh * 1000 * 60 * 60;
let mm = Math.floor(msec / 1000 / 60);
msec -= mm * 1000 * 60;
let ss = Math.floor(msec / 1000);
msec -= ss * 10... | true |
590c88e0b1f5bd73918a901d907edbc424654de7 | JavaScript | nojs/msgpack-socket | /promise_emitter.js | UTF-8 | 431 | 2.609375 | 3 | [] | no_license |
var Q = require('q')
var Emitter = require('events').EventEmitter
Emitter.prototype.await = function await(event){
var result = Q.defer()
this.once(event, function(){
if(arguments.length === 0){
result.resolve()
} else if(arguments.length === 1){
result.resolve(arguments[0])
} else {
... | true |
0ed1bc652dc0878eccc996af62e1bb299de80942 | JavaScript | mattmazzola/ember-perceptron-visualizer-site | /app/pods/index/controller.js | UTF-8 | 2,439 | 2.515625 | 3 | [
"MIT"
] | permissive | import Ember from 'ember';
export default Ember.Controller.extend({
interval: 1000,
learningDatas: null,
visualizerMode: true,
visualizerReset: false,
trainingPoints: null,
idealLineSlope: null,
idealLineOffset: null,
trainedLineSlope: null,
trainedLineOffset: null,
trainingLines: null,
perceptro... | true |
01634f5480c3b6ae08de2c75f62244138cabc7f2 | JavaScript | jlee1546/rockPaperScissors | /rps-UI.js | UTF-8 | 3,764 | 3.46875 | 3 | [] | no_license | // Javascript for Rock, Paper, Scissors project @The_Odin_Project
function computerPlay() {
const computerChoices = ['Rock', 'Paper', 'Scissors'];
return computerChoices[Math.floor(Math.random() * computerChoices.length)]
}
function playRound(playerSelection, computerSelection) {
if ((playerSelection.toL... | true |
9895a48ecfc64bf9dbcd693dcd9fb31f0f7693e8 | JavaScript | ayladillis/project-3 | /config/passport.js | UTF-8 | 1,654 | 2.828125 | 3 | [
"MIT"
] | permissive | // this file configures passport
// require dependencies
const passport = require("passport");
const LocalStrategy = require("passport-local").Strategy;
const db = require("../models");
// use local strategy for logging in directly through our app
passport.use(new LocalStrategy(
// log in with email
{
usernam... | true |
bc5005ea7c00e6d70d4c6749d1c32708315be23f | JavaScript | jairorudas/stepByStepInJavaScript | /portugues/6-StringESeusMetodos/metodo_substring.js | UTF-8 | 552 | 4.0625 | 4 | [
"Apache-2.0"
] | permissive | /*
metodo substring(indiceA, [indiceB]);
Este metodo é muito parecido com o metodo slice, a diferença entre eles está em que
neste metodo quando o primeiro parametro é maior que o segundo ele inverte os valores
dos dois parametros e se comporta igual ao metodo slice.
Vamos ver alguns exempos:
*/
... | true |
95219c610eefad243617c270af158b7c4e57ba87 | JavaScript | SynCROSS/learning-node | /3/util.js | UTF-8 | 387 | 2.828125 | 3 | [] | no_license | const util = require('util');
const crypto = require('crypto');
const deprecated = util.deprecate((x, y) => {
console.log(x + y);
}, 'This function is deprecated.');
deprecated(1, 1);
const randomBytesPromise = util.promisify(crypto.randomBytes);
randomBytesPromise(64)
.then(buf => {
console.log(buf.toString(... | true |
f17d6c22aed5d010855a8cce48ef355b01d6e8a9 | JavaScript | YashKumarVerma/dolos | /src/api/Parser.js | UTF-8 | 4,194 | 3.265625 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-await-in-loop */
// string features
const { string$enum } = require("./workers/string.enum");
const { string$country } = require("./workers/string.country");
const { string$lastName } = require("./workers/string.lastName");
const { string$firstName } = require("./workers/string.firstName");
// num... | true |
7d2009926b7f5efc9f2e291e051f1e8f6a58022c | JavaScript | AleMancilla/ReactFH | /src/bases/09-promesas.js | UTF-8 | 1,082 | 2.984375 | 3 | [] | no_license | import {getHeroes,getHeroesByOwner} from './bases/08-imp-exp'
// const promesa = new Promise((resolv, reject)=>{
// setTimeout(()=>{
// //console.log('2 segundos despues');
// // resolv();
// const heroe = getHeroes(2);
// console.log(heroe);
// resolv(heroe);
// // ... | true |
8e1d79560a2871325495591b8f97712b9d440f08 | JavaScript | stanleyyylau/feedreader | /jasmine/spec/feedreader.js | UTF-8 | 1,394 | 2.78125 | 3 | [] | no_license | $(function(){
// the first test suite will check if feeds array is defined and have at least one value
describe('Feeds array', function(){
it('are defined', function(){
expect(feeds).toBeDefined();
});
it('not empty', function(){
expect(feeds.length).not.toBe(0);
});
it('made of o... | true |
cd3796f311a9878e591835f3538d6cd3ada78be0 | JavaScript | Manuel-Aullo/react-course-expensify-app | /src/app.js | UTF-8 | 1,917 | 2.65625 | 3 | [] | no_license | import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import AppRouter from "./routers/AppRouter";
import configureStore from "./store/configureStore";
import {
addExpense,
removeExpense,
editExpense
} from "./actions/expenses"
import {
setTextFilter,
sortByDate,
sor... | true |
fc08f871619d8d6781aa911af85dbc6bc9b92d75 | JavaScript | GregDevProjects/chamber | /src/effects/pickup.js | UTF-8 | 1,889 | 3.109375 | 3 | [
"MIT"
] | permissive | const INNER_RADIUS = 30;
const OUTER_RADIUS = 120;
class Pickup {
constructor(scene) {
this.starGraphics = scene.make.graphics({ x: 0, y: 0, add: false });
drawStar(
this.starGraphics,
500,
500,
10,
OUTER_RADIUS,
INNER_RADIUS,
0xffff00,
0xff0000
);
scen... | true |
5a7c77a3f286d1026ef9aa75df9fdef444c73d95 | JavaScript | hunterdanielson/lab-02-Guess-a-Number | /compareNumbers.js | UTF-8 | 367 | 3.0625 | 3 | [] | no_license | function compareNumbers(guess, correctNumber) {
if (guess === correctNumber) {
return 0;
} else if (guess < correctNumber && guess > 0) {
return -1;
} else if (guess > correctNumber && guess < 11) {
return 1;
} else {
() => { throw new 'Error: Not a number between 1 and 1... | true |
6ef3ecde68acc218d4f6631439805f3b10cb4e04 | JavaScript | siriS88/apollo-multiple-clients-example | /src/App.js | UTF-8 | 2,583 | 2.671875 | 3 | [] | no_license | import React, { Component } from "react";
import { useQuery, useApolloClient } from "@apollo/react-hooks";
import gql from "graphql-tag";
import logo from "./logo.svg";
import "./App.css";
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
... | true |
893c1258cfb48df5afc1ff023666a5996117ce08 | JavaScript | apradhan12/four-with-friends-web | /model.js | UTF-8 | 2,186 | 3.4375 | 3 | [] | no_license | const BOARD_WIDTH = 7;
const BOARD_HEIGHT = 6;
const GAME_STATES = {
playerTurn: "playerTurn",
opponentTurn: "opponentTurn"
};
const GAME_RESULTS = {
win: "win",
loss: "loss",
draw: "draw",
opponentDisconnected: "opponentDisconnected",
opponentRequestedRematch: "opponentRequestedRematch",
... | true |
fe843d5649d665418ccdd5d93c4850f404c424ca | JavaScript | brianharv/rpg-project | /src/js/main.js | UTF-8 | 1,315 | 3.109375 | 3 | [] | no_license | import $ from 'jquery';
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
import '../css/styles.css';
import { Character, Game, checkCharType, getRandom, generateEnemy, Enemy } from './players.js';
$(document).ready(function () {
let userInput;
let charStatsArray;
$("#magePic").click(function (... | true |
1f3435d684453768ad0970c9eeb5f12fcff1b250 | JavaScript | fumen/gae-fumen | /static/javascripts/MainController.js | UTF-8 | 6,416 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | /// <reference path='./../JS/knockoutJS.d.ts' />
/// <reference path='./../JS/jquery.d.ts' />
/// <reference path='./../JS/SammyJS.d.ts' />
var utitlity = new UtilityFunctions();
function mainController() {
var self = this;
self.topArtists = ko.observableArray();
self.topAlbums = ko.observableArray();
... | true |
fa61f94f51eb233b6814ed2e577dc4b9ac33c59a | JavaScript | BastienEstia/FirstGameJS | /TPJeuxJS/js/ecouteurs.js | UTF-8 | 1,273 | 3.15625 | 3 | [] | no_license | let mousePos = {};
function traiteMouseDown(event) {
//console.log("Souris clickée dans le canvas bouton " + event.button);
//console.log("Clickée en x = " + mousePos.x + " y = " + mousePos.y);
}
function traiteMouseUp(event) {
//console.log("Souris relâchée dans le canvas bouton " + event.button);
}
functi... | true |
ebba1acae5654ee59f5abbfc70004a9c1dad6d89 | JavaScript | lampard999999999/balinterdi.github.com | /rock-and-roll-with-emberjs/js/read-more.js | UTF-8 | 1,122 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // script for TOC
$( document ).ready(function() {
var slideHeight = 220;
$(".wrap-container").each(function() {
var $this = $(this);
var $wrap = $this.children(".wrap");
var defHeight = $wrap.height();
if (defHeight >= slideHeight) {
var $readMore = $this.find(".read-more");
... | true |
655fe2b5ebbb8f8fc0990b5f1bcd5ad51c5f06a6 | JavaScript | gfxfundamentals/threejsfundamentals | /threejs/resources/threejs/r127/examples/jsm/renderers/nodes/accessors/NormalNode.js | UTF-8 | 2,049 | 2.59375 | 3 | [] | permissive | import Node from '../core/Node.js';
import AttributeNode from '../core/AttributeNode.js';
import VaryNode from '../core/VaryNode.js';
import ModelNode from '../accessors/ModelNode.js';
import CameraNode from '../accessors/CameraNode.js';
import OperatorNode from '../math/OperatorNode.js';
import MathNode from '../math/... | true |
70c1c371a2e84ea7fcd4c8b4518d9e36e4cee796 | JavaScript | sektionschef/house | /objects/steam.js | UTF-8 | 1,078 | 3.6875 | 4 | [
"MIT"
] | permissive | class Steam {
constructor(tempX, tempY, tempRadius) {
this.x = tempX;
this.y = tempY;
this.radius = tempRadius;
this.color = color(255, 80);
}
show() {
noStroke();
fill(this.color);
ellipse(this.x, this.y, this.radius);
}
move() {
this.x = this.x + random(-5, 5);
this.y =... | true |