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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b73bc0e5ccd98a16348f4f4fe5e409d4af0a4d45 | JavaScript | emmanuelq2/AnalyticsEdge-MIT-edX | /WEEK 3 - LOGISTIC REGRESSION/ASSIGNMENT 2 - PAROLE - LAW SYSTEM/National Corrections Reporting Program, 2004_files/fixGAClicks.js | UTF-8 | 1,260 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
* This script uses jQuery to dynamically add GA tracking to download clicks on the study home page.
* Basically, it pre-empts the href so that each click first tracks the GA even then directs the url
* to the download.
*/
$(document).ready(function(e){
$('a.gaClick').click(function(e){
e.preventDefault();
... | true |
13c1f163b17c1ef373578ff9733b57e64aecc2b5 | JavaScript | john-raymon/bullfrog-invoice-react | /src/state/reducers/auth.js | UTF-8 | 472 | 2.578125 | 3 | [] | no_license | const initialState = {
isAuth: false,
token: null
}
export default (state = initialState, { type, payload = {} } ) => {
switch (type) {
case `${"LOGIN"}_FULFILLED`:
return {...state, token: payload.token, isAuth: payload.isAuth}
case "LOGOUT":
case `${"LOGIN"}_REJECTED`:
return {...state,... | true |
e72133161dacfdf2a9d45db97d4b08e5a058fd92 | JavaScript | dugiwarc/web-dev-app | /middleware/middleware.js | UTF-8 | 888 | 2.546875 | 3 | [] | no_license | const jwt = require("jsonwebtoken");
module.exports = function(req, res, next) {
const getTokenFromCookie = () => {
console.log("GETTING COOKIE MIDDLEWARE");
const name = "devToken=";
const decodedCookie = decodeURIComponent(req.headers.cookie);
const ca = decodedCookie.split(";");
for (let i = 0... | true |
d1f1e0e25f5bd87ffb9736c956e4bfb7cce28fbb | JavaScript | Edward-Phillips/news-summary-challenge | /public/newsreel.js | UTF-8 | 365 | 2.84375 | 3 | [
"MIT"
] | permissive | function newsReel(newsItemClass,apiResponse) {
this.raw_news = apiResponse;
this.newsPieces = [];
this.itemClass = newsItemClass;
}
newsReel.prototype.articleParser = function() {
for (let index = 0; index < this.raw_news.length; index++) {
const article = new this.itemClass(this.raw_news[index].fields,ind... | true |
5fe1e496742773bb5a91bedff95f8da36e2fd1be | JavaScript | tanweisong/attendance-management | /client/src/services/LoginService.js | UTF-8 | 976 | 2.609375 | 3 | [] | no_license | import axios from "axios";
const url = "../api/login";
class LoginService {
static createLogin(email, password) {
return new Promise(async (resolve, reject) => {
try {
const res = await axios.post(url, {
email,
password
});
const data = res.data;
resolv... | true |
a5d564b58d13bc74572f14a7e9ce1f71834cd2b0 | JavaScript | maxdignan/learnyounode | /juggle_async.js | UTF-8 | 915 | 2.9375 | 3 | [] | no_license | var http = require('http');
var bl = require('bl');
(function(){
var completeCount = 0;
var dataArr = ['','',''];
http.get(process.argv[2], function(response){
response.pipe(bl(function(err, data){
dataArr[0] = data.toString();
completeCount++;
if (completeCount === 3){
printResult... | true |
5c9069f960388a31b110cafd4563fdd37501de00 | JavaScript | carrollm2/jsdom-toy-tale-online-web-sp-000 | /src/index.js | UTF-8 | 3,258 | 3.515625 | 4 | [] | no_license | let addToy = false;
const toys = [];
document.addEventListener("DOMContentLoaded", () => {
const addBtn = document.querySelector("#new-toy-btn");
const toyFormContainer = document.querySelector(".container");
addBtn.addEventListener("click", () => {
// hide & seek with the form
addToy = !addToy;
if (... | true |
7632507de24daf2986bf7ff0c7703e7e9e2d930d | JavaScript | makiyo-ronkko/reactjs_sandbox | /6_task/src/App.js | UTF-8 | 3,325 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
import Post from './Post/Post';
const posts = [{
id: 1,
img: "https://source.unsplash.com/daily",
title: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
author: "John Smith",
desc: "Lorem ipsum dolor sit amet, nec probo eripuit propriae no, mucius apparea... | true |
37ac23d5ba6cbee85d161b23b42ce9e8bcbe9fdf | JavaScript | PriyanshuDangi/deltaOnSites | /Task3/spotify.js | UTF-8 | 2,329 | 2.875 | 3 | [] | no_license | const axios = require("axios");
const client_id = process.env.ClientID;
const client_secret = process.env.ClientSecret;
const getToken = async () => {
try {
let token;
let res = await axios.post(
"https://accounts.spotify.com/api/token",
"grant_type=client_credentials",
{
headers: ... | true |
2543237a5501471b48025964a5be0ff02c5caf6d | JavaScript | mrkefir4ik/LOTR-API | /source/app.js | UTF-8 | 2,296 | 2.90625 | 3 | [] | no_license | const randomQuote = require('random-lotr-movie-quote');
const quote_button = document.querySelector('.give_quote');
const search = document.querySelector('.search');
const button = document.querySelector('.button');
const app = document.querySelector('.app');
function searcher () {
if(document.querySelector('.quote... | true |
d3dee58fb39a7b93de1c96e7843e3c8f57ba20de | JavaScript | RuchiRay/image-search-engine | /src/reducers/images.js | UTF-8 | 609 | 2.625 | 3 | [] | no_license | const images = (state={imageBox:[]},action)=>{
const {type,payload} = action
switch (type) {
case "ADD_IMAGE":
{
let temp = [...state.imageBox];
const newtemp = payload.map((item)=>{
return item
})
const final = [...temp,... | true |
53443c1b3754429033acef22f566154b86546090 | JavaScript | spoonfedsoup/Tic-Tac-Toe-Telegram-Bot | /server.js | UTF-8 | 3,957 | 2.6875 | 3 | [] | no_license | var express = require('express');
var app = express();
var config = require('./config_real');
var TelegramBot = require('node-telegram-bot-api');
var bot = new TelegramBot(config.token, {
polling: true
});
var kbMod = require("./modules/inline_keyboard.js");
var checker = require("./modules/combination_checker.js");... | true |
1f31f5367984c2ce9f750325fc9ce17ec9ef8568 | JavaScript | quenandres/basicojs | /scope.js | UTF-8 | 267 | 3.203125 | 3 | [] | no_license | var miNombre = "Jhonatan";
function nombre(){
var miApellido = "Mejia";
console.log(miNombre+" "+miApellido);
}
// Desde fuera si podemos acceder a miNombre.
// Pero si intentamos acceder a miApellido no podemos por que esta en el scope de la funcion nombre. | true |
d2a673287543d2e84bba312096e44cf56a99d5c7 | JavaScript | fixyo/react-auth-router | /src/views/controlled-component.js | UTF-8 | 1,531 | 3.15625 | 3 | [] | no_license | import React, { Component } from 'react'
export default class NameForm extends Component {
constructor(props) {
super(props);
this.state = {value: '', selected: 'coconut'};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) ... | true |
5f2438a9c1fda0fe9e4ca444e32069b30e277213 | JavaScript | kruppi/zfblog | /public/scripts/dojo/dojox/color/Generator.js | UTF-8 | 8,220 | 2.796875 | 3 | [
"BSD-3-Clause",
"AFL-2.1"
] | permissive | dojo.provide("dojox.color.Generator");
dojox.color.Generator = new (function(){
var dxc=dojox.color;
// common helper functions
var prep=function(obj){
if(!obj){
console.warn("dojox.color.Generator:: no base color was passed. ", obj);
return null;
}
if(!obj.toHsv){
// either a raw string or object, ... | true |
8a92a732be5eae4f6d99cf51a028516658d051ac | JavaScript | XavierCL/coveoblitz | /typedef.js | UTF-8 | 2,198 | 2.796875 | 3 | [] | no_license | /* Usefull types definition! Autocompletion works nicely in WebStorm! */
/**
* @typedef {Object} Play
* @property {Game} game The current game state
* @property {Hero} hero Your hero status
* @property {string} token The magic token
* @property {string} viewUrl An URL that you can open in your bro... | true |
b264091e9505d9b15e6d5a3cac5e940318acd6e8 | JavaScript | faisaladisoe/Learn-React | /initial-app/src/components/App.jsx | UTF-8 | 837 | 2.859375 | 3 | [
"MIT"
] | permissive | import React, {useState} from 'react';
import Person from './Person/Person';
import NewPerson from './NewPerson/NewPerson';
const App = () => {
const [clickMe, setClickMe] = useState([
{id: 1, name: 'Faisal', age: 19, gender: 'Male'},
{id: 2, name: 'Farah', age: 20, gender: 'Female'},
... | true |
0f9245152f16ad485f4cda1e7c90e98854fe2fc1 | JavaScript | rajnishp/demoshop | /frontend/js/views/products/ProductsEditView.js | UTF-8 | 3,003 | 2.546875 | 3 | [] | no_license | define([
'jquery',
'underscore',
'backbone',
'models/products/ProductsModel',
'text!templates/products/productEditTemplate.html'
], function($, _, Backbone, ProductsModel, productEditTemplate){
var ProductEditView = Backbone.View.extend({
el : $("#page"),
events: {
'submit .edit-produc... | true |
f56b1b64be4c9f9be032960d02faca2c3c5218bf | JavaScript | Fortiam/james-medlog-client | /src/__tests__/navMenu.test.js | UTF-8 | 2,619 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { shallow, mount } from 'enzyme';
import { Link, BrowserRouter } from 'react-router-dom';
import {NavMenu} from '../components/navMenu';
describe('the NavMenu component', ()=>{
//component passed props are:
//showUp={this.state.toggle}//boolean
//switch={()=>this.toggleSho... | true |
d2846bd4772debf01b73b13a26630c5a1864c33c | JavaScript | Gema-de-la-Fuente/NeedArt-AJAX | /js/main.js | UTF-8 | 5,136 | 2.796875 | 3 | [] | no_license | /*************** MENU DESPLEGABLE ***************/
$(document).ready(function() {
$menu = $('.nav').find('ul').find('li');
$menu.hover(function() {
$(this).children('ul').stop();
$(this).children('ul').slideDown();
}, function() {
$(this).children('ul').stop();
$(this).child... | true |
041153d195df5081c69f0df7d48f0152ebd7bce7 | JavaScript | geymed/abmath | /static/geymed.js | UTF-8 | 3,899 | 2.765625 | 3 | [] | no_license | /**
* Angry Birds Math game for kids
* @author Gilad Foyer AKA Geymed
*
*/
;(function ($) {
"use strict";
// Global `vars` and `consts`
var abPics = ['static/images/pink-ab-sw.png',
'static/images/angry-bird-red.png',
'static/images/angry-bird-war.png',
'static/images/angry-bird-black.png',
... | true |
9707313829ca93b4dac100ca3fe45894d471ed6f | JavaScript | Anton2102/code.me | /JavaScript/3 Условия/1 Конструкция if-else/6 задача/main.js | UTF-8 | 398 | 3.578125 | 4 | [] | no_license | // Даны переменные test1 и test2. Проверьте, что значение какой из этих переменных больше и выведите соответствующее сообщение на экран.
let test1 = 5, test2 = 7;
if(test1 > test2){
alert('test1 больше');
} else if(test1 < test2) {
alert('test2 больше');
} else {
alert('=');
}
| true |
4c7e44404135a1a87865228df84fa6880b53f675 | JavaScript | mistermappy/JS-mini-challenges | /index.js | UTF-8 | 1,174 | 3.390625 | 3 | [] | no_license | //Challenge #1: Buttons arguing
document.getElementById('btn').onclick = function(){
document.getElementById('text').innerHTML = "I\'m right!" ;
}
document.getElementById('btn2').onclick = function(){
document.getElementById('text').innerHTML = 'No, I\'m right!' ;
}
//Challenge #2: Don't Hover Over Text
document.... | true |
ff981abc31c3b67d8348c0dcf4be8cc416022da8 | JavaScript | iwishjames/fire-dash | /src/components/WeatherFromBOMARCHIVED.js | UTF-8 | 1,905 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react';
class Weather2 extends Component {
constructor(){
super()
this.state = {
description: "",
temperature : "",
percipitation: "",
humidity: "",
windSpeed: "",
windDirection: ""
}
}
componentDidMount(){
var proxyUrl = 'http... | true |
46c3a1122433527ff1efe36e31d555e4e3957df8 | JavaScript | SoniaV26/BreadCat | /breadcat/BreadCat-/search.js | UTF-8 | 2,938 | 2.734375 | 3 | [] | no_license | const sqlite = require("sqlite");
module.exports = {
/*
* resultArray: searchRestaurants(string: searchQuery, database: dbPromise,
* boolean: glutenFreeFilter,
* boolean: vegetarianFilter,
* boolean: veganFilter,
* boolean: lowCalorieFilter,
* boolean: kosherFilter)
*/
searchRestaur... | true |
0dc028e42cfe8b945f69161cf1ad67de555301ef | JavaScript | Buddha-is-a-boy/lesson_shuidi | /js/train/3.js | UTF-8 | 1,522 | 3.484375 | 3 | [] | no_license | /**
*
* @param {*} matrix
* @param {*} start
*/
function Dijkstra(matrix, start = 0) {
const rows = matrix.length,//rows和cols一样,其实就是顶点个数
cols = matrix[0].length;
if(rows !== cols || start >= rows) return new Error("邻接矩阵错误或者源点错误");
//初始化distance
const distance = new Array(rows).fill(In... | true |
c9f84c89942699f50fe530d2e3e15fab4cc27241 | JavaScript | ZhebinNikita/JavaWebProject | /car_hire_web_project/web/js/popup/popup_rent_car_window.js | UTF-8 | 966 | 2.703125 | 3 | [] | no_license | $(document).ready(function () {
// if user clicked on button, the overlay layer or the dialogbox, close the dialog
$('a.btn-ok, #rent-car-dialog-overlay').click(function () {
$('#rent-car-dialog-overlay, #rent-car-dialog-box').hide();
return false;
});
// if user resize the window, cal... | true |
fe77aab550c6c5d43e59c0841c34f37885756192 | JavaScript | huanz/eatMoonCakes | /js/pick.js | UTF-8 | 796 | 2.734375 | 3 | [] | no_license | (function(win){
function Pick(x, img){
createjs.Shape.call(this);
this.graphics.beginBitmapFill(img).drawRect(0, 0, img.width, img.height);
this.width = img.width;
this.height = img.height;
this.x = x;
this.y = randomNum(40, h-60);
stage.addChild(this);
var _this = this;
this.addEventListener("tick",... | true |
fcceca51c6af6c85c8e9e2313678efaa8c45a14f | JavaScript | ykzhukian/js-note | /src/notes/YouDontKnowJS/Scope & Closures.js | UTF-8 | 2,056 | 3.703125 | 4 | [] | no_license | /* eslint-disable no-undef */
/* eslint-disable no-self-compare */
export const run = () => {
/* ------------------ 编译器理论 ---------- */
/**
* 其一,JavaScript 引擎没有(像其他语言的编译器那样)大把的时间去优化,因为 JavaScript 的编译和其他语言不同,不是提前发生在一个构建的步骤中。
对 JavaScript 来说,在许多情况下,编译发生在代码被执行前的仅仅几微秒之内(或更少!)。为了确保最快的性能,
JS 引擎将使用所有的招数(比如 JIT... | true |
3aecab51b56101e0e98565d989ced1ddf781e0ec | JavaScript | DennisMWarner/inspirational-week4-midterm | /app/models/weather.js | UTF-8 | 742 | 3.28125 | 3 | [] | no_license | export default class Weather {
constructor(data) {
//NOTE Have you ever wanted to know the temperature measured in kelvin?
// That is what this data returns! data.main.temp is the temperature in Kelvin
//TODO You should probably convert the temperature data to either F or C
// check out the... | true |
936cf7e034089a71ec10e4a10af59a117c7f4c0a | JavaScript | rickingyn/OOP_game_show_app | /js/app.js | UTF-8 | 1,015 | 3.453125 | 3 | [] | no_license | /* Treehouse FSJS Techdegree
* Project 4 - OOP Game App
* app.js */
// create game object
const game = new Game();
// add event listener to start game button
document.querySelector("#btn__reset").addEventListener("click", function() {
game.startGame();
});
/**
* add event listener to onscreen keyboard
* use ev... | true |
a52dce46b2ad9866b8e19495f744e2e0f965f475 | JavaScript | Rosswoolfenden/Lumia-Learning-Graduate-Assessment- | /api/controllers/basicLogin.js | UTF-8 | 1,677 | 2.890625 | 3 | [] | no_license | const basic = require('passport-http').BasicStrategy;
const model = require('../models/users');
const logging = require('../logging/WinstonLogging');
const log = logging.createLogger('Basic Auth');
const bycrpt = require('bcrypt');
/**
* A function to test if the user entered passwords matches the one saved in the da... | true |
7d083a9745299e1d8c3df7e7cb7a4adf2aeecb2b | JavaScript | morettic2015/smartcities | /SmartcitiesGITHUB/web/js/smartcities.js | UTF-8 | 11,544 | 2.515625 | 3 | [] | no_license | /*****************************************
* Controle do modelo / dados
****************************************/
/**
* Globais
*/
var configSmartcities = {}; // Objeto JSON que guarda dados que serão reutilizados nas telas
var parametrosTela = {} // Parametros que são passados quando é carregada alguma ... | true |
865f4baacdf6ebbc7ff84c0ee1b4c9b392b07ebf | JavaScript | bobenut/demo-node | /es6/d0002/index.js | UTF-8 | 1,292 | 4.1875 | 4 | [
"MIT"
] | permissive | //操作
//add
let set1 = new Set()
set1.add(1)
set1.add(2)
set1.add(3)
console.log('added:', set1)
//delete
set1.delete(1)
console.log('deleted:', set1)
//判断是否存在某个值
console.log('has(1):', set1.has(1))
console.log('has(2):', set1.has(2))
//clear
set1.clear()
console.log('cleared:', set1)
//set和array互转
//Array to Set
l... | true |
e107b401f62e1cfacc07acdf6a9a2c1d6b344660 | JavaScript | d3marcog/tictactoe | /app.js | UTF-8 | 1,668 | 3.921875 | 4 | [] | no_license | var origBoard;
const huPlayer = "O";
const huPlayer2 = "X";
const winCombos = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[2, 5, 8],
[1, 4, 7],
[0, 4, 8],
[6, 4, 2]
]
const cells = document.querySelectorAll('.cell');
startGame();
//function to start game
function startGame() {
... | true |
16cfea70e21f1fd9d04592066496c516b3104595 | JavaScript | GorohovVladimir/Vladimir_gor_tasks | /task-35/main.js | UTF-8 | 524 | 2.953125 | 3 | [] | no_license | function initBtn() {
let btn = document.querySelector('.go');
return btn;
}
function run() {
const vasa = document.querySelector('.vasya');
let leftOffset = 0;
let direction = 'right';
setInterval(() => {
// if (direction === 'right') {
leftOffset++;
// }
/... | true |
d7a5fa545ee84b130b77cbf1d34da026aa60e3cb | JavaScript | myrtokonst/event_finder- | /front-end/src/App.js | UTF-8 | 5,857 | 2.5625 | 3 | [] | no_license | //react
import React, { Component } from 'react'
import { Route, Switch, withRouter} from 'react-router-dom'
import { MDBRow, MDBContainer } from 'mdbreact'
//styling
import './style/App.css'
//components
import NavBar from './components/NavBar'
import Login from './components/Login'
import AllCategoriesContainer... | true |
642b68da4910b40a9d31569147ef8f316995d83b | JavaScript | rzuniga64/javascript | /javascript-es6/object_extensions/number.js | UTF-8 | 274 | 3.234375 | 3 | [] | no_license | let number = NaN;
let finite = 10000000;
let infinity = Infinity;
let float = 10.1;
console.log(Number.isNaN(number));
console.log(Number.isFinite(finite));
console.log(Number.isFinite(infinity));
console.log(Number.isInteger(finite));
console.log(Number.isInteger(float)); | true |
2d8a9f70c958b36866bfb9ba3c2710b95c1df7bb | JavaScript | dartharthur/codingbat-recursion | /javascript/recursion-1/strDist.js | UTF-8 | 953 | 4.34375 | 4 | [] | no_license | /* https://codingbat.com/prob/p195413
Given a string and a non-empty substring sub, compute recursively the largest
substring which starts and ends with sub and return its length.
strDist("catcowcat", "cat") → 9
strDist("catcowcat", "cow") → 3
strDist("cccatcowcatxx", "cat") → 9
*/
function strDist(str, sub) {
... | true |
d266811457498d0beff0d489b2f44a481e513239 | JavaScript | gaonita/jsExercise | /sortAndInsert.js | UTF-8 | 363 | 3.40625 | 3 | [] | no_license | function getIndexToIns(arr, num) {
arr.sort(function (a, b) {
return a - b
});
if (arr.length === 0) {
return 0;
}
for (let i = 0; i < arr.length; i++) {
if (arr[i] >= num) {
arr.splice(i, 0, num);
return i;
}
}
return arr.length;
}
... | true |
ed450064b03394972a5455a6dd38cff27ca6e4f0 | JavaScript | Umpoy/mern_pokestats | /client/src/components/PokeStats.js | UTF-8 | 3,867 | 2.703125 | 3 | [] | no_license | import React from 'react';
import { connect } from 'react-redux';
import '../css/PokeStats.css';
const image = {
height: '150px'
}
const red = {
backgroundColor: 'rgba(255, 89, 89, 0.5)'
}
const orange = {
backgroundColor: '#F5AC78'
}
const yellow = {
backgroundColor: '#FAE078'
}
const blue = {
... | true |
7e857d0288b6eb9c0eacd6ef4036782dab39ec3b | JavaScript | amirhoosian/my-app | /index.js | UTF-8 | 2,023 | 2.828125 | 3 | [] | no_license |
const http = require('http');
const fs = require('fs')
const qs = require('querystring');
const server = http.createServer((req, res) => {
let URL = req.url;
let method = req.method
if(URL === '/' && method === 'GET'){
res.setHeader('Content-Type', 'text/html')
res.write(`
<html>
... | true |
1c02418d714ebcbca764b2c63e53698dc3491edb | JavaScript | kenjiSpecial/interaction-with-artificial-physics-dev | /app-sp/src/js-app/apps/99-line-animation-with-circles/app.js | UTF-8 | 3,251 | 2.796875 | 3 | [
"MIT"
] | permissive | var Vec2 = require('ks-vector').Vector2;
var Verlet = require('./verlet/verlet.js');
var Particle = require('./verlet/particle.js');
var Composite = require('./verlet/composite.js');
var Ball = require('./verlet/ball.js');
var DistanceConstraint = require('./verlet/constraints/distance.js');
class App {
constructor(... | true |
d4b6ced2de27275481d24cfa01498fa147c1bd05 | JavaScript | funny0628/cssAnimate | /sideNavigation/index.js | UTF-8 | 2,188 | 2.90625 | 3 | [] | no_license | let side = document.getElementById('side');
let ulEle = document.getElementById('ul');
let btn = document.getElementById('btn');
let lilist = ulEle.children;
let btnImage = btn.children[0];
//需要用户进行手动点击,怎么解决呢
lilist[0].onclick = itemClick(lilist[0])
if (document.createEvent) {
const event = document.createEvent(... | true |
d06f44a3051929a7a6ea3c52f00cd0170a684f63 | JavaScript | eraynai/dice-roll | /js/main.js | UTF-8 | 1,378 | 4.40625 | 4 | [] | no_license | /*
1. The user clicks a button
2. Generate a random number between 1-6
3. A text line gets printed of a random number
4. An image of the dice that corresponds to the random number is displayed on the screen
*/
//Getting access to the button
let firstButton = document.getElementById('rollBtn');
firstButton.addEvent... | true |
4bfa2b43d4ccbbe8905c8124e514d4b7865f227c | JavaScript | pattern-lab/styleguidekit-assets-default | /src/js/panels-util.js | UTF-8 | 1,738 | 2.671875 | 3 | [
"MIT"
] | permissive | /*!
* Panels Util
* For both styleguide and viewer
*
* Copyright (c) 2013-16 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
* @requires url-handler.js
*
*/
var panelsUtil = {
/**
* Add click events to the template that was rendered
* @param {String} the rendered template for the... | true |
d05a2dfca11482e7512815bd34496adc76f248f2 | JavaScript | chellongCoder/My-React-App | /my-app/src/App.js | UTF-8 | 1,006 | 2.828125 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
const possible = "abcdef0123456789";
var size = 0;
class App extends Component {
constructor(props) {
super(props);
this.state = {
counter: '#000000',
};
}
changeColor() {
var text = "";
for (va... | true |
cb2c1d916dcf9f9cb6a39dbb8fbaa06c18d60850 | JavaScript | soundswarm/evolv | /src/Quiz.js | UTF-8 | 4,232 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import Results from './Results'
class Quiz extends Component {
constructor(props) {
super(props)
this.state = {
checked: false,
onQuestion: 0,
showNext: false,
answers: {
q1: null,
q2: null,
q3: null,
q4: null... | true |
1e2d1d0969998775b8739ccf7f0c6bb3525543cf | JavaScript | meera-ramesh19/codewars | /8kyu/No zeros for heros.js | UTF-8 | 733 | 3.890625 | 4 | [] | no_license |
No zeros for heros
Numbers ending with zeros are boring.
They might be fun in your world, but not here.
Get rid of them. Only the ending ones.
1450 -> 145
960000 -> 96
1050 -> 105
-1050 -> -105
Zero alone is fine, don't worry about it. Poor guy anyway
FUNDAMENTALSNUMBERS
function noBoringZeros(n) {
let str='... | true |
6f514562f6a454c7f57a23cfc0c45c33ef512268 | JavaScript | tanmoyach99/hot-onion | /src/components/lunch/Lunch.js | UTF-8 | 567 | 2.53125 | 3 | [] | no_license | import React, { useState } from 'react';
import foods from '../../fakefoods/foods'
import FoodItem from '../fooditem/FoodItem';
const Hotel = () => {
const foodItem = foods;
const [food,setfood]=useState();
const lunch = foodItem.filter(foods=> foods.categories==="lunch")
console.log(lunch);
... | true |
2959fe5bfd98fd9a0cf5f6725335b91baf1ea68b | JavaScript | DaviFernandoRosa/ReactNativeInfiniteScroll | /App.js | UTF-8 | 1,938 | 2.5625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import { StyleSheet, Text, View, FlatList, ActivityIndicator } from 'react-native';
import axios from 'axios';
export default function App() {
const baseURL = 'https://api.github.com';
const perPage = 10;
const [data, setData] = useState([]);
const [lo... | true |
57017b1cafe7b399510f48168807a8d4774c3a42 | JavaScript | PaulSender/Algorithms | /Real/inversions.js | UTF-8 | 1,001 | 3.84375 | 4 | [] | no_license | // var len = arr.length
// if(len < 3) {
// return 0;
// }
// var count = 0;
// for(var i = 0; i < len - 2; i++) {
// for(var j = i+1; j < len - 1; j++) {
// for(var k = j+1; k < len; k++) {
// if((i < j && j < k) && (arr[i] > arr[j] && arr[j] > arr[k])) {
... | true |
fbf9c897fcf4fe344ef0e952ed53225349ab648a | JavaScript | mazc26/mejuri-pin | /src/utils/parseValue.js | UTF-8 | 212 | 2.671875 | 3 | [] | no_license | export const parseValue = value => {
if (value === "All products") return "shop_all";
const lowerCaseValue = value.toLowerCase();
const parsedValue = lowerCaseValue.replace(" ", "-")
return parsedValue;
} | true |
3ec24267dfb0d08129d65baa2fa53d87e9fae9cb | JavaScript | srivatsahg/JSPlayground | /form/form.js | UTF-8 | 1,094 | 3.640625 | 4 | [] | no_license |
const form = document.querySelector('.form-canvas');
const pattern = /^[a-z]{6,}$/; //pattern to allow atleast 6 lowercase alphabetical characters
const feedback = document.querySelector('.feedback');
const usernamePattern = /^[a-zA-Z]{6,12}$/;
form.addEventListener('submit', e => {
e.preventDefault(); //pr... | true |
5adccfd45bdd63dbf50817448cc2b20cf894dbab | JavaScript | kumaripriya12/my_news_app | /src/Components/Category.js | UTF-8 | 1,276 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
class Category extends Component {
constructor() {
super();
this.state = {
api_url: 'http://newsapi.org/v2/everything?q=',
api_key: '&apiKey=3550598ea63546ec9c5fffbe8c56d531',
news_cat_items: [],
api_param: ''
};
this.f... | true |
cc8b13e83ddc5fc81656bdce86300ab407655962 | JavaScript | SunboX/polyfill | /source/element.prototype.eventListener.js | UTF-8 | 2,699 | 2.890625 | 3 | [] | no_license | // EventListener.js | MIT License | github.com/jonathantneal/EventListener
(function () {
// add
function addEventListener(type, listener) {
var target = this;
registry.unshift({
__listener: function (event) {
event.currentTarget = target;
event.pageX = event.clientX + document.documentElement.scrollL... | true |
35971f021807614237e0d9aebee78fc08e9420a6 | JavaScript | chandu87/javascript-examples | /Advanced-JS/week7_hyf_class/step4.js | UTF-8 | 2,345 | 4.15625 | 4 | [] | no_license | // Step 3: Remove duplicate code using function
/* example:
function getScore(player){
const score = player.digit * player.zone;
return score;
}
*/
// Data
let player1 = {
name: 'Obi',
digit: 27,
zone: 2
}
let player2 = {
name: 'Haseeb',
digit: 71,
zone: 88
}
let player3 = {
name: 'Sirin',
... | true |
d0c467fea3acdff05fa601609a8b6c3bd8ed27c6 | JavaScript | Ghostwill20/Ghostwill20.github.io | /index.js | UTF-8 | 1,590 | 3.953125 | 4 | [] | no_license | // projects html //
//answers
answers0 = "Augusta";
answers1 = "26";
answers2 = "Patriots";
answers3 = "Ps4";
answers4 = "Grovetown";
answers5 = "Tampa";
//
//this is the function to check answers
function checkAnswers() {
answers0 = document.getElementById("question0").value;
answers1= document.getEl... | true |
08c1bcec30aedafd97d14ddaff1663a315a7d50c | JavaScript | DMon-git/CMS-prototype | /public/js/onePost.js | UTF-8 | 1,983 | 2.78125 | 3 | [] | no_license | window.onload = function () {
const searchString = new URLSearchParams(window.location.search);
var id = searchString.get('id');
params = "id="+id;
ajaxPost("/getonepost", params, function(data){
data = JSON.parse(data);
showPost(data);
});
ajaxPost("/getComments", params, function(data){
data = JSON.pars... | true |
9f04f4555effa5074c3e438c4b9f5200627944a3 | JavaScript | jedixo/CP3003_webtech_a2_pong | /Project Source Code/PowerUpClasses/PowerUp.js | UTF-8 | 2,810 | 3.578125 | 4 | [] | no_license | //power up class
/**
* A Power up Class that floats in the arena
*
* @param x the x position of the power up
* @param y the y position of the power up
* @param colour the colour of the powerup, default is "#00FF00"
*/
function PowerUp(x, y, colour, text) {
this.position = {x: x, y: y};
this.radius = 25;... | true |
f91fe9cc00f71b6447187ad971f1a7c0d3d57163 | JavaScript | ambikeshgautam/All_Core_Trainings_Php | /img/Ajax/app.js | UTF-8 | 1,741 | 3.6875 | 4 | [] | no_license | // console.log('Hello Ambikesh How are You?');
// lEts Start XHR - XMLHttpRequest with Text file
// Get Button
const button = document.getElementById('getData');
const jsonBtn = document.getElementById('getJson');
// Click Event
button.addEventListener('click', loadData);
jsonBtn.addEventListener('click', loadJson);
... | true |
d681fca62b474bda035d75dfe89e3237069eb811 | JavaScript | tforsberg/Deadlines | /core/models/script.js | UTF-8 | 673 | 2.578125 | 3 | [] | no_license | var basePath = require('../utils.js').basePath;
/**
*
* @param passedArgs {{src: (*|function()|string|string), type: (*|string), placement: {header: boolean, footer: boolean}}}
* @returns {{src: (*|function()|string|string), type: (*|string), placement: {header: boolean, footer: boolean}}}
* @constructor
*/
modul... | true |
cbab8341d9d2ca04776f7dcd34a91f11dc97553b | JavaScript | leandroluz97/just-do-it | /Hackerrank/Implementation/22_Angry_Professor.js | UTF-8 | 314 | 3.671875 | 4 | [] | no_license | //https://www.hackerrank.com/challenges/angry-professor/problem
//Agry teacher
function angryProfessor(k, a) {
// Write your code here
let count = 0
for (let i = 0; i < a.length; i++) {
if (a[i] <= 0) count++
}
return count <= k ? "YES" : "NO"
}
console.log(angryProfessor(3, [-2, -1, 0, 1, 2]))
| true |
eee80cb7c5a73acf5c0eaf4ef037376ecfa061fa | JavaScript | miikaah/googleMapsElevationApp | /app.js | UTF-8 | 481 | 2.59375 | 3 | [] | no_license | // Port for hosting
var PORT = 4000;
var express = require('express'),
app = express(),
router = express.Router();
app.use(router);
app.use(express.static(__dirname + '/app')); // Route for a static folder
app.listen(PORT);
console.log('Serving on port: ' + PORT);
// Route that binds all routes to send the ... | true |
446672fe84fde87f108df4ea53b3854b7a0125a4 | JavaScript | dollarkillerx/react_study | /typescript/demo2/dist/item.js | UTF-8 | 2,851 | 3.421875 | 3 | [
"MIT"
] | permissive | "use strict";
function main() {
var my_name = "dollarkiller";
console.log(my_name);
var p = sayHello("hello world");
console.log("" + p);
var user = [0, 12, 123];
// sayHello(user);
var a = "st";
console.log('a ', typeof a);
console.log('s1: ', lhlx("hello world"));
console.log(... | true |
cdba035f0c73bae25e94fd2b6d084964cde9247d | JavaScript | mujicapm/ToDoList | /src/User/Login.js | UTF-8 | 799 | 2.5625 | 3 | [] | no_license | import React, { useState } from "react";
export default function Login({ dispatchUser }) {
const [username, setUsername] = useState("");
function handleUsername(evt) {
setUsername(evt.target.value);
}
return (
<form
onSubmit={(evt) => {
evt.preventDefault();
dispatchUser({ type:... | true |
361d26cd8bfe82f00592d8fd6bd977f404da54bc | JavaScript | pumpkinpietea/facebookMessengerBot | /app.js | UTF-8 | 2,738 | 2.859375 | 3 | [] | no_license | // Comments
'use strict';
// [START gae_node_request_example]
// set valiables
const PAGE_ACCESS_TOKEN = 'hogehogehoge'; // Your PAGE_ACCESS_TOKEN. Facebook provide us on developer site.
const VERIFY_TOKEN = 'hogehogehoge'; // Your verify token. Should be a random string.
// Imports dependencies and set up http serv... | true |
f5b9f2d51ba25ec632de37c375ef2cea114473bc | JavaScript | nicabee/Game-Dev-Animation | /js/app.js | UTF-8 | 5,102 | 3.109375 | 3 | [] | no_license | var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var sprChar;
var image = new Image();
image.src = 'img/test3.png';
image.onload = function() {
sprChar = new player({
gameWidth: canvas.width,
gameHeight: canvas.height,
image: image,
spritesheetWidth... | true |
a2480c196a4abe3eb7d07249bb5bdd59d526cfd2 | JavaScript | redbubble-ash/JS | /Nov14/HackerSpeak.js | UTF-8 | 471 | 3.328125 | 3 | [] | no_license | /*
H4ck3r Sp34k
https://edabit.com/challenge/cada8J3AWGRhwQhkk
*/
function hackerSpeak(str) {
return [...str].map(x=>{
if(x=='a')return 4;
if(x=='e')return 3;
if(x=='i')return 1;
if(x=='o')return 0;
if(x=='s')return 5;
return x;
}).join('');
}
// Community solution
// function hackerSpeak(str) {
// ... | true |
9b5235d12dfcd691fd7d26d61965a5580a82fed7 | JavaScript | st-user/ojm-drone-client-js-lib | /src/common/DOM.js | UTF-8 | 3,201 | 2.9375 | 3 | [
"MIT"
] | permissive | const on = (element, eventName, handler) => {
if (Array.isArray(element)) {
element.forEach(e => e.addEventListener(eventName, handler));
} else {
element.addEventListener(eventName, handler);
}
};
let isWindowKeyupEventPrevented = false;
let isWindowKeydownEventPrevented = false;
export ... | true |
dceed5ce17f16e62ad8a14d4e55291219ac3c5c6 | JavaScript | VincentWijshoff/Fractals | /src/eventlistners.js | UTF-8 | 1,130 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2021 Vincent Wijshoff
document.getElementById("startalgorithm1").onclick = () => {
document.getElementById("mainoption").innerHTML = document.getElementById("startalgorithm1").textContent;
};
document.getElementById("startalgorithm2").onclick = () => {
document.getElementById("mainoption").inn... | true |
2fd99d00f36eeab1b7eb2e3d7300af9e6b557036 | JavaScript | OnlineRegistSystem/OnlineRegist | /OnlineRegist/src/main/webapp/source/js/search.js | UTF-8 | 4,709 | 2.53125 | 3 | [] | no_license | $(function(){
/*用户选择医院/科室/疾病选项*/
var searchType,
searchText;
/*将window.name传递到search页面,解析查询字符串*/
/*第一次跳转到search页面时,模拟用户点击*/
if(window.name){
$('#head-submit').one('click', function(event, a){
var r = getQueryStringArgs(window.name);
/*attr('selected', true);写成attr('select', 'selected');是错误的*... | true |
0a3c812119e402f2af569a352cbb51f34aab3bf6 | JavaScript | NicolasTrucco/books | /books.js | UTF-8 | 3,542 | 3.375 | 3 | [] | no_license | let myLibrary = [];
function Book(title, author, pages, read) {
this.title = title
this.author = author
this.pages = pages
this.read = false
}
//Add Book Button
const addBookButton = document.getElementById('add-book');
addBookButton.addEventListener("click", openForm);
function openForm(){
... | true |
c08b25f8d97633593e37c18c07a7f42b5cd1a4a5 | JavaScript | Cookeke/Learn-leetcode | /剑指offer/1.二维数组中的查找.js | UTF-8 | 478 | 3.984375 | 4 | [] | no_license | // 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
function Find(target, array) {
return array.some(item1 => item1.some(item2 => item2 === target))
}
console.log(Find(7, [[1, 2, 8, 9], [2, 4, 9, 12], [4, 7, 10, 13], [6, 8, 11, 15]]))
| true |
0a5d2e8e99a8e9e1fb7e5560a190d70af21e69af | JavaScript | ruffchain/RuffVM | /DemoApp/contract/test/test.js | UTF-8 | 2,225 | 2.5625 | 3 | [
"MIT"
] | permissive | const assert = require('assert')
const { createScript } = require('../../../index.js')
const BigNumber = require('bignumber.js')
describe('Contract Test', function() {
it('could load and run contract', async () => {
let isATriggered = false
let isBTriggered = false
const sandbox = {
transferAInHost... | true |
5697a15b747a0f70a95775167f748f81d952b05f | JavaScript | georgecoello/ProyectoAED | /ListaAlmacen.js | UTF-8 | 1,038 | 3.390625 | 3 | [] | no_license | function Caja(valor){
this.valor = valor;
this.siguiente = null;
}
function ListaEnlazadaAlmacen(){
this.primero = null;
this.agregarCaja = ListaEnlazadaAgregarCaja;
this.esVacia = ListaEnlazadaEsVacia;
this.verContenidoAlmacen = ListaEnlazadaVerContenidoAlmacen;
}
function ListaEnlazadaEsV... | true |
341905d3784b110888369d52cb1240347a4cd43b | JavaScript | leechwin/algorithm | /programmers_17678_셔틀버스/solution.js | UTF-8 | 1,209 | 3.515625 | 4 | [
"MIT"
] | permissive | /**
* https://programmers.co.kr/learn/courses/30/lessons/17678
*/
function solution(n, t, m, timetable) {
const bus = [];
// 버스시간표를 분으로 변환
for (let i = 0; i < n; i++) {
bus.push(540 + (i * t));
}
// 탑승자들 시간을 분으로 변환 후 정렬
const people = timetable.map((x) => ((x.split(":")[0] * 60) + (x.... | true |
f485e03708754f83ca5042abdd2699268e668ca9 | JavaScript | dolev146/APIJSVER1 | /components/home/infoclick.js | UTF-8 | 1,663 | 3.015625 | 3 | [] | no_license | // import getAjax from "./Ajax.js"
// import CreateMoreInfoFunction from "./createmoreinformationfunction.js"
// import fromlocalstorage from "./fromlocalstorage.js"
// export function infoclick() {
function infoclick() {
function runRegular() {
let Coinid = event?.target?.id;
let link = "https://a... | true |
a30aacd4bf9c1972c50387380fde7d213b53e4f3 | JavaScript | OneCommunityGlobal/hgn | /HGNApp/app/components/hgn-tabs.js | UTF-8 | 1,747 | 2.546875 | 3 | [] | no_license | import Ember from 'ember';
import ChartMixin from './../mixins/chart';
export default Ember.Component.extend(ChartMixin, {
//Horizontal bar chart
drawData: function() {
// var color = '#FDFEFE';
var data = this.get('data');
//var height = this.get('chartHeight');
//var width = this.get('chartWidth')... | true |
175243a002f23729f1690868bc00753157a04aa1 | JavaScript | d3vkk/google-hashcode-2021 | /create-combinations/convertToObject.js | UTF-8 | 458 | 2.734375 | 3 | [
"MIT"
] | permissive | const ingredients = [
["onion", "pepper", "olive"],
["mushroom", "tomato", "basil"],
["chicken", "mushroom", "pepper"],
["tomato", "mushroom", "basil"],
["chicken", "basil"],
];
module.exports = () => {
const newIngredients = [];
for (let l = 0; l < ingredients.length; l++) {
newIng... | true |
b2df3185d38c6d9618a05d53aa2c43c4fa59d5fa | JavaScript | w7989363/leetcode | /3sum.js | UTF-8 | 1,003 | 3.78125 | 4 | [] | no_license | // 15 Array medium
/**
* @param {number[]} nums
* @return {number[][]}
*/
var threeSum = function(nums) {
nums.sort((a, b) => a - b)
const ret = []
for (let i = 0; i < nums.length; i++) {
// 找到第一个与左边不同的数字
while (nums[i] === nums[i-1]) i++
if (nums[i] > 0) break
// 从右边的数组中寻找
let left = i+1,... | true |
00e5ec8458c19ea48fea20bbf19eeb372b7456be | JavaScript | Sage/streamline-runtime | /src/builtins._js | UTF-8 | 11,469 | 2.796875 | 3 | [
"MIT"
] | permissive | /**
* Copyright (c) 2012 Bruno Jouhier <bruno.jouhier@sage.com>
* MIT License
*/
/// !doc
///
/// # Streamline built-ins
///
(function (exports) {
"use strict";
var VERSION = 3;
var future = function (fn, args, i) {
var err, result, done, q = [],
self = this;
args = Array.prototype.slice.call(args);
... | true |
ac1cc865c9d9b89d1b333350fc0977e585612dc6 | JavaScript | Diktas/itakademija-2016-exam-final | /react-exam/target/classes/static/js/components/books_list_component.jsx | UTF-8 | 2,287 | 2.734375 | 3 | [] | no_license | var BooksListComponent = React.createClass( {
render: function() {
var self = this;
var booksList = this.props.books.map( function( book, index ) {
// published date
var d = new Date( book.publishedAt );
var year = d.getFullYear();
var month = d.getMo... | true |
a240e9a5be459cecf4b0824a8dace4ae6b8f86b0 | JavaScript | jixingLiu/three.js.sourcecode | /src/objects/Line.js | UTF-8 | 6,483 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | /**
* @author mrdoob / http://mrdoob.com/
*/
/*
///Line对象,创建一条线,或者一组线.
/// 用法:var geometry = new THREE.Geometry(); //创建geometry对象
/// var material = new THREE.LineBasicMaterial({color: 0xffff00}); //创建材质对象,这里有专门适用于line对象的材质对象LineBasicMaterial.
/// geometry.verteces.push(new THREE.Vector3(-10,0,0), //为geometr... | true |
e3cb0ea7dc8392bc252b65f95b39a382464cccf0 | JavaScript | anneraev/Contact-List | /src/scripts/components/contacts/contactList.js | UTF-8 | 986 | 2.609375 | 3 | [] | no_license | import HTML from "../../global modules/htmlBuilder"
import contact from "./contact";
import domManager from "../../global modules/domManager";
let contactSection
export default {
assemble: function (contacts) {
//create header
contactSection = HTML.elementBuilder("section", "display--contacts");
... | true |
684d29d61b527fcd01f136e4613eebb64b3f0563 | JavaScript | TheNextUchiha/node-todo-api | /playground/hashing.js | UTF-8 | 351 | 2.515625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
const bcrypt = require('bcryptjs');
var password = '123abc';
// bcrypt.genSalt(10, (err, salt) => {
// bcrypt.hash(password, salt, (err, res) => {
// console.log(res);
// });
// });
var hashedPass = '$2a$10$fJXXeDgkYH3baQvGSTVequ/9JfmaqeDhwN6KvwS9yNr/QBLGSW.6a';
... | true |
0591dbe08a7c1a0ecf4c2c3bdc18f4b93917849c | JavaScript | DanRezo/JSCalc | /spec/test.js | UTF-8 | 9,457 | 3.0625 | 3 | [] | no_license | console.log("LOADED TEST FILE")
describe("Calculator Test Suite", function() {
describe("1 : Build an HTML table to represent your calculator", function() {
it("There is a table", function() {
var numTables = document.getElementsByTagName('table').length;
expect(numTables).to.equal(1);
});
... | true |
330e7d44663c5e0b6f5b6e62f4fc3e2c6713210f | JavaScript | JulianaMac/reprograma-atividades-javascript | /arrays/array2.js | UTF-8 | 98 | 3.609375 | 4 | [] | no_license | const arr = [1,2,3,4,5,6]
for (i = arr.length - 1; i >= 0; i--){
console.log(arr[i])
}
| true |
4493571af365ac12709625df713fd30188f04ed8 | JavaScript | vjrodriguez/Algorama | /gameTheory/whichWordsExist.js | UTF-8 | 17,253 | 3.765625 | 4 | [] | no_license | /* eslint-disable complexity */
/*
Given a 2D board and a list of words from the dictionary, find all words in the board.
Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than on... | true |
1b63b207a8f6f594e98213720657e955d5666e5d | JavaScript | tarkazsofi/javascript-essentials | /round-to-closest-five.js | UTF-8 | 309 | 3.625 | 4 | [] | no_license | const roundToClosestFive = (amount) => {
const divided = amount / 5;
const rounded = Math.round(divided);
return rounded * 5;
};
console.log(roundToClosestFive(10)); // Should output 10
console.log(roundToClosestFive(22)); // Should output 20
console.log(roundToClosestFive(33)); // Should output 35
| true |
9039830a2edcec1b701bc2035b0cc75170586f20 | JavaScript | pedronicolas/EjerciciosNode | /BABEL/BABEL-11.js | UTF-8 | 172 | 2.5625 | 3 | [] | no_license | var inputs = process.argv.slice(2);
var result = inputs.map((elem)=> elem[0] )
.reduce((vAnt,vAct) => vAnt + vAct, "" );
console.log(result); | true |
38f190c095065279f7a0169ea5a97d1410f8603c | JavaScript | Cvqtko/JavaScript-Advanced | /01 JS Syntax, Functions and Statements/exercise_06.js | UTF-8 | 120 | 3.046875 | 3 | [] | no_license | function solve(input = 5) {
for (let i = 1; i <= input; i++) {
console.log('* '.repeat(input))
}
}
solve(); | true |
d49f8731d5373cfd24ae62342b747623216051c0 | JavaScript | altair4ik/OrksAttack | /js/game.js | UTF-8 | 8,914 | 2.984375 | 3 | [] | no_license | // A cross-browser requestAnimationFrame
// See https://hacks.mozilla.org/2011/08/animating-with-javascript-from-setinterval-to-requestanimationframe/
var requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFram... | true |
0fbc34cd5808e71a0be409f9499916c281bb8485 | JavaScript | DataUnion-app/react-annotate | /dist/KeyframeTimeline/get-time-string.js | UTF-8 | 588 | 3.1875 | 3 | [
"MIT"
] | permissive | var getTimeString = function getTimeString(ms) {
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
if (ms < 1000) {
return ms + "ms";
} else {
var secs = ms / 1000;
if (secs < 60) {
if (Number.isInteger(secs)) {
return secs + "s";
} else {
... | true |
46be12c319d77d9c001a592938662da4bad190e2 | JavaScript | ordermentum/async-iterator-pg-cursor | /index.js | UTF-8 | 1,418 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | const crypto = require('crypto');
const nullLogger = require('null-logger');
const generateName = (prefix) => `${prefix}_${crypto.randomBytes(16).toString('hex')}`;
class Cursor {
constructor(client, query, { logger = nullLogger, name = null, size = 1000 } = {}) {
this.client = client;
this.query = query;
... | true |
27a9fe40e48eec78c5a8d58f24ed34444d1bd890 | JavaScript | fogine/couchbase-odm | /lib/key/refDocKey.js | UTF-8 | 4,289 | 2.796875 | 3 | [
"MIT"
] | permissive | const util = require('util');
const Promise = require("bluebird");
const Key = require("./key.js");
const _ = require('lodash');
const KeyError = require("../error/keyError.js");
module.exports = RefDocKey;
/**
*
* RefDocKey
*
* @constructor
* @extends Key
*
* @throws KeyError
*
* @param {O... | true |
873a31c3ae8cb557f7c0666b748780d53ada701b | JavaScript | mehstruslehpy/Documents | /Javascript/ideaScriptpad2/scriptPad.js | UTF-8 | 491 | 2.953125 | 3 | [] | no_license | var bogus = 0;
var text;
var cont = prompt();
var cont = alert("0.0");
console.log(text);
console.log("hey");
while(cont != "1")
{
var text = document.getElementById("hello");
var cont = alert(".");
text.innerHTML = "WOOOOOOOOOOOOOOOOOOO";
var cont = alert("!!!");
text.innerHTML = "WAAAAAAAAA";
... | true |
0b91ba7f505b075b197b72d0a050540c21865052 | JavaScript | guptame2007/hammers | /Hammer.js | UTF-8 | 672 | 2.703125 | 3 | [] | no_license | class Hammer
{
constructor()
{
this.bodyX = x;
this.bodyY = y;
this.bodyH = 50;
this.bodyW = 50;
this.Body = Bodies.rectangle( this.bodyX ,
this.bodyY,
this.bodyH ,
this.bodyW ,options)
World.add(myWorld , thi... | true |
81af092565ada97817172f5f02af94af1a22c794 | JavaScript | DEGEL-USherbrooke/Mobile | /BL/storageHelper.js | UTF-8 | 619 | 2.546875 | 3 | [
"MIT"
] | permissive | import { AsyncStorage } from 'react-native';
class StorageHelper {
static async set(name, value) {
if (value === undefined || value === null) {
console.log('#StorageHelper.set cannot save key ' + name + ' because it is undefined or null. Aborting.');
return;
}
item = await AsyncStorage.getIt... | true |
5d69179f4490dca4c9b8a301264004185c352cba | JavaScript | sparticle999/SpaceCompany | /building.js | UTF-8 | 3,138 | 2.71875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | Game.buildings = (function(){
var instance = {};
instance.dataVersion = 1;
instance.entries = {};
instance.updatePerSecondProduction = true;
instance.techTypeCount = 0;
instance.initialise = function() {
for (var id in Game.buildingData) {
var data = Game.buildingData[id];... | true |