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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b6a6ff39c2c4fd8b41e4ba5fa9596fd7a8f3a528 | JavaScript | 549869500/EarthCoin-API | /lib/getIndex.js | UTF-8 | 1,852 | 2.59375 | 3 | [] | no_license | var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var hash;
var index;
/*
function getBlockCount(callBack) {
// read block height from the block explorer
var request = "https://chainz.cryptoid.info/eac/api.dws?q=getblockcount";
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", reque... | true |
ee8bd085515b09961256f4d9ec45c84036b73938 | JavaScript | stellarwaves/DeathStar | /js/game.js | UTF-8 | 2,878 | 3.140625 | 3 | [] | no_license | 'use stict'
class Game {
constructor(canvas){
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
this.player;
this.enemies = [];
this.lasers = [];
this.isGameOver = false;
this.score = 0;
}
startLoop () {
this.player = new Player(this.canvas, 1);
... | true |
e72aa58b04a941f5c74f54f489d7d974c2887f3e | JavaScript | gnufied/tryc3 | /plot.js | UTF-8 | 1,198 | 2.90625 | 3 | [
"MIT"
] | permissive | var PlotChart = function() {
var that = this;
this.counter = 0;
_.bindAll(this, 'updateChart');
};
PlotChart.prototype.plotChart = function() {
var config = {};
config.bindto = '#chart';
config.data = {};
config.data.keys = {"x":"x","value":["data1"]};
config.data.json = [];
for(i = 0; i < 10; i++) {... | true |
e90072b6b598ca1fcec0ccbfa4ac48ac5c0c934f | JavaScript | hjdesigner/css-quiz | /src/scripts/css-quiz.js | UTF-8 | 4,170 | 3.09375 | 3 | [
"MIT"
] | permissive | (function () {
'use strict';
const beginner = [
{
question: "Iniciante?",
answers: {
a: '3',
b: '5',
c: '115'
},
correctAnswer: 'b'
},
{
question: "What is 30/3?",
answers: {
a: '3',
b: '50',
c: '10'
},
corre... | true |
654cd397799e9b2c82f55f298d56957d354dc2ec | JavaScript | pontura/yqs | /js/qo.js | WINDOWS-1250 | 2,669 | 2.640625 | 3 | [] | no_license | var qo = (function(){
var config;
var selCandidate = -1;
var selQuestion = -1;
var candidates;
var questions;
var candidatesSel;
var navPos=0;
var correctAns=0;
var summaryDone=false;
function setOptions(){
let html = "";
for(let i=0;i<candidatesSel.length;i++){
html+="<div class='qo_option'><button... | true |
30aaadc0829e7c0371fa032bc0190c36815597dd | JavaScript | Simuratli/Random-Meal-Generator | /src/pages/IngredientSearch/IngredientSearch.jsx | UTF-8 | 1,052 | 2.546875 | 3 | [] | no_license | import React,{useEffect,useState} from 'react'
import Chekbox from '../../components/Checkbox/Chekbox'
import './IngredientSearch.css'
import axios from 'axios'
function IngredientSearch() {
const [state, setstate] = useState({
data:null,
loading:true
})
useEffect(() => {
axios.g... | true |
37fdeba95df92c0f9576caa47a0bf6ffd049931e | JavaScript | farrokhdev/slider | /src/App.js | UTF-8 | 827 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import data from './data';
import { Slider } from './components/Slider';
function App() {
const[people,setPeople]=useState(data);
const[index,setIndex]=useState(0);
useEffect(()=>{
const lastIndex = people.length-1;
if(index<0){
setIndex(lastIndex... | true |
823d5d138e0d030c4d9eadbcbe43db1341380c56 | JavaScript | javikachuka/RunCoin-Fronted | /src/components/Game/ProgressBar/ProgressBar.js | UTF-8 | 4,833 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { transformSecondsToHuman } from "../../../utils/transformSecondsToHuman";
import { transformAddress } from "../../../utils/transformAddress";
import { useLogin } from "../../../hooks/useLogin";
import {
BarRow,
PlayerId,
GameBar,
Bar,
TimeBar,
} from... | true |
ec4b2c2bbc8d078bcb9257425a90582606df18a7 | JavaScript | yidongwuxian/firstSeajsDemo | /js/slide-plugin2.js | UTF-8 | 6,200 | 2.546875 | 3 | [] | no_license | define(function(require, exports, module) {
/**
* @author lxm
* @exception $(selecter).imgSlide({
* showBtns : true,// 是否显示btns showClickBtns : false,// 是否显示切换按钮
* showText : false,// 是否显示text showTextSize : 4,// 显示字符个数
* switchTime : 4500,//切换时间 onImgStop : false//鼠标经过... | true |
b7d13a88d3f879773cba70fbe5805715dfd310b4 | JavaScript | warnerak/triviagame | /assets/javascript/app.js | UTF-8 | 4,493 | 3.46875 | 3 | [] | no_license | // initialize the .js document with this. It contains all of the code for the .js file:
$( document ).ready(function() {
// this game object holds all of the questions, possible answers, and then the index of the correct answer for each
var game = {
questions: [
{
qu... | true |
6d2325d01370bb9c4d175041ba2871d56cb88702 | JavaScript | mauricioTechDev/daily-code-wars | /split_string.js | UTF-8 | 1,001 | 4.21875 | 4 | [] | no_license | Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore ('_').
Examples:
solution('abc') // should return ['ab', 'c_']
solution('abcdef') // should retur... | true |
50b0f83a81ee7380488fb6fafd8455556fafebd8 | JavaScript | shaninoyman/twitter | /routes/tweets.js | UTF-8 | 2,946 | 3.078125 | 3 | [] | no_license | let express = require('express')
let router = express.Router()
let Tweet = require('../models/tweet')
let subscribersRouter = require('./subscribers')
// Post a tweet
router.post('/', async (req, res) => {
let username = req.body.username
let password = req.body.password
let content = req.body.content
... | true |
c0d6d39c0a0c460bed8db5007e5a07ba1b539a39 | JavaScript | B4bharat/js_weirdParts_tuts | /execution_stack/script.js | UTF-8 | 1,836 | 5 | 5 | [] | no_license | /*
The key fundamental to understand here is that functions create its own execution context with it's own memory space for variables
As soon as a function is invoked it creates it's own execution context and is put to the top of the execution stack.
So when below function a is invoked, the code below the invocation... | true |
0c824a0db4c02c76c2cb73c399d68b10d54e36f3 | JavaScript | Yong-Hsu/Yong-Hsu.github.io | /docs/matcap/matcap.js | UTF-8 | 8,912 | 2.640625 | 3 | [] | no_license | /** @type {WebGLRenderingContext} */
var gl;
var program;
// import object
var g_objDoc = null; // The information of OBJ file
var g_drawingInfo = null; // The information for drawing 3D model
var angle = 0;
var orbit = true;
// init();
$(function() {
// jquery for loadingt the links
$.get("/matcap/index.json", fu... | true |
cd075eaa96f4366cf89ccf511d342273c30b1952 | JavaScript | hanseneg/js-quiz | /server.js | UTF-8 | 5,561 | 2.828125 | 3 | [] | no_license | const express = require("express")
const app = express()
const mongoose = require("mongoose")
const morgan = require("morgan")
//heroku
const path = require("path")
const PORT = process.env.PORT || 5000
//"mongodb://localhost:27017/jsQuizApp"
mongoose.connect(process.env.MONGODB_URI,
{
useNewUrlParser: tr... | true |
db21d0178b255603f524a8428b6c5a11038ed714 | JavaScript | chjawad9/Jd_Ecommrece-Website | /js/project.js | UTF-8 | 3,423 | 2.765625 | 3 | [] | no_license | // scrol or navbar
$(document).ready(function () {
$(window).scroll(function () {
$(window).scroll(function () {
$('nav').toggleClass('scrolled', $(this).scrollTop() > 50);
});
if (this.scrollY > 500) {
$('.scroll-up-btn').addClass("show");
} else {
... | true |
a367006b5fdfa3b66b490a450189b80b9e00b783 | JavaScript | jsjaspreet/epi-in-es6 | /EPI/util/BinaryTreeWithParent.js | UTF-8 | 318 | 2.84375 | 3 | [] | no_license | class BinaryTreeWithParent {
constructor(data) {
this.parent = null
this.data = data
this.left = null
this.right = null
}
addLeft(node) {
this.left = node
node.parent = this
}
addRight(node) {
this.right = node
node.parent = this
}
}
module.exports = BinaryTreeWithParent | true |
8ac927b4f5c44e077bc20607ea1d7c79918044d3 | JavaScript | ahartung/XNATImageViewerTesting | /scripts/XVWidget/ThreeDHolder/functions/slicer/extractCamera.js | UTF-8 | 249 | 2.78125 | 3 | [] | no_license |
extractCamera = function(scene) {
var pos = scene.getElementsByTagName('Camera')[0].getAttribute('position').split(' ');
for (var i = 0; i < pos.length; ++i) {
pos[i] = parseFloat(pos[i], 10);
}
return pos;
} | true |
408d25ec7a9e24aa025fcccd6e50deb998e98581 | JavaScript | njericooper/Code-Challenges | /FastFoodApp/assets/scripts/fastFoodApp.js | UTF-8 | 458 | 3.1875 | 3 | [] | no_license | function buttonPress(){
return document.getElementById("sendOrder").addEventListener("click", newOrder());
}
function newOrder() {
var order = document.getElementById("orderBox").value;
alert("You ordered:" + order);
}
const inventory = {
grass: 20,
kale: 20,
fries: 23,
spinach: 16,
};
... | true |
ba82f9675b8b22ab7329943053d6b96ece860d82 | JavaScript | HoloZetta/Our-World-OASIS-API-HoloNET-HoloUnity-And-.NET-HDK | /NextGenSoftware.OASIS.API.ONODE.WebUI.HTML/wwwroot/_old/js/login.js | UTF-8 | 10,071 | 2.734375 | 3 | [
"MIT"
] | permissive | var loggedIn;
if (loggedIn) {
console.log("LOGGED IN!");
document.getElementById("loggedInUser").innerText = "Logged In: david@nextgensoftware.co.uk";
document.getElementById("loggedInUser").style.display = "block";
document.getElementById("LogInButtons").style.display = "none";
} else {
console.log("NOT LOGGED I... | true |
c711e87de533b356b6b9c09f48439ba14df195f1 | JavaScript | vigneshnadar/MEAN-Stack | /setTimeout.js | UTF-8 | 136 | 2.640625 | 3 | [] | no_license | console.log("1: Start app");
var wait = setTimeout(function() {
console.log("in the setTimeout");
}, 1000);
console.log("3: End app"); | true |
9746857a4365839fd81dc4d2b66183b63b0f03c0 | JavaScript | louiscklaw/ai-playlist | /poe-tryout/docker-poe-tryout/src/openbox-poe-seat/src/utils/google-palm.js | UTF-8 | 5,088 | 2.546875 | 3 | [] | no_license | const chalk = require('chalk');
var assert = require('chai').assert;
async function clearModalBox(page) {
// NOTE: clear modal box if any
console.log('clear modal box');
await page.waitForTimeout(1 * 1000);
await page.evaluate(() => {
try {
document.querySelector('.ReactModal__Content').style.displ... | true |
866b522110334531ea06f6d9ac1655f0873fe409 | JavaScript | cjmckee/ProjectPaige | /JavaScript/paige.js | UTF-8 | 1,172 | 2.9375 | 3 | [] | no_license | /*
Trying to make some sort of passwordless login page
*/
getFace('http://i.imgur.com/paPde5e.jpg').then(function(response) {
console.log(response);
}), function(error) {
console.log("Something went wrong", error);
}
/*
Returns faceId plus some more info as a JSON object assuming url for image
*/
function get... | true |
76c6d56d19939df5393d5b39d4328b3cf1682a06 | JavaScript | jessikuh/burger-builder | /src/components/Order/Order.js | UTF-8 | 980 | 2.546875 | 3 | [] | no_license | import React from 'react';
import classes from './Order.module.scss';
const order = (props) => {
const { ingredients, price } = props;
const ingredientsArray = [];
Object.keys(ingredients).forEach((ingredient) => {
ingredientsArray.push({
name: ingredient,
amount: ingredients[ingredient],
... | true |
e8e83b16fec736cf1ff081712cae659bda1fb258 | JavaScript | bencoz/Taki-Game-v1 | /js/UI.js | UTF-8 | 11,869 | 2.65625 | 3 | [] | no_license | function UI() {
this.endTurn;
//document.getElementById('deck').addEventListener('click',this.takeCa());
this.init = function () {
},
//display update
this.createStartButton = function () {
},
this.popUpShow = function(callback) {
document.getEleme... | true |
4152fa8c1f4324d667aed25514bb5ede9a54d239 | JavaScript | jlittle576/jlittle576.github.io | /js/top.js | UTF-8 | 1,010 | 2.515625 | 3 | [
"MIT"
] | permissive | function toggle(elementId) {
var ele = document.getElementById(elementId);
if(ele.style.display == "block") {
ele.style.display = "none";
}
else {
ele.style.display = "block";
}}
function hide(elementId) {
var ele = document.getElementById(elementId);
ele.style.display = "none";
}
function load(example, path) {
var ele... | true |
96c2492bf8bc3f197088edf6d79fd002408a8d40 | JavaScript | ngmars/RBAC-frontend | /src/Store/Reducers/approvePlot.js | UTF-8 | 1,256 | 2.578125 | 3 | [] | no_license | import * as actionTypes from '../Actions/ActionTypes/actionTypesCreatePlot';
import { updateObject } from '../../shared/utility';
const initialState={
PlotApprovals:[],
successMessage: null,
errorMessage: null,
loading:null,
}
const PlotApprovalStart = ( state, action ) => {
console.log("IT HAS STA... | true |
48cc87b2ff35d04633a22fe08ac0deac4ec18965 | JavaScript | tonomb/reducer-todo | /todo/src/reducers/taskReducer.js | UTF-8 | 869 | 3.03125 | 3 | [] | no_license |
export const initialState = [{
title: 'The tasks you add will be displayed here',
completed: false,
id: 1
},
{
title: 'Click on a task to mark as completed',
completed: true,
id: 2
}]
export const reducer = (state, action) => {
switch(action.type){
case 'NEW_TODO':
retu... | true |
4717db55e7dc8604eeccbda31a1cfde15cbbfea3 | JavaScript | liuxt57/Web2.0 | /hw07_tablesorter/source-code/table-sorter/sorter.js | UTF-8 | 1,680 | 2.6875 | 3 | [] | no_license | $(document).ready(function(){
var as=false;
$("th").each(function(){
$(this).click(function(){
if(!($(this).hasClass("ascend") || $(this).hasClass("descend")))
as=false;
var tableObject=$(this).parents("table");
tableObject.find("th").removeClass("asce... | true |
15d80a477729adcd60c87939060f840f4d3f3d4b | JavaScript | RicardoOno/Gateway-nodeJS | /cardfast/routes/cartoes.js | UTF-8 | 1,368 | 2.578125 | 3 | [] | no_license | module.exports = function (app) {
app.post('/cartoes/autoriza', function (req, res) {
req.assert(
"numero", "Forma de pagamento é obrigatorio"
).notEmpty();
var cartao = req.body;
//numero, bandeira, ano_de_expiracao, mes_de_expiracao, cvv
var erros = req.v... | true |
d67669e07b385c838e07fb7ad005a254ff354da8 | JavaScript | zhlovejie/js-demo | /lanfan-webpack/src/test.js | UTF-8 | 157 | 3.015625 | 3 | [] | no_license | let test = [1, 2, 3].map((val) =>val * 2)
let delay = (ms) =>{
return new Promise((resolve,reject) =>{
setTimeout(resolve(123),ms)
})
}
delay(200) | true |
0bf2c41962bed3c0c99a0b57afc4c5ff49fae766 | JavaScript | arhamabeer/Calculator-in-React-JS | /src/App.jsx | UTF-8 | 3,820 | 3.0625 | 3 | [] | no_license | import "./App.css";
import { useState } from "react";
function App() {
const [txt, setTxt] = useState("");
const [res, setRes] = useState("");
var btnFunc = (v) => {
// console.log(v)
let num = txt + v;
// console.log(num)
setTxt(num);
setRes("");
};
var calculate = () => {
let res ... | true |
3e6f9d6f2ca23eba052e4dea3bf0d253ee62849c | JavaScript | dannywhy/MLH | /helpers/convertNumbersToWords.js | UTF-8 | 2,162 | 4.125 | 4 | [] | no_license | function numberToWords(age) {
// variable to hold string representation of number
let words = '';
const units = ['zero', 'one', 'two', 'three', 'four', 'five', 'six',
'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve',
'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen',
'eighteen', 'nineteen']... | true |
d1d486d4164458a5dc127d755377615efd963fcc | JavaScript | luthraG/node-validate | /test/isMethodPresent.js | UTF-8 | 4,041 | 3.09375 | 3 | [
"MIT"
] | permissive | var isMethodPresent = require('../validate.js').isMethodPresent,
expect = require('chai').expect;
describe('isMethodPresent API Tests', function () {
describe('Valid tests for isMethodPresent API', function () {
var o = { qwe : { asd : { zxc : 123 } } };
var m = { qwe : 123, dummy : function() ... | true |
82eb586c3a8acd85851bb5c8bba6fd1bc624b706 | JavaScript | KurzyShreder/Formation-Crealead | /JavaScript/variables.js | UTF-8 | 548 | 3.90625 | 4 | [] | no_license | /* création d'une variable var i
affectation de la variable = 12;
le tout est une instruction js qui se termine normalement par ";" */
/* Les types de données en js sont :
- string (chaîne de caractères)
- number (nombres)
- boolean (booleen)
- indifinied (indéfinie)
*/
var i = "12";
i = i + "3"; // concaténation
... | true |
c2e223e22be79b8ce0524e1c5086f02e58e2bce7 | JavaScript | deepjs-net/node-express-realworld-example-app | /src/utils/is.js | UTF-8 | 2,854 | 3.53125 | 4 | [
"MIT"
] | permissive | /*!
* 类型判断
* @dwdjs/utils
*/
/**
* 常用类型判断
* 是否定义 字符串 数字 纯对象 空对象 数组 函数
* 整理参考
* https://github.com/vuejs/vue/blob/dev/src/shared/util.js
* https://github.com/enricomarino/is
*/
const objProto = Object.prototype
const owns = objProto.hasOwnProperty
const { toString } = objProto
// 对象自身属性中是否具有指定的属性
export func... | true |
781720871f0a74d2137f3385322009da219a6c74 | JavaScript | edenreich/Turbo-eCommerce | /src/Components/BaseComponent.js | UTF-8 | 628 | 3 | 3 | [
"MIT"
] | permissive |
/**
* @class BaseComponent
*
* Common functionallity of components.
*/
class BaseComponent
{
/**
* Hides the component from the DOM.
*
* @return void
*/
hide()
{
if (typeof this.element != 'undefined') {
this.element.style.display = 'none';
}
}
/**
* Shows the element on the DOM.
*
*... | true |
ec9efb60702bf9712aa174ef5d32a77d48e4d83b | JavaScript | Sriep/solidity-to-golang | /transpiler/statement-var-declare.js | UTF-8 | 894 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
const assert = require("assert");
module.exports = {
code: function(node, history, parent, localHistory) {
assert(node.type == "VariableDeclaration");
let goCode = "";
assert(node.declarations.length() === 0);
goCode += node.declarations[0].id.name;
goCode ... | true |
db3fdf51288cc9587c25f602b04640137b78ba5d | JavaScript | zelim92/connected-cells | /react-app/src/App.js | UTF-8 | 1,395 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Matrix from './Matrix';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
row: 2,
col: 2,
ans: 0,
};
this.handleRowChange = this.handleRowChange.bind(this);
this.han... | true |
76aacee1fa3fde58e1ac6c938ed37f9c8a5fdcba | JavaScript | OliviaKali/Dev10-WebDevCourse | /JavaScript-Practice/forLoops.js | UTF-8 | 150 | 3.4375 | 3 | [] | no_license | //This equation adds every postive integer
// up to 25
//Example: 1 + 2 + 3 + 4 ... + 25
var sum = 0
for (var n = 25; n > 0; n--) {
sum += n;
}
| true |
cf15abcc18bc04730a0abb664ae55c6a04348752 | JavaScript | DerArvend/fg01-snowflake | /src/LSystem.js | UTF-8 | 897 | 3.515625 | 4 | [
"MIT"
] | permissive | /** Represents simple L-System */
export default class LSystem {
/**
* Create L-System
* @param {Array} axiom - L-System axiom (symbol array)
* @param {object} rule - {symbol: 'symbol', replacement: [symbol1, symbol2...]}
*
*/
constructor(axiom, rule) {
this.axiom = axiom;
... | true |
96d5bc7c71840ffcbccd941d14d314c168b297bf | JavaScript | epasham/MovieBookingSystem | /movie-frontend/src/Services/Auth_service.js | UTF-8 | 1,506 | 2.515625 | 3 | [] | no_license | import axios from 'axios';
// import authHeader from './Auth_header';
// const API_URL = 'https://cors-anywhere.herokuapp.com/http://localhost:8080/';
const API_URL = 'http://localhost:8080/';
class AuthService {
// not sure about the token of response data
// just temporarily named it as 'accessToken... | true |
7faec4d6e6a2705fc9e8c4aaec557eafe0529f46 | JavaScript | buddyeorl/theThingie | /app/routes/api.js | UTF-8 | 966 | 3.109375 | 3 | [
"MIT"
] | permissive |
$(".submit").on("click", function(){
// Here we grab the form elements
var newReservation = {
customerName: $('#reserve_name').val().trim(),
phoneNumber: $('#reserve_phone').val().trim(),
customerEmail: $('#reserve_email').val().trim(),
customerID: $('#reserve_uniqueID').val().trim()
};
console... | true |
adf9fa8c3d6709cfee5441e343d5fc16ceb6cb7f | JavaScript | bmeritter/collection-calculate-camp | /practices/section_2/practice_1/practice.js | UTF-8 | 303 | 2.9375 | 3 | [] | no_license | function count_same_elements(collection) {
let result = [];
collection.forEach(item => {
let exit = result.find(r => r.key === item);
if (exit) {
exit.count++;
} else {
result.push({key: item, count: 1});
}
});
return result;
}
module.exports = count_same_elements;
| true |
709bbc9d5da3ef23d4f52ce1f495a5c8ea8dcc1c | JavaScript | flockonus/eth-denver-2019 | /radical-city-react/src/utils/grid.js | UTF-8 | 621 | 2.96875 | 3 | [] | no_license |
// Creates an object that represents the grid, where each tile is a key
export function createGridModel(dim) {
const grid = {};
for (let y = 0; y < dim; y++) {
for (let x = 0; x < dim; x++) {
const id = `${x}-${y}`;
grid[id] = {
id,
x,
y,
price: 1,
owner: '0x... | true |
048ea68f466442c4de0479b4d51640a8e4b4d7f1 | JavaScript | juzen2003/Practice-JS | /bfs/279_perfectSquares.js | UTF-8 | 1,546 | 3.875 | 4 | [] | no_license | /**
* @param {number} n
* @return {number}
*/
// BFS, each level is perfect square numbers
// see how many level of (least number) perfect square numbers we need to sum up to n
// use dp[i] to keep track of the least number of perfect square numbers that sum to i
var numSquares = function(n) {
let queue = [];
le... | true |
8444553be372b86573cf66d37d783ca58af8e800 | JavaScript | alessioiaretti/Verifica20200203 | /routes/people.js | UTF-8 | 871 | 2.71875 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var createError = require('http-errors');
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Utenti' });
});
router.get('/people', function(req, res, next) {
res.send(TuttiUtenti());
});
router.get('/peopl... | true |
3d2a5d50b14f919e5ee6456436cec0aa46fd2532 | JavaScript | amoswijaya/latihan-oop | /factoryCar.js | UTF-8 | 696 | 2.546875 | 3 | [] | no_license | const {Roda, Car, Lcgc, SuperCar, Sedan } = require('./mobil.js')
class FactoryCar {
static creadCar(id, nama, warna, tahun, cc, harga){
// const arrClass = [new Lcgc(nama, warna, tahun, cc),new SuperCar(nama, warna, tahun, cc), new Sedan(nama, warna, tahun, cc) ]
// let random = Math.floor(Mat... | true |
3c60a9796c68f86aa21a72a05481e75eb17f6db6 | JavaScript | AlexKlyde/live-sessions | /js/objects/part4/index.js | UTF-8 | 2,500 | 4.0625 | 4 | [] | no_license | /* Отметить всех администраторов
Задан массив пользователей и массив идентификаторов тех пользователей, которые являются администраторами. Нужно отметить всех администраторов
Основные требования:
Ф-ция должна называться markAdmins и находиться в файле index.js
markAdmins принимает массив пользователей в первом аргумен... | true |
2b5366c6b97ac0c1f8815fded22ce86028854042 | JavaScript | paulinoacuna/Multitask_Web | /script.js | UTF-8 | 4,716 | 3.359375 | 3 | [] | no_license | document.getElementById("n1").addEventListener("click", n1);
document.getElementById("n2").addEventListener("click", n2);
document.getElementById("n3").addEventListener("click", n3);
document.getElementById("n4").addEventListener("click", n4);
document.getElementById("n5").addEventListener("click", n5);
document.getEle... | true |
588484852df91394383f2333defb8aeda2ec82e9 | JavaScript | maslakoff/upgraded-memory | /arrays_and_strings/check_unique_letters_in_string/solution.js | UTF-8 | 158 | 2.75 | 3 | [
"MIT"
] | permissive | export default function checkUniqueLettersInString(str) {
const arr = str.split('');
const unique = new Set(arr);
return arr.length === unique.size;
}
| true |
ac56fdc153fa852936216f57077f04b70196a696 | JavaScript | cheers32/reacttest | /src/app4_widget/Search.js | UTF-8 | 3,631 | 2.953125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios"
const Search = () => {
const [term, setTerm] = useState("computer")
//let term2 = 5
//const [term3, setTerm3] = useState("")
const [results, setResults] = useState([])
console.log(results)
//console.log("rendering...... | true |
ce0796d6ead9cfac8b8cbc77a860a09892f0d910 | JavaScript | g4rci/challenge-todo-app | /src/components/EditTodo.js | UTF-8 | 1,483 | 2.703125 | 3 | [] | no_license | import React, { Component } from "react";
import axios from "axios";
class EditTodo extends Component {
constructor(props) {
super(props);
this.state = {
title: this.props.theTodo.title,
body: this.props.theTodo.bosy
};
}
handleFormSubmit = event => {
const title = this.state.title;
... | true |
f7745c85740540a52865b2e59e41c6118f68044d | JavaScript | SimonThormeyer/beuthSoundGroup | /Frontend/src/components/toneJS/randomNotes/randomNotes.js | UTF-8 | 906 | 3.015625 | 3 | [] | no_license | export class RandomNotes {
constructor() {
this.time = undefined;
this.xAxis = 0;
this.yAxis = 0;
this._simulateCanvasClick = undefined;
this.running = false;
this.timeout = undefined;
}
toggleRandomNotes() {
if (this.running === false) {
... | true |
c75d31e154ae0c5f449db7663610a7411712edb5 | JavaScript | djrisman/react_redux_calculator | /src1/Components/Transition.jsx | UTF-8 | 1,571 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
//import './Cal.css';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
class Transition extends Component {
render(){
const listing = eval(this.props.list);
console.log(listing);
return(
<div>
<ReactCSSTransitionGroup
transitionName="... | true |
c986e1362ef7d729d6627e243988c89cdf296054 | JavaScript | longapalooza/MUA | /js/script.js | UTF-8 | 65,773 | 2.625 | 3 | [] | no_license | // Declare global variables:
// inputs - array containing all Raphaeljs input objects
// components - array containing all Raphaeljs component objects
// correlations - array containing all correlation objects
// input_labls - array containing all Raphaeljs input label objects
// components_labels - array containing al... | true |
3f149fd1441a8f96d140d6c4fcb8ed7f87390aef | JavaScript | de-carvalho/crud-react-node-knex | /frontend/src/pages/Register/index.js | UTF-8 | 8,512 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import { FiArrowLeft } from 'react-icons/fi'
import { Link, useHistory } from "react-router-dom";
import InputMask from 'react-input-mask';
import './style.css'
import api from '../../services/api'
export default function Register() {
const [name, setName] = use... | true |
9620ccb59e8da4dab000fefce98d3ab33b6e57d4 | JavaScript | SamMaxwell/student-projects | /public/scripts/users/my-profile.js | UTF-8 | 966 | 2.8125 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-undef */
$(document).ready(() => {
$('#skills').summernote();
$('#accomplishments').summernote();
});
const save = async (event) => {
event.preventDefault();
const error = {
form: document.querySelector('#profile-error'),
};
clearErrors(error);
fetch('/users/my-profile', {
... | true |
a9fb2ec20443498bc6bc750202420d41905f2a25 | JavaScript | inndee/openitlm | /www/js/epochconverter.min.js | UTF-8 | 650 | 3.09375 | 3 | [
"MIT"
] | permissive | /*
JavaScript epoch time converter number method
http://kylerush.net/blog/javascript-epoch-time-converter-number-method/
By : Kyle Rush
*/
Number.prototype.timeLeft=function(){var days=Math.floor(this/86400);var hours=Math.floor((this-(days*86400))/3600);var minutes=Math.floor((this-((hours*3600)+(days*86400)))/6... | true |
c165a17e65aa6b5380eb141678e765fd8bdd2383 | JavaScript | ysisys0202/Hillstate | /js/index/vertical-slider.js | UTF-8 | 402 | 2.890625 | 3 | [] | no_license | "use strict";
{
const sliderList = document.querySelector(".review .slider-list");
const firstItem = sliderList.firstChild;
console.log(firstItem);
const lastItem = sliderList.lastChild;
//const clonedFirstItem = firstItem.clonedNode(true);
//const clonedLastItem = lastItem.clonedNode(true);
/... | true |
89adbba386b6998b345b4b30ab729e9072a0de25 | JavaScript | alex-nazaretyan/moderno-project | /moderno project/main.js | UTF-8 | 496 | 2.8125 | 3 | [] | no_license | function subMenu(){
const burgerMenu = document.querySelector('.burger-menu');
const subMenu = document.querySelector('.sub-menu');
burgerMenu.addEventListener('click', ()=>{
subMenu.style.cssText=`
display:block;
`
})
const times = document.querySelector('.fa-tim... | true |
fc9840b5730295842f491726804808b4d887a762 | JavaScript | gabrielcarneiro97/brainfuck | /JS/js-bf.js | UTF-8 | 1,757 | 3.53125 | 4 | [
"MIT"
] | permissive | class Brainfuck {
constructor (string) {
this.dataArray = new Array(30000).fill(0)
this.charArray = string.split('')
this.now = 0
for (let i = 0; i < this.charArray.length; i++) {
let char = this.charArray[i]
i = this.do(char, i)
}
}
moveRight () {
this.now += 1
}
moveLef... | true |
722ee6686aecc57e66b1d31ed41764e85bde1166 | JavaScript | cascadian/Windshaft-cartodb | /lib/utils/table-name-parser.js | UTF-8 | 3,482 | 3.15625 | 3 | [
"BSD-3-Clause"
] | permissive | 'use strict';
// Quote an PostgreSQL identifier if ncecessary
function quote_identifier_if_needed(txt) {
if ( txt && !txt.match(/^[a-z_][a-z_0-9]*$/)) {
return '"' + txt.replace(/\"/g, '""') + '"';
} else {
return txt;
}
}
// Parse PostgreSQL table name (possibly quoted and with optional s... | true |
fa3e6f3b03ca0b24022c6439edb4e0476eb00000 | JavaScript | shailendrarijal/blackboardnepal-website | /utils/articles.js | UTF-8 | 4,903 | 2.578125 | 3 | [] | no_license | import React, { useState, useEffect, useContext, createContext } from 'react';
import 'firebase/auth';
import Firebase from 'firebase'
import { useAuth } from './auth';
import { useUser } from './users';
import slugify from 'react-slugify';
const articleContext = createContext();
export function ProvideArticle({ chi... | true |
5eaacc050584d752ec58168e3068f69ff804ecd7 | JavaScript | lismgmk/Petrichenko_Simple_DOM | /js/script.js | UTF-8 | 4,897 | 3.140625 | 3 | [] | no_license | /* Задания на урок:
1) Удалить все рекламные блоки со страницы (правая часть сайта)
2) Изменить жанр фильма, поменять "комедия" на "драма"
3) Изменить задний фон постера с фильмом на изображение "bg.jpg". Оно лежит в папке img.
Реализовать только при помощи JS
4) Список фильмов на странице сформировать на основании... | true |
b9f8797514536b98ce7be03ae696f9207936aa07 | JavaScript | theegames/theegames.github.io | /moonconquest/js/main.js | UTF-8 | 384 | 2.59375 | 3 | [] | no_license | var game;
var score = 0;
var rand = (min, max) => {
return Math.floor(Math.random() * (max + 1 - min) + min);
}
window.onload = () => {
game = new Phaser.Game(480, 640, Phaser.AUTO, 'render');
game.state.add('boot', boot);
game.state.add('load', load);
game.state.add('menu', menu);
game.state.add('game', gameSt... | true |
5eddd9375cf473b6c09fb6725c63b86b019e4537 | JavaScript | fengzi2016/pre-pos | /practice/section-2/practice-3.js | UTF-8 | 1,457 | 3.140625 | 3 | [] | no_license | 'use strict';
function countSameElements(collection) {
var tag=collection[0],k=0;
var key=[];
var count=[];
count[0]=1;
key[0]=tag;
for(var i=1;i<collection.length;i++) {
if (collection[i].length == 1) {
if (collection[i] != tag) {
key.push(collection[i]);
tag = collection[i];
... | true |
c24c783fc7883d6835894396e3a7c6e19360de81 | JavaScript | thanhtungittlu/JavaScript | /KienThucCotLoiPhan1/04_function/main.js | UTF-8 | 691 | 3.46875 | 3 | [] | no_license | function showMessage(){
alert('Học JS tại F8')
}
showMessage()
function writeLog(prefix,message){
console.log(prefix + ": " + message)
}
writeLog("Tung","Thuong")
function agr(){
for (var param of arguments) {
console.log(param)
}
}
agr(1,2,3,4,"5")
function sum(a, b) {
if (typeof a === ... | true |
2535651eb5c86b7edcc0106d9d48b3accd52f8be | JavaScript | jonathankohen/freeCodeCampAlgos | /basic/largestOfFour.js | UTF-8 | 589 | 4.53125 | 5 | [] | no_license | // Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.
// Remember, you can iterate through an array with a simple for loop, and access each member with array syntax arr[i].
function largestOfFour(arr) {
let newArr = ... | true |
0301ac7e88c77e5f2d3d9e6f6181044a7d1aba41 | JavaScript | eapostol/slackbot-random-victim-finder | /routes/api/victims.js | UTF-8 | 8,327 | 2.75 | 3 | [
"MIT"
] | permissive | const express = require('express');
const randomNum = require("random-js")();
const router = express.Router();
const mongoose = require('mongoose');
const monWed = require('../../options/mwClass');
const tueThu = require('../../options/tthClass');
const bye = require('../../options/bye');
const emojis = require('../..... | true |
3d897c9a7cd09cdc08cc85e339cd31cc5a9b6260 | JavaScript | tofazzal-shuvo/weather-app | /public/js/custom.js | UTF-8 | 745 | 2.90625 | 3 | [] | no_license | const weatherForm = document.querySelector('form');
weatherForm.addEventListener('submit',(e)=>{
e.preventDefault();
const showingPara = document.getElementById('searchValue');
showingPara.innerHTML='Loading...';
const address = document.querySelector('input').value;
fetch('/weather?address='+addre... | true |
839a70f5c16f5b103bd72b3830d4db9ff04829f6 | JavaScript | rebeccapoulter/mGenerator | /js/user.js | UTF-8 | 389 | 2.59375 | 3 | [] | no_license | var words = ["Synergy","Disruptive","Omnichannel","Utilisation","Content is king","Storyscaping","SoLoMo","Data, yeh?","Advertainment","Ideation","Quality, not quantity", "Viral"];
$(document).ready(function(){
$("button").click( function() {
var randomWord = words[Math.floor(Math.random() * words.length)];
conso... | true |
8f5c3cccb410e8d5ee1b9389b87e2f8e41f6f268 | JavaScript | hacu07/restaurante | /JS/pantallas.js | UTF-8 | 11,176 | 2.5625 | 3 | [
"MIT"
] | permissive | /* Contiene los formatos de pantalla*/
/*Presenta tabla de pedidos para preparacion y despacho por el Chef*/
function forPantallaChef1(modulo, empleado){
var txt =forEncabezado(modulo, empleado);
txt +='<div id="cont_centro"></div>';
txt +='<div id="cont_sur"><button class="btn btn-block btnSur" onclick="consultar... | true |
358500430c4459e53f2b4cc3320cc8288c268d85 | JavaScript | imej/battle-city | /src/components/AutoTankController.js | UTF-8 | 1,870 | 2.765625 | 3 | [] | no_license | import AutoTank from './AutoTank';
import {
SCREEN_WIDTH,
TANK_SIZE,
AUTO_TANK_SPEED
} from '../utils/Constants';
import { isTankBlocked } from '../utils/Helper';
const PRODUCING_FREQUENCY = 10000; // The ms between each tank appears
const STARTING_POSITION = [
{ x: 0, y: 0 }, // left
{ x: SCREEN_WIDTH - T... | true |
47dab6af050aa0d0ca8008ddfbc60a910784fa27 | JavaScript | Sharykhin/react-flux-todo | /build/.module-cache/dec8bf0277f69ffcc021947a19d467db43d5d752.js | UTF-8 | 767 | 2.578125 | 3 | [] | no_license | /*var SearchPanel = React.createClass({
render: function() {
return (
<div className="row">
<div className="one-fourth column">
Filter:
<input ref='search' type='text'
value={this.props.search}
onChange={this.onSearchChanged}
{this.props.search?<button onClick={this.props... | true |
abff79929347801dfe0510806ce6db1ee92ef97d | JavaScript | JaykeyGuo/first-app | /src/public/scan_images.js | UTF-8 | 1,196 | 2.625 | 3 | [] | no_license | var fs = require('fs');
var jsonfile = require('jsonfile');
//引入fs & jsonfils
var writeFilePath = './all_images_info.json';
var errorPathString = './error_files_data.json';
var readFilePath = './public/images/';
//定义路径
fs.readdir(readFilePath, function (err, files) {
if (err) {
console.log("读取文件夹失败");
... | true |
f09136775e9d119288fc1617b5f6e3383ce2f4d3 | JavaScript | dujunjie66/joker | /index0002.js | UTF-8 | 1,732 | 3.953125 | 4 | [] | no_license | console.log('执行demo0006.js')
// 获取当前的时间
// var 变量名=变量值;new Date()就是获取当前的日期时间
var now = new Date();
console.log(now);
// 获取时间的某一个部分
// 年,月,日月份是0-11,表示1-12月
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
console.log('年;',year);
console.log('月',month);
console.log('日',day);
docu... | true |
b476ff342ac1888669393d3ac752f33206d7f9a4 | JavaScript | CoderDam/zelda | /js/app.js | UTF-8 | 5,851 | 2.78125 | 3 | [
"MIT"
] | permissive | var app = {
level: 0,
startX: 0,
startY: 0,
timing: {
tenth: 0,
sec: 0,
min: 0,
},
screens: {
gameOver: {
className: 'game-over',
text: 'OMG, you killed Link!<br />(in the mud, what a shame...)',
},
gameWon: {
className: 'game-won',
text:'Congrats, you ended ... | true |
7262874773da290cb1226f34a52e071e9987e604 | JavaScript | Igor-Patrick/Igor-Patrick.github.io | /freeway/vaca.js | UTF-8 | 402 | 3.234375 | 3 | [] | no_license | //Variáveis do Ator
let yVaca = 367;
let xVaca = 185;
let diametro = 30/2;
//Motrar Ator
function mostraVaca(){
image(imagemDaVaca, xVaca, yVaca, 30, 30);
}
//Movimentar Ator
function movimentaVaca(){
if(keyIsDown(83)){
if(yVaca > 365){
yVaca = 366;
}else{
yVaca += 3;
}
}
if(keyIsD... | true |
ff3034ba40612b53d53c3c2befc77596d9f3927a | JavaScript | akileez/toolz | /src/object/forIn.js | UTF-8 | 266 | 2.5625 | 3 | [
"ISC",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function forIn (obj, fn, ctx) {
var key
if (!ctx) {
for (key in obj) {
if (fn(obj[key], key, obj) === false) break
}
} else {
for (key in obj) {
if (fn.call(ctx, obj[key], key, obj) === false) break
}
}
}
module.exports = forIn
| true |
404c96e8a3bf69313522035b07273dca5b87afcc | JavaScript | dinamo7/html | /css/07.05/js/app.js | UTF-8 | 1,897 | 2.984375 | 3 | [] | no_license |
var form = document.getElementById("form"),
list = document.getElementById("list"),
STORE_MESSEGES_KEY = "allMassages",
allMessages = readFromLocalStorage();
initializeListFromAllMessages();
form.addEventListener("submit", function (e) {
e.preventDefault();
var msg = this.elements.message.val... | true |
1f24f0c20a6d242e82c9cff6a351a67f71918db6 | JavaScript | teekirol/roadtrip | /routes/index.js | UTF-8 | 1,731 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var _ = require('underscore');
var config = require('../config');
var clientKey = config.foursquareClientKey;
var clientSecret = config.foursquareClientSecret;
var foursquare = (require('foursquarevenues'))(clientKey, clientSecret);
var offRoadDistance... | true |
bd638a8ae94790daaa8e05f63adc825b2c457aff | JavaScript | psico/teachingJavascript | /assets/js/principal.js | UTF-8 | 876 | 3.40625 | 3 | [] | no_license | function validarFormulario(e) {
e.preventDefault();
let valorDosCampos = document.querySelectorAll(".validar");
let formularioValido = true;
for (let cadaCampo of valorDosCampos) {
if (cadaCampo.value) {
//console.log("O campo está preenchido com: " + cadaCampo.value);
} el... | true |
a8a14e7cac93e92fb074017607837f400e79604d | JavaScript | RudRecciah/botrecciah | /src/Utils.js | UTF-8 | 3,228 | 2.65625 | 3 | [
"MIT"
] | permissive | import readline from "readline";
import {getModulesPluginNames} from "@babel/preset-env";
import fse from "fs-extra";
export default class Utils {
static sendMessage(client, channel, message) {
return client.channels.cache.get(channel).send(message);
}
static sendEmbed(client, channel, title, message) {
... | true |
aea1fc7d3bf3e51eb4a83643efbfafa048479379 | JavaScript | luiseduardohdbackup/FoodFiesta_phonegap | /www/js/html5/workers.js | UTF-8 | 4,962 | 3.40625 | 3 | [] | no_license | /*
* Copyright 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | true |
c950aedb6d1d7d8653753424da59237f01b6b279 | JavaScript | Tilakj/social-dasboard-login-jsonplaceholder | /src/components/Posts.js | UTF-8 | 1,159 | 2.53125 | 3 | [] | no_license | import React from 'react'
import Axios from 'axios'
class Posts extends React.Component {
constructor(props) {
super(props)
this.state = {
posts: [],
isLoading: true
}
}
componentDidMount = () => {
Axios.get(`http://jsonplaceholder.typicode.com/posts... | true |
f0ea7c05270642d234c1cf0dc5ecd7ae689f64f6 | JavaScript | MatthiasGu/coding-challenges | /src/javascript/greedyFlorist.js | UTF-8 | 354 | 3.140625 | 3 | [] | no_license | // problem https://www.hackerrank.com/challenges/greedy-florist/problem
function getMinimumCost(k, c) {
c.sort((a, b) => b - a)
let totalCost = 0
let prevPurchases = 0
for (let i = 0; i < c.length; i += 1) {
if (i > 0 && i % k == 0) {
prevPurchases += 1
}
totalCost += (prevPurchases + 1) * c[i... | true |
0201f9347d0e6513e05188ed510d63941ddc0472 | JavaScript | cunnellp5/code-log | /~codeWars/7_kyu/timeswonchampleague.js | UTF-8 | 1,354 | 4.1875 | 4 | [] | no_license | // Create a function that takes two arguments:
//
// 1) An array of objects which feature the season, the team and the country of
// the Champions League winner.
//
// 2) Country (as a string, for example, 'Portugal')
//
// You function should then return the number which represents the number of times
// a team from ... | true |
678746afa5b8748805cfa7f3d37b59de52d02ce7 | JavaScript | vikasgg/transitive.js | /lib/pathsegment.js | UTF-8 | 3,837 | 3.0625 | 3 | [
"MIT"
] | permissive | /**
* Dependencies
*/
var segmentId = 0;
/**
* Expose `PathSegment`
*/
module.exports = PathSegment;
/**
*
*/
function PathSegment(type) {
this.id = segmentId++;
this.type = type;
this.points = [];
this.graphEdges = [];
}
PathSegment.prototype.clearGraphData = function() {
this.graphEdges = [];
... | true |
b6e4307e398ed15d8012dc50d820358c6223d934 | JavaScript | olegmakiienkogithub/catalog | /lib/wrap.js | UTF-8 | 374 | 2.703125 | 3 | [] | no_license | 'use strict';
/*
Will call callback with error in case of error
or success funciton with value
*/
exports.error = function(callback, successFunction) {
return function(err, result) {
if(err) {
// console.error(`Error: ${JSON.stringify(err, null, 2)}`);
return callback(err);... | true |
4190fa61ed2f61444e826049b14bf5a09ce89131 | JavaScript | mustardjelly/University-Examples | /Web Examples/HTML UI/script.js | UTF-8 | 1,279 | 2.640625 | 3 | [] | no_license | function expand(input) {
try {
input = input.value.toString();
} catch(e) {
input = "msg1Contents";
}
if (input == "msg2Contents"){
document.getElementById("titleToChange").innerHTML = "Some more feedback";
}
msg = document.getElementById(input);
if (msg.style.display == "none") {
msg.style.display... | true |
b833e312849f272ec063130b3dc5a2d037200038 | JavaScript | NaturalIntelligence/StubbyDB | /os/nushi/stubbydb/util/util.js | UTF-8 | 2,398 | 2.859375 | 3 | [
"MIT"
] | permissive | exports.getMatches = function(string, regex_str) {
var regex = new RegExp(regex_str,"g");
var matches = regex.exec(string);
if(matches){
return matches;
}
}
exports.getAllMatches = function(string, regex_str) {
regex = new RegExp(regex_str,"g");
var matches = [];
var match;
while (match = regex.exe... | true |
8cb24123bed8a0e9587dabbc5b25904bfba10eb8 | JavaScript | superain/my-first | /lunbo2/js/a.js | UTF-8 | 2,496 | 2.984375 | 3 | [] | no_license | function Slider(options){
if(!options){
throw new Error("请传入参数");
}else if(!options.myDiv){
throw new Error("请给myDiv属性传入一个div")
}else if(!Array.isArray(options.imgs)){
throw new Error("请传入图片数组")
}
this.myDiv = options.myDiv;
this.myDiv.classList.add("slider");
this.imgs =options.imgs;
this... | true |
ff19dd61f5623ad6ed046271f4d14db39b21d570 | JavaScript | eugishuge/DojoAssignments | /Algorithms/05102017.js | UTF-8 | 536 | 2.78125 | 3 | [] | no_license | function (acronym){
str = " this is a string"
newstr = ""
newstr1 = ""
for (i = 0; i< str.length;i++){
if (str[i] = " "){
if (str[i] != " "){
newstr += str[i+1]
break
}
}
}
for (var x = i; x < str.length; x++){
if (... | true |
34e0e5daf69b27ac47d7b5737f8b880bcba74fe1 | JavaScript | jldec/pub-generator | /serialize.js | UTF-8 | 1,227 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* serializefiles.js
* reverse of parsefiles.js: serializes fragments back into file.text
* TODO: streaming
*
* Copyright (c) 2015-2022 Jürgen Leschner - github.com/jldec - MIT license
**/
var u = require('pub-util');
module.exports = function serialize(generator) {
generator = generator || {};
generator... | true |
c935c6ec08c4219f96ead6d0ab3e15e261eebe32 | JavaScript | Hamlet593/Level1forTesting | /2D-array.js | UTF-8 | 3,490 | 3.5625 | 4 | [] | no_license | // 2D-array
// Given a n x n matrix. The problem is to find all the distinct elements
// common to all rows of the matrix. The elements can be printed in any
// order.
// Input :
// 2 1 4 3
// 1 2 3 2
// 3 6 2 3
// 5 2 5 3
// Output : 2 3
***
//Solution
//Կոդն աշխատում է կամայական n * n չափանի... | true |
10a9eb37868d8cba75069bd324af781583fc5c81 | JavaScript | jessephamsg/bookshop-react-fe | /src/components/utils/handleCart.js | UTF-8 | 1,496 | 2.515625 | 3 | [] | no_license | export default {
addOneToCart(cartState, cartTotalState, addedItem) {
let updatedCart = null;
(cartState === null) ? updatedCart = [addedItem]: updatedCart = [addedItem, ...cartState];
const updatedTotal = cartTotalState + addedItem.raw.discountedPrice;
window.localStorage.setItem('c... | true |
481c450c439294af5d1af28afd3989f19e69f2ad | JavaScript | DanielFuqua/Capstone | /src/components/pantry/AddedFoodQuantity.js | UTF-8 | 2,672 | 2.828125 | 3 | [] | no_license | import React, { useRef, useContext } from "react";
import { MealQuantityContext } from "./MealQuantityProvider";
import "./Pantry.css";
export default ({ food, addIngredient, toggle }) => {
const { updateQuantities } = useContext(MealQuantityContext);
const quantity = useRef();
return (
<form className="add... | true |
cf87ff4ecf7e0abf2f889a9eb7747087046ab888 | JavaScript | gteklee/safety-counter | /client/js/storage.js | UTF-8 | 300 | 3.34375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | /**
* Stores passed in value into local storage with name passed in as string.
*/
function store_Value(val, name)
{
this.value = val;
localStorage.setItem(name, this.value);
}
function store_Array(array, name)
{
let JSONformat = JSON.stringify(array);
localStorage.setItem(name, JSONformat);
} | true |
ab9d30fca514fe27e1b35fd818a6bccf60285a27 | JavaScript | diegosfc100/aprendendoJS | /01.freecodecamp-JS/01-Basico/28.concatenacaoIII.js | UTF-8 | 813 | 4.40625 | 4 | [] | no_license | /* Construindo Strings com Variáveis
Às vezes, você precisará construir uma string, no estilo Mad Libs. Usando o operador de concatenação (+),
você pode inserir uma ou mais variáveis em uma string que está construindo.
Exemplo: */
var ourName = "freeCodeCamp";
var ourStr = "Olá, nosso nome é" + ourName + ", como voc... | true |