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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6a1d415a347a55c84ce1a8c8cae733074bf4d2e3 | JavaScript | StefanMihaylov/TelerikAcademy | /08 JavaScript-UI-and-DOM/05b Raphael-JS-homework/Raphael-JS/archimedean-spiral.js | UTF-8 | 778 | 2.984375 | 3 | [] | no_license | window.onload = function () {
var initialRadius = 0,
step = 60 / (2 * Math.PI),
dotRaduis = 0.5,
angleStep = 0.01,
turns = 3;
var paper = Raphael('spiral', 400, 350);
var centerX = paper.width / 2,
centerY = paper.height / 2,
radius;
var circle = pap... | true |
7a0c0aa561225353a861275763bd76ed4b2f1169 | JavaScript | ITicks/BooksExchangeRelease | /web/resources/js/error.js | UTF-8 | 653 | 3 | 3 | [] | no_license | //Recupero la lista degli errori
var errorMessagesList = document.getElementById("frmError:frmErrorMsgError");
//Nascondo la lista degli errori
errorMessagesList.style.visibility = "hidden";
//Se ho degli errori
if (errorMessagesList != null) {
//Recupero gli elementi della lista
var errorMessages = errorMessages... | true |
b41e7820c6eac0a6ff5dbcffc61ea5853c61636d | JavaScript | aaronlienhard/japanese_character_quiz | /Japanese Character Quiz/script.js | UTF-8 | 346 | 2.859375 | 3 | [] | no_license | var questionAmount = 10;
function updateAmount10() {
questionAmount = 10;
alert("Question amount is " + questionAmount);
}
function updateAmount15() {
questionAmount = 15;
alert("Question amount is " + questionAmount);
}
function updateAmount20() {
questionAmount = 20;
alert("Question amount ... | true |
6939eaed78a171dd441037ff53485b81e26de978 | JavaScript | liam-t/phaser-test1 | /src/phaser/classes/Background/index.js | UTF-8 | 979 | 2.5625 | 3 | [] | no_license | // import { Scene } from 'phaser';
// import layer1 from 'assets/sprites/industralBackground/foreground.png';
// import layer2 from 'assets/sprites/industralBackground/buildings.png';
// import layer3 from 'assets/sprites/industralBackground/far-buildings.png';
// import layer4 from 'assets/sprites/industralBackground/... | true |
3a5949f6173af0df94ac25480876f2f006431d8f | JavaScript | Rocketblaster247/EN2JA | /main.js | UTF-8 | 1,576 | 2.640625 | 3 | [
"MIT"
] | permissive | var json;
var dataset = [];
var net = new brain.recurrent.LSTM();
if (json) {
net.fromJSON(json);
}
var iter = 0;
var load = function (d) {
d = d.toString().toLowerCase();
console.log("Finding sentences...");
dataset = d.toString().split("\t").join(" ").toString().split("\n");
console.log("Loaded da... | true |
dc5fad5f4f85a22df193a882424940dea7d07a0b | JavaScript | raniceyue/rc-temp-dashboard | /imports/ui/utils/GraphUtil.js | UTF-8 | 3,338 | 3.09375 | 3 | [] | no_license | import Dygraph from "dygraphs";
import moment from 'moment';
/**
* Custom interaction model for Dygraph
* Reference https://dygraphs.com/gallery/#g/interaction
* takes 2 functions as arguments
*/
export function graphHandler(setStartDate, setEndDate) {
return (
{
mousedown:
function(eve... | true |
ca2c50bd341bf4ffe5fca312eaa48f4f8577690b | JavaScript | zelenkoff/javascript-battlefield | /ht2_3/js/index.js | UTF-8 | 1,526 | 3.59375 | 4 | [] | no_license | (() => {
let calculator = firstNumber => {
return {
sum() {
let result = firstNumber;
for (let i = 0; i < arguments.length; i++) {
result+=arguments[i];
}
return result;
},
diff() {
... | true |
ab9cf8e7043c08cf4824bc9808978a0b5e0372b5 | JavaScript | olsenmatthew/PhotoPro | /photopro-app/src/components/Modals/EditPostModal/textfields/PriceField.jsx | UTF-8 | 1,454 | 2.59375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import TextField from '@material-ui/core/TextField';
export default function PriceField(props) {
const [text, setText] = useState(props.oldPrice);
const [errorText, setErrorText] = useState('');
const [errorValue, setErrorValue] = useState(false);
const [firs... | true |
4f5ef6fa59a6058a53572f1598dc4dadfc2131ec | JavaScript | Saf25/React-State-Checkpoint-New- | /src/App.js | UTF-8 | 1,523 | 2.75 | 3 | [] | no_license | import "./App.css";
import React, { Component } from "react";
import Me from "./Me.jpg";
export default class App extends Component {
constructor(props) {
super(props);
console.log("I am the constructor");
}
state = {
Person: {
fullName: "Name: Safouene Najjar",
bio: "Bio: born May 2... | true |
302e5ea42eca05e816934b2964946f227e2f903c | JavaScript | vijayjangid/react-hook-counter | /src/hooks/counter/index.js | UTF-8 | 1,058 | 2.6875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { useSpring, animated } from "react-spring";
import "./styles.css";
function renderCounter(count, setCount, animatedCount) {
const counter = animatedCount.number;
console.log(counter);
return (
<>
<h1>
You clicked <animated.span classNa... | true |
3804b16221f759f35779152bac66c312b17cf265 | JavaScript | ihlayhiha/JavaScript-course | /DS and Modern JS/optionalChaining.js | UTF-8 | 3,553 | 3.6875 | 4 | [] | no_license | // using optional chaining
const restaurant = {
name: "Classico Italiano",
location: 'Via Angelo Tavanti 23, Firenze, Italy',
categories: ['Italian', 'Pizzeria', 'Vegetarian', 'Organic'],
starterMenu: ['Focaccia', 'Bruschetta', 'Garlic Bread', 'Caprese Salad'],
mainMenu: ['Pizza', 'Pasta', 'Risotto'... | true |
87636970fb905d3353e9faf698d787a0a4c611e0 | JavaScript | mgholam/weld | /test/test.js | UTF-8 | 16,685 | 2.671875 | 3 | [
"MIT"
] | permissive | ;(function(exports) {
var getTemplate = require('./getTemplate');
exports.suite = {
"Test 1: Sanity" : function(test) {
getTemplate('null', function(window, weld, $) {
var template = $("<div><a class='link'></a></div>")[0];
weld(template, { link : "text" }, {
set : function(pa... | true |
a80994e45b27d4e99ef47e36eff6907f4e92473b | JavaScript | ptienchuan/dish-management-api | /tests/endpoints/dish/search.test.js | UTF-8 | 8,506 | 2.515625 | 3 | [] | no_license | require('../../config/environment')
const request = require('supertest')
const app = require('../../../src/app')
const {
defaultUser,
defaultDish,
dishOne,
dishThree,
dishSix,
defaultCategory,
setupDatabase
} = require('../../fixtures/database')
beforeAll(setupDatabase)
describe('Should fetch some dishes succe... | true |
211ffb8b6956ea1ad164e69d4f0b17a1d50de1ea | JavaScript | neelox/ASME-2018 | /homepage.js | UTF-8 | 1,272 | 2.609375 | 3 | [] | no_license |
//var audio1 = document.getElementById("sef1");
/*function namaste()
{
d = new Date;
n = d.getHours();
if(0<=n<11)
{
document.getElementById("namastae").innerHTML="Good Morning";
}
else if(12<=n<=15)
{
document.getElementById("namastae").innerHTML="Good Afternoon";
}
else if(16<=n<=20)
{
document.getEleme... | true |
41be6ba0f3678ca584a1d7e458aed135e392455a | JavaScript | jnlongnecker/AsyncJavascript | /src/modules/c/pokeApi/util.js | UTF-8 | 2,770 | 3.734375 | 4 | [] | no_license | // The async keyword here causes this function to return a promise
async function getPokemon(pokemonName) {
pokemonName = pokemonName.toLowerCase();
// Use the Fetch API to make a request to an API service and return the result
const req = new Request('https://pokeapi.co/api/v2/pokemon/' + pokemonName);
... | true |
134e79a5a7488f55b4546409c040117291542d8e | JavaScript | shadownetz/shadownetzPortfolio | /moderator/static/moderator/custom/js/user-auth.js | UTF-8 | 1,162 | 2.796875 | 3 | [] | no_license | $(document).ready(function(){
$('#loginsubmit').click(function(event){
event.preventDefault();
validateLogin();
})
});
function validateLogin(){
let emailOriginLink = $('#emailoriginlink').val();
let emailAddress = $('#id_email').val();
let passcode = $('#id_password').val();
le... | true |
2f7328ce66aa3665040d5492df49d8e96b6d6fbf | JavaScript | Niharika250594/MaterialReact | /src/fetchingdata.js | UTF-8 | 520 | 2.546875 | 3 | [] | no_license | import React,{useEffect,useState} from 'react';
import axios from 'axios';
function Data(){
const [posts,setPosts]=useState([])
useEffect(()=>{
axios.get('https://jsonplaceholder.typicode.com/posts').then(
res=>{
console.log(res.data);
setPosts(res.data)
... | true |
90d6ff28520fcd561224e61c0f27085acc2de463 | JavaScript | jlahare/api_fullstack | /routes/person.js | UTF-8 | 2,729 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit: 2,
host: 'fullstackdb.cteclwn50rvh.ap-south-1.rds.amazonaws.com',
user: 'admin',
password: 'Jargon1$',
database: 'full_stack_db'
});
router.post('/addPerson... | true |
bdb53f026c4409a152ec743bf94e8305851b3e2a | JavaScript | febeck/insurance-stat | /index.test.js | UTF-8 | 2,467 | 3.125 | 3 | [] | no_license | const InsuranceStats = require('./insuranceStats');
const InsuranceEvent = require('./insuranceEvent');
describe('InsuranceStats class', () => {
let insuranceStats = null
beforeEach(() => {
insuranceStats = new InsuranceStats()
})
it('should has an initial empty events array', () => {
... | true |
4171b799434a122b303d18c8e67d5d49de5b3bc4 | JavaScript | KaleyKrim/jelly-scramble | /public/js/game.js | UTF-8 | 3,262 | 3 | 3 | [] | no_license | var players = {};
var target = {};
var canvasSize = 500;
var targetSize = 50;
var playerSize = 50;
var characters = {
"game-assets/players/player2.png":false,
"game-assets/players/player3.png":false,
"game-assets/players/player4.png":false,
"game-assets/players/player.png":false,
"game-assets/players/player... | true |
6dfb226842990d24a80219322cd2e5ed0ca3cf9d | JavaScript | bharat1910/cs527 | /modified_projects/jshint/kuda/public/js/hemi/utils/jsUtils.js | UTF-8 | 5,809 | 2.71875 | 3 | [] | no_license | /* jshint undef: false, unused: false, asi: true */
/* jshint maxerr:10000 */
/*
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
* The MIT License (MIT)
*
* Copyright (c) 2011 SRI International
*
* Permission is hereby granted, free of charge, to any person obtaining a copy ... | true |
8807baeff13ba89d15f9392c55ac302c5f887c99 | JavaScript | agomezjuan/JS-Core | /JS Fundamentals/04 Functions/Functions, Arrow Functions/5. Functional Calculator/app.js | UTF-8 | 721 | 3.578125 | 4 | [
"MIT"
] | permissive | function calculaor(a, b, operations) {
let add = function (a, b) { return a + b };
let subtract = function (a, b) { return a - b };
let multiply = function (a, b) { return a * b };
let divide = function (a, b) { return a / b };
let claculate = function (a, b, op) { return op(a, b) };
switch (o... | true |
7b927f5545632db9417fb426e54f26c54861b691 | JavaScript | songjy6565/alg-js | /programmers/A4.js | UTF-8 | 478 | 3.15625 | 3 | [] | no_license | function solution(n, lost, reserve) {
var answer = 0;
var matched = -2;
for (var i = 0; i < lost.length; i ++){
var target = lost[i];
if(reserve.indexOf(target-1) != -1 && reserve.indexOf(target-1) != matched )answer += 1;
else if(reserve.indexOf(target+1) != -1){
answer+... | true |
4bea4eed509993bd312f3e79d267818e7ce36f80 | JavaScript | phuongnguyen1996/JavaScript | /logic/Phuong_JSAd02.js | UTF-8 | 2,197 | 3.515625 | 4 | [] | no_license | const fs = require('fs');
const users = JSON.parse(fs.readFileSync('./data.json', 'utf-8'));
// forEach
var arrFE = []
users.forEach((users) => {
let res = `${users.first_name} ${users.last_name}`;
arrFE.push(res);
})
console.log(arrFE);
// filter
var arrFT = []
users.filter((users) => {
if(users.age<40){... | true |
c87fc73c03e468ea7f2f59d4d4a7a2b80a909da9 | JavaScript | leandronishijima/nodejs-express | /src/models/Book.js | UTF-8 | 237 | 2.515625 | 3 | [] | no_license | class Book {
construction(id, title, author) {
this.id = id;
this.title = title;
this.author = author;
}
toJSON() {
return {
id: this.id,
title: this.title,
author: this.author };
}
}
export { Book as default }; | true |
1397ab9cbe322013494ddfc8e4a234b9bbc9007f | JavaScript | diegoaguilerav/Actividades-Javascript | /dom/js/script3.js | UTF-8 | 202 | 2.640625 | 3 | [] | no_license | function validar(){
var nombre = document.getElementById('nombre').value
if (nombre.length != 0){
return false
}else{
return false
}
/*return (nombre.length != 0)*/
} | true |
02f1b71c62c34172ad2fabc08255cf470331e85d | JavaScript | svetlimladenov/JavaScript-Core | /JavaScript Fundamentals/02.DocumentObjectModel/Exercises/03_Encode-and-Decode-Messages/solution.js | UTF-8 | 1,049 | 3.203125 | 3 | [
"MIT"
] | permissive | function solve() {
let buttons = document.querySelectorAll("button");
let textAreas = document.querySelectorAll("textarea");
let encodeButton = buttons[0];
let decodeButton = buttons[1];
encodeButton.addEventListener('click', () => {
let encodeTextarea = textAreas[0].value;
if (!encodeTextarea){... | true |
c326f61fae6686d2e4ea408316605fbea4cb5b5a | JavaScript | wdillard/aMazing-Wyncode | /aMazing-Wyncode.js | UTF-8 | 6,053 | 3.328125 | 3 | [] | no_license | const prompt = require('readline-sync');
let firstCommands = [' Forward', ' Right', ' Back'];
let secondCommands = [' Left', ' Right', ' Back'];
let thirdCommands = [' Left', ' Right', ' Back'];
let forthCommands = [' Forward', ' Left', ' Back'];
console.log('******************* ******* ****** ***** ... | true |
f1d1d8dd53947672a03d625894f9418c556e0ce3 | JavaScript | peteblois/peteblois.github.io | /tmp/mousewheel/iframe.js | UTF-8 | 279 | 3 | 3 | [] | no_license | let wheelEvents = 0;
const report = document.createElement('div');
report.textContent = `${wheelEvents} wheel events.`;
document.body.appendChild(report);
window.addEventListener('mousewheel', (e) => {
++wheelEvents;
report.textContent = `${wheelEvents} wheel events.`;
});
| true |
84ab200fef1cff671db1d0ae29dfb2d9082cafaa | JavaScript | abh7662/react-practice | /src----badgeComponent/index.js | UTF-8 | 712 | 2.71875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import "./styles.css"
const Badge = ({color,children,...props}) => {
return <span className={`${color} badge`} {...props}>{children}</span>
}
const App = () => {
return (
<section>
<h1>Check out these badges!</h1>
<Badge color="green">Su... | true |
fe3bfa7b801ce2c71e3f2df2bc54c3267bde303b | JavaScript | roldie9/OOP-hw10 | /Master/lib/engineer.js | UTF-8 | 1,083 | 3.234375 | 3 | [] | no_license | const employee = require("./employee");
const inquirer = require("inquirer");
const fs = require("fs");
inquirer.prompt([
{
type: "input",
message: "What is the engineer's name?",
name: "employeeName"
},
{
type: "input",
message: "What is the engineer's ID?",
... | true |
68860f7794f2e7da9265130b8090eaa625ef349e | JavaScript | lyhy/summer2019 | /algorithom/leetcode/questions/268.missing-number.js | UTF-8 | 1,783 | 3.421875 | 3 | [] | no_license | /*
* @lc app=leetcode id=268 lang=javascript
*
* [268] Missing Number
*
* https://leetcode.com/problems/missing-number/description/
*
* algorithms
* Easy (55.75%)
* Likes: 4247
* Dislikes: 2726
* Total Accepted: 828.4K
* Total Submissions: 1.4M
* Testcase Example: '[3,0,1]'
*
* Given an array nums... | true |
81b37387766445d334c5db7d6933d68cec167816 | JavaScript | kongruksiamza/JavaScript-Source | /Workshop 11 - Form Validation/script.js | UTF-8 | 2,206 | 3.109375 | 3 | [] | no_license | const form=document.getElementById('form');
const username=document.getElementById('username');
const email=document.getElementById('email');
const password1=document.getElementById('password');
const password2=document.getElementById('re-password');
form.addEventListener('submit',function(e){
e.preventDefault();
... | true |
9b76239761d22ad9c7818a853bf0f2972ccf7ac0 | JavaScript | bhuvaneshjj/2018 | /server/getEmailsForDistribution.js | UTF-8 | 1,206 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict';
/* Get emails for distribution from the DB.
Usage:
LOG_LEVEL=debug NODE_ENV={development,test,production} \
node ./server/getEmailsForDistribution 2020
Send via Gmail UI, 100 Bcc per message.
*/
const fs = require('fs').promises;
const config = require('./config');
const db = re... | true |
044ad88ee9383e8bcc6616fd6fa8756bcf89d81e | JavaScript | rtlong/head2head | /src/index.js | UTF-8 | 2,103 | 2.796875 | 3 | [] | no_license | import React from 'react'
var ScoreBox = React.createClass({
displayName: 'ScoreBox',
render: function () {
return React.createElement('div', { className: 'score' + (this.props.win ? ' winner' : '') }, this.props.score)
},
})
var ScoreBoard = React.createClass({
displayName: 'ScoreBoard',
getInitialStat... | true |
b9fe2bd1fb66cac049d0d27420de75199cbb893f | JavaScript | TheMaximumPotential/algorithm009-class01 | /Week_02/242.有效的字母异位词.js | UTF-8 | 676 | 3.40625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=242 lang=javascript
*
* [242] 有效的字母异位词
*/
// @lc code=start
/**
* @param {string} s
* @param {string} t
* @return {boolean}
*/
var isAnagram = function (s, t) {
if (s.length !== t.length) return false
let sMap = new Map()
let flag = true
for (let i = 0; i < s.length; i++) {
le... | true |
6ad1fcfa56fd8eb10897219dc43c74c2e96f7ed4 | JavaScript | stereoIII6/iView | /src/components/action/pyeActions.js | UTF-8 | 4,251 | 2.640625 | 3 | [
"MIT"
] | permissive | import {
LOAD_SAMPLES,
LOAD_DRAFTS,
START_BAKING,
RESET_PYE,
DISCARD_PYE,
SAVE_DRAFT, // GRAPH PUSH
PYE_GO_OVEN, // GRAPH PUSH
START_SLICING,
EDIT_SLICE,
ACTIVATE_SLICE,
RESET_SLICE,
DISCARD_SLICE,
GRAB_STATE,
PUSH_STATE,
START_FRAMING,
ADD_FRAME,
ACTIVATE_FRAME,
RESET_FRAME,
EDIT_... | true |
9197894965a80d23993f857ee789de41179e46da | JavaScript | AnkitSingh1992/React-App | /blog/src/forms/Apicall.js | UTF-8 | 1,163 | 2.53125 | 3 | [] | no_license | import React from 'react'
export default class Apicall extends React.Component{
constructor(){
super()
this.state ={
users : null
}
}
componentDidMount(){
fetch('https://reqres.in/api/users').then((resp)=>{
resp.json().then((result)=>{
... | true |
6d8c5fd8e53b176cce287fe953661a6a5c1a706e | JavaScript | AnthonyLzq/spotify-clone-frontend | /src/hooks/useAuth.js | UTF-8 | 1,709 | 2.625 | 3 | [] | no_license | import { useState, useEffect, useCallback } from 'react'
import axios from 'axios'
const useAuth = code => {
const [accessToken, setAccessToken] = useState('')
const [refreshToken, setRefreshToken] = useState('')
const [expiresIn, setExpiresIn] = useState(null)
const getAuth = useCallback(async () => {
tr... | true |
04f42e725f1d185425135df37e1d32c8301b2c44 | JavaScript | Gaurisunil/TypeScript | /Typescript/Seven.js | UTF-8 | 1,186 | 3.921875 | 4 | [] | no_license | var Arithmatic = /** @class */ (function () {
function Arithmatic(value1, value2) {
this.number1 = value1;
this.number2 = value2;
}
Arithmatic.prototype.Addition = function () { return this.number1 + this.number2; };
Arithmatic.prototype.Substraction = function () { return this.num... | true |
1766d284d61bc403b039b99723c2c112203f5f6c | JavaScript | J-Saenz/pokedex-accedo | /pokeapi-main/jhonatan- accedo/Matriz y codigo morse/assets/js/newScript2.js | UTF-8 | 2,522 | 3.109375 | 3 | [] | no_license | const morse = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","--.--","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."," "];
const letras = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","Ñ","O","P","Q","R","S","T","U","V","W","X","Y","Z"," "];
... | true |
a6232cc0c58589705c5419c5bfa5c60cd3772c46 | JavaScript | cristianqr/javascript | /immutability/delete-object-property.js | UTF-8 | 663 | 3.390625 | 3 | [] | no_license | var objectUtil = function () {
function deleteKey(object, keyToDelete) {
return Object.keys(object).reduce(function(obj, key){
if(keyToDelete !== key){
return Object.assign(obj, {[key]: object[key]});
}
return obj;
}, {});
}
return {
... | true |
d8325845eece2eb8f42c6b7c5cf46d53377bc306 | JavaScript | HobdenDesign/ah-server | /models/forms/custom-value.js | UTF-8 | 2,550 | 2.59375 | 3 | [] | no_license | //model to represent a custom field value for a file/response from a custom form
const mongoose = require('mongoose');
const {IUser} = require('../../app-models/user');
const {IForm} = require('../../app-models/forms/ICustomForm');
const { IFormField } = require('../../app-models/forms/ICustomFormField');
const { IPFil... | true |
27d19814b47a3f6ed12c85cb0e5fc8868493efca | JavaScript | davemaurer/blinkify | /blink.js | UTF-8 | 305 | 2.546875 | 3 | [] | no_license | $(document).ready(function() {
(function($) {
$.fn.blinkify = function(speed) {
var selected = this;
function blink() {
selected.fadeToggle(speed);
}
setInterval(blink,speed);
};
}(jQuery));
$('#blink-1').blinkify(3000);
$('#blink-2').blinkify(2000);
});
| true |
b79d14cab9a8f96c082247c2b2de78c9fb884aef | JavaScript | lhl622/3dspace | /webapps/SMAProcXSWidgets/xs-wg-rule/xs-wg-rule.js | UTF-8 | 13,705 | 2.75 | 3 | [] | no_license | /*--------------------------------------------------------------------
[xs-wg-rule JS Document]
Description: The wrapper component for rules
---------------------------------------------------------------------*/
/**
@module SMAProcXSWidgets
@submodule xs-wg-rule
@class xs-wg-rule
@description The component listens... | true |
f6a96990be4d7033d464ad34ecfb01d5e44505ec | JavaScript | haydin505/movie-senpai | /src/container/SearchContainer/SearchContainer.js | UTF-8 | 8,743 | 2.6875 | 3 | [] | no_license | import React, { useState, useLayoutEffect, useRef } from "react";
import styles from "./SearchContainer.module.css";
import { useHistory } from "react-router-dom";
const SearchContainer = (props) => {
const [title, setTitle] = useState("*");
const [year, setYear] = useState("all");
const history = useHistory();
... | true |
fcd5f737c0cff32145aa7a018843cdad02632336 | JavaScript | ioanatatu/earthquakes | /src/components/Data/Stats/Stats.js | UTF-8 | 712 | 2.671875 | 3 | [] | no_license | import style from './Stats.module.scss';
import PropTypes from 'prop-types';
/**
* Stats component receives total and magnitude and maps it on UI.
*
* @param {number} total Total number of earthquakes in a chosen interval.
* @param {number} maxMag The highest magnitude in a chosen interval.
*/
const Stats = ({ t... | true |
9b44f6c0c6c2a170788f8c253895f5e8abbb3b30 | JavaScript | rfit/jumbotron-ci | /src/bin.js | UTF-8 | 1,907 | 2.9375 | 3 | [
"ISC"
] | permissive | const requireDir = require('require-dir');
const utils = require('./utils');
// Load modules
const modules = requireDir('./modules');
// Load any local modules
const localModulesPath = `${process.cwd()}/.jumbotron-ci-modules`;
if (utils.isDirSync(localModulesPath)) {
const localModules = requireDir(localModulesPath... | true |
8272834d07a4019c1a2e7dee9d5e749b35b4fc90 | JavaScript | iGOAT/loki-client | /javascripts/loki/input.js | UTF-8 | 908 | 2.546875 | 3 | [] | no_license | var Loki = Loki || {};
Loki.Input = new Class({
Implements: [Options],
options: {
},
scene: null,
inputs: [],
initialize: function (scene, options) {
this.scene = scene;
this.setOptions(options);
this.$addEventListeners();
},
// returns all current user input
curr... | true |
693318fecb03ea1a13489894ecca911b0f750057 | JavaScript | TravisWadeWilliamson/Fun-with-CSS | /honeycomb-popout-menu/app.js | UTF-8 | 1,257 | 2.71875 | 3 | [] | no_license |
let j = 0;
let i = document.getElementById('menu').childNodes;
// var c = document.getElementById("menu").childNodes.length;
// console.log(c);
// console.log(j)
const expand = () => {
if (j == 0) {
document.getElementById('add')
.style.transform = 'rotate(45deg)';
document.getElementBy... | true |
c7c79b29d9ebcc403b5bebdf801167179b96980f | JavaScript | uwnrg/controls-recruitment-frontend | /src/RepairManQuestion.js | UTF-8 | 4,457 | 2.765625 | 3 | [] | no_license | import React from 'react';
import CodeQuestion from './CodeQuestion';
// c_cpp
// java
// python
// golang
// csharp
// javascript
const templateCode = {
'c_cpp':
'#include <vector>\n' +
'\n' +
'std::vector<int> repair_order(int num_robots, int *spare_parts_needed) {\n' +
' /* d... | true |
1ce6e8b4356a9e85e60740e5d4498665648937f8 | JavaScript | marcos-goes/casadocodigo-nodejs | /dao/ProdutoDao.js | UTF-8 | 621 | 3.109375 | 3 | [] | no_license | /* // ECMA 5
function ProdutoDao(connection){
this._connection = connection
}
ProdutoDao.prototype.listaTodos = function(callback){
this._connection.query('SELECT * FROM livros', callback)
}
*/
class ProdutoDao {
constructor(connection){
this._connection = connection
}
listaTodos(callback){
this._... | true |
2a7d9055eca80b425d25b497b800e6eda793798b | JavaScript | yb0608/Python-JavaScript---Dynamic-Project-Blog | /portfolio/static/script.js | UTF-8 | 600 | 2.984375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll(".likeBtn").forEach((btn) => {
btn.addEventListener("click", function () {
const projectID = btn.dataset.post;
const likeCount = document.querySelector(
`.likeCount[data-post="${projectID}"]`
);
... | true |
5f629756bfaa8a6684bd302a9ffb2b8439bad72b | JavaScript | sandstone1/course-next-ninja-list | /pages/404.js | UTF-8 | 4,702 | 3.234375 | 3 | [] | no_license |
/*
// 1 -
// and remember this is a specially named file much like the index.js file and therefore
// this file does not generate the following url: " http://localhost:3010/404 "
// instead we can create a 404 component so that if a user tries to go to a page that does not
// exist then next will serve up this file ... | true |
0ac3b02ec68942aa9a3a3b60b099f3bdbd99359d | JavaScript | dreamsaboutlana/education | /homework_5/3nameShuffler.js | UTF-8 | 357 | 3.828125 | 4 | [] | no_license | 'use strict';
/*
3. Напишите функцию которая меняет местами имя и фамилию
nameShuffler('john McClane'); => "McClane john"
nameShuffler('Arnold Schwarzenegger'); => "Schwarzenegger Arnold"
nameShuffler('James Bond'); => "Bond James"
*/
function nameShuffler(string) {
return string.split(' ').reverse().join(' ');... | true |
fd1d732dda29fd192eb333d5a5e51ad4f17712dc | JavaScript | fossabot/tools-kit | /lib/Utilities/Util.js | UTF-8 | 1,747 | 3.265625 | 3 | [
"MIT"
] | permissive | // Tools-Kit By BlackB1RD-Development. All rights reserved ©
// Website: https://tools-kit.js.org/
// Project: https://github.com/BlackB1RD-Development/tools-kit
// License: MIT
/**
* The package Utilities
*/
class Util {
/**
* Checks if an Object is a real Object
* @param {Object} object An Object to check
... | true |
5bcf5affc3b0302629cc3824dd19852be686def1 | JavaScript | danielegambera/esame-web | /commento-dao.js | UTF-8 | 2,744 | 2.546875 | 3 | [] | no_license | 'use strict';
// DAO (Data Access Object)
const Commento = require("./commento");
const db = require('./db');
//const moment = require('moment');
const createCommento = function (dbCommento) {
return new Commento(dbCommento.id, dbCommento.titolo, dbCommento.testo, moment.utc(dbCommento.data), dbCommento['user_i... | true |
ad4bd25a03f409cd747dd2d71db55c3ab03db619 | JavaScript | rileyslewis/fend_landing_page | /js/app.js | UTF-8 | 2,332 | 3.578125 | 4 | [] | no_license | /**
*
* Manipulating the DOM exercise.
* Exercise programmatically builds navigation,
* scrolls to anchors from navigation,
* and highlights section in viewport upon scrolling.
*
* Dependencies: None
*
* JS Version: ES2015/ES6
*
* JS Standard: ESlint
*
*/
/**
* Define Global Variables
*
*/
/**
*... | true |
93121603a6eeb901091816b69e3ca89d0804ee4b | JavaScript | AlexisVS/js-boucle-while-exo1 | /js-while/main.js | UTF-8 | 5,400 | 3.5 | 4 | [] | no_license | // - # Exo 1 Boucles WHILE
// - ## Créez une variable classe avec un array
let eleve = ["Alexis", "Loic", "kkkkkk", "Mohammed", "Yassin", "Issam", "Mihai", "Oussama", "Dorian", "Tania", "Anthony", "Junior", "Kevin", "Andy", "Cheb Khaled", "The Kairi 78", "Arouf gangsta le plus beau de tout les rebeux"];
// -... | true |
004efe0f0c2868a4d4d677e71335459d1aaee6f8 | JavaScript | sun-fox/internet-archive-voice-apps | /functions/src/dialog/ask.js | UTF-8 | 977 | 2.59375 | 3 | [] | no_license | const { savePhrase } = require('../state/dialog');
const { debug } = require('../utils/logger')('ia:dialog:ask');
/**
* ask user with suggestions
*
* @param app
* @param speech {string} assistant will speak it
* @param text {string|null} visualization of speech,
* if isn't defined it will be the same as speech
... | true |
7ac00061d4efa4a693d530e63e3f334e170e1140 | JavaScript | reenan/cozinhe | /src/pages/Schedule/Calendar/Calendar.js | UTF-8 | 3,432 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react'
import { Icon } from '../../shared';
import './Calendar.scss';
import moment from 'moment';
import 'moment/locale/pt-br';
moment.locale('pt-BR');
//moment().year(value).month(value).daysInMonth();
//moment().year(value).month(value).startOf('month').day() => match weekDays
cla... | true |
7918cc84df48b4e56f9e6ecaa1ce5ebbd9b410d4 | JavaScript | AndrewDT/WebProgFund | /Functions_Wacky/js/script.js | UTF-8 | 3,112 | 4.65625 | 5 | [] | no_license | //Andrew Tillett 10/22/13 Assignment Functions Function Wacky
/*Criteria:
Make sure each of the sub-projects follows this list of criteria:
As in the earlier assignments you will need to create code that calculates a result. You may not use the same formulas or code used in previous assignments.
Decide what your code... | true |
fc0001d7d84fa7d0216088dfd8f01a1d90177c5f | JavaScript | IsraelBarcelos/react-native-test3 | /App.js | UTF-8 | 3,340 | 2.53125 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, { useState } from 'react';
import {
FlatList,
RefreshControl,
ScrollView,
SectionList,
StyleSheet,
Text,
View,
} from 'react-native';
const App = () => {
const [Items, set... | true |
b71a549f61798f83730cca77bf7eb18677a1f5a3 | JavaScript | ruffcorn33/Giphy-Search-and-Display | /assets/javascript/script.js | UTF-8 | 2,646 | 3.21875 | 3 | [] | no_license | // create new search buttons based on input from user
$(".submit").click(function(event) {
event.preventDefault();
// prevent empty button
if ($("#searchTerm").val() != ""){
// trim whitespace
var subject = $.trim($("#searchTerm").val());
var gifBtn = $("<button class='gif-btn m-1'>");
gifBtn.text... | true |
24b60b6e70d771e28adff5ff4c320dcca14103b2 | JavaScript | Salmankhancodes/Draw-It-Now | /app.js | UTF-8 | 572 | 2.53125 | 3 | [] | no_license | const express = require('express')
const socket = require('socket.io')
const app = express()
const port = process.env.PORT || 5000
app.use(express.static('public'))
let server = app.listen(port, () => {
console.log('listening on server')
})
let io = socket(server)
io.on('connection', (socket) => {
console.log('... | true |
7ea862d0df4bd6a8b715594ba0e673a47f24f92d | JavaScript | awesome-button/Data-structures-and-algorithms---exercises | /queues/printing-queue.js | UTF-8 | 2,384 | 3.765625 | 4 | [] | no_license | function Printer(ppm) {
this.rate = ppm;
this.currentTask = null;
this.remainingTime = 0;
this.tick = () => {
if (this.currentTask) {
this.remainingTime = this.remainingTime - 1;
if (this.remainingTime === 0) this.currentTask = null;
}
}
this.busy = () =... | true |
e583fe83974af9c47d2c5a60ac5fc99e1bd795fe | JavaScript | phembarl/Banka | /server/controllers/transactions.js | UTF-8 | 5,774 | 2.859375 | 3 | [] | no_license | import db from '../models/db';
/**
*This class handles transactions
* @class Transaction
*/
class Transaction {
/**
* @static
* @description this function displays all transactions
* @param {object} request
* @param {object} response the response body
* @returns response
* @memberof Transaction
... | true |
e7d0a568ea4fe085570b1d17b3c86ba27b6eac87 | JavaScript | darichailu/react-s3-chunk-upload | /app/assets/javascripts/components/repository-table-row-file.js.jsx | UTF-8 | 3,500 | 2.671875 | 3 | [] | no_license | RepositoryTableRowFile = React.createClass({
constants: {
ESCAPE_KEY: 27,
ENTER_KEY: 13
},
getInitialState: function() {
return({
editing: false,
file_name: this.props.file.name,
edited: false,
loading: false
});
},
edit: function(){
this.setState({
editing... | true |
7764216df847a79476bd72032aea8fe99229ef73 | JavaScript | angusovo/react-project-autocarsale | /src/Validation/FormValidation.js | UTF-8 | 2,111 | 2.53125 | 3 | [] | no_license | import * as yup from "yup"
export const formSchema = yup.object().shape({
carModel:
yup.string().min(2, "Must be at least 2 characters")
.max(30, "Must be at most 30 characters")
.required("Required"),
seat:
yup.string()
.matches(/^[0-9]+$/, "Must be only digits")
.min(1, 'Must be e... | true |
6c99edd68b273cf6cae0c2c2f3e094cd23e7f514 | JavaScript | ChristopherJonMyers/Mesh | /main.js | UTF-8 | 2,163 | 3 | 3 | [] | no_license | // Creating a new user
function createUser() {
let _username = document.getElementById("username").value;
let _pass = document.getElementById("pass").value;
let _passCheck = document.getElementById("passCheck").value;
let _firstName = document.getElementById("userFirst").value;
let _lastName... | true |
06841e969f4c38518ac2316935bf90b668434086 | JavaScript | ayv8er/node-api3-project | /api/users/users-router.js | UTF-8 | 2,082 | 2.640625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | const express = require("express");
const {
validateUserId,
validateUser,
validatePost,
} = require("../middleware/middleware");
const Users = require("./users-model");
const Posts = require("../posts/posts-model");
const router = express.Router();
router.get("/", (req, res, next) => {
Users.get()
.then(... | true |
95bec92ed3bcc19426a0cee01cd237cd78eb976c | JavaScript | eternidad33/WX_code | /ex8/ex801/pages/index/index.js | UTF-8 | 1,282 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | // pages/zj/FacialMakeup/index.js
function createRandomIndex() { //定义产生随机数的全局函数
return Math.floor(Math.random() * 10); //产生0—9之间的随机整数
}
Page({
data: {
index: 0, //初始化脸谱图片数组下标为0
imgArr: [ //脸谱图片数组
'../images/01.jpg',
'../images/02.jpg',
'../images/03.jpg',
'../images/04.jpg',
'... | true |
f568ef389239c5354574fb7b0818313c97266adc | JavaScript | Jeanpigi/Typescript | /types-typescript/dist/void.js | UTF-8 | 976 | 3.5 | 4 | [
"MIT"
] | permissive | "use strict";
//Void
//tipo explicito
function showInfo(user) {
console.log('User Info', user.id, user.username, user.firstName);
// return 'hola';
}
showInfo({ id: 1, username: 'jpg', firstName: 'Jean Pierre' });
//tipo inferido
function showFormattedInfo(user) {
console.log('User Info', "\n id: " + use... | true |
44339d873636768d933a5161012ce9a32c666159 | JavaScript | CalleAlexanderson/Persona-4-Quiz | /quiz.js | UTF-8 | 809 | 3.15625 | 3 | [] | no_license | document.querySelector(".försök").innerHTML = localStorage.getItem('score');
function Rätta(){
let poäng = 0;
let answers = document.querySelectorAll("input[type='radio']:checked");
for (let index = 0; index < answers.length; index++) { //Förstår inte riktigt den här, bara kopierat
poäng += parseInt... | true |
e10177b360b6ad5ffdd37789d444266da7d1ef23 | JavaScript | hillary26121/Book-Store-App | /client/src/Components/BookDetails.jsx | UTF-8 | 1,813 | 2.609375 | 3 | [] | no_license | import axios from 'axios';
import { useState, useContext, useEffect } from 'react';
import { useParams } from 'react-router-dom';
import { AccessTokenContext } from "../Context/AccessTokenContext";
import { AccessTokenProvider } from "../Context/AccessTokenContext";
function BookDetails(){
const {getToken, logO... | true |
57d6b9bef5d4f87c0befad6acd34deef056d7300 | JavaScript | michaelklopf/NodeAuthBackboneReact | /static/js/views/example_component.js | UTF-8 | 3,181 | 2.796875 | 3 | [] | no_license | /**
* @jsx React.DOM
*/
// static/js/views/example_component.js
var app = app || {};
var Example = React.createClass({
handleDelete : function(example_id) {
this.props.onDelete(this.props.example_id);
},
render : function() {
return(
<div className="exampleContainer">
<ul>
<li>{... | true |
b12091bdb0aaab8e84983d0257a655429744baeb | JavaScript | smartherd/Node-Get-Started | /4.1-timers/4-task1.js | UTF-8 | 146 | 3.109375 | 3 | [] | no_license | const myFunc = () => {};
setTimeout(myFunc, 5 * 1000);
// Hello after 5 seconds
// Hello after 10 seconds
// You can define only ONE function
| true |
8b5fb50437138668ed0ef6612e70fb254892bd03 | JavaScript | mattsilv/recipe | /public/javascripts/app/services/nutritionix-api.service.js | UTF-8 | 2,531 | 2.6875 | 3 | [] | no_license | 'use strict';
/**
*
* Nutritionix API Wrapper for Angular JS
*
* Author: James R. Qualls <jqualls@nutritionix.com>
* Copy: MIT 2013-2014 Nutritionix LLC.
*
*/
angular.module('nutritionix', [])
.factory('nixApi',['$http',function($http){
var base_url = "https://api.nutritionix.com";
var appId = null;
var... | true |
cb692f242e03a1d7f4c5679912d2afb368e9f79d | JavaScript | johnrohan87/JS-Learn-The-DOM | /exercises/06-Create-DOM-Element-Second/index.js | UTF-8 | 196 | 2.828125 | 3 | [] | no_license | //you code here
document.body.innerHTML = "<h1>Hello World</h1>";
var list = document.getElementsByTagName("H1")[0];
list.innerHTML = '<img src="http://placehold.it/350x150" alt="place holder">';
| true |
3a822ade7ed3024fbe3ec81c9e59b1afc1a77ac7 | JavaScript | SurenderLohia/data-structure-algorithm | /test/stack.js | UTF-8 | 800 | 3.21875 | 3 | [] | no_license | var Stack = require('./../src/stack');
var expect = require('chai').expect;
describe('Stack', function() {
let myStack;
this.beforeEach(function() {
// Basic setup
myStack = new Stack();
myStack.push(1);
myStack.push(2);
myStack.push(3);
});
it('#push should add element on top of the stac... | true |
8b230253fa8dbb84106bf46fee21221e8fd35062 | JavaScript | jamesflorentino/wol.js | /src/game/base.js | UTF-8 | 3,111 | 2.640625 | 3 | [
"MIT"
] | permissive | define([
'wol/wol',
'wol/game',
'game/hexgrid',
'game/textures/elements',
'game/hex',
'game/components/hexgrid',
'wol/keys',
'game/components/unit'
], function(wol, Game, HexGrid, elements, Hex, HexGridComponent, Keys, UnitComponent) {
"use strict";
var URI_BACKGROUND = 'medi... | true |
468267150cb2a3669943a87c25af5db40c8608e1 | JavaScript | HauntedSmores/collection-hero | /src/components/Pagination/index.js | UTF-8 | 1,785 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react'
import styles from './Pagination.module.css'
class Pagination extends Component {
constructor(props) {
super(props)
let pages = Math.ceil(props.count / props.perPage)
this.state = {
pages: [],
active: this.props.acti... | true |
295cc654579e3b09f4897d51b10658f7b9f9d989 | JavaScript | DaneTheory/ChesterGL | /chesterGL/blockFrames.js | UTF-8 | 3,756 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* chesterGL - Simple 2D WebGL demo/library
*
* Copyright (c) 2010-2012 Rolando Abarca
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limit... | true |
cc86549de232cb3d079b485d6a711ebc0cc6d288 | JavaScript | houyhea/lab | /zy_tank/js/Explode.js | WINDOWS-1252 | 777 | 2.828125 | 3 | [] | no_license | //ըЧ
Explode=function()
{
this.container=document.getElementById("divMap");
this.UI=null;
this.step=8;
this.speed=50;
}
Explode.prototype.Play=function(x,y)
{
this.UI=UtilityClass.CreateE("div","","explode",this.container);
this.MoveTo(x,y);
var i=0;
var This=this;
var FxTimer=setI... | true |
43a3599260b19bfa7e97ae361bf7088f6de3c16b | JavaScript | uclaacm/TeachLAFrontend | /src/actions/userDataActions.js | UTF-8 | 4,444 | 2.578125 | 3 | [
"MIT"
] | permissive | import history from '../history';
export const LOAD_USER_DATA = 'LOAD_USER_DATA';
export function loadUserData(uid, userData) {
// add uid to the userData object
return { type: LOAD_USER_DATA, userData: { ...userData, uid } };
}
export const CLEAR_USER_DATA = 'CLEAR_USER_DATA';
export function clearUserData() {
... | true |
168678135f563f30f4d1bf5cc314561dc99f4545 | JavaScript | sukyoung/safe | /tests/test262/15.4/15.4.4/15.4.4.14/15.4.4.14-3-14.js | UTF-8 | 528 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | function testcase()
{
var objOne = {
0 : true,
1 : true,
length : "Infinity"
};
var objTwo = {
0 : true,
1 : true,
length : "+Infinity"
};
var objThree = {
0 : true,
1 : true,
length : "-Infinity"
};
return Array.prototype.indexOf.ca... | true |
0f2cd0a4b463220430be2e63be409298de598d03 | JavaScript | amitk2016/flytothelimit | /js/patterns.js | UTF-8 | 284 | 2.84375 | 3 | [] | no_license | //Patterns to use in validation
var namePattern = new RegExp("^[a-zA-Z' .-]{1,50}$");
var phonePattern = new RegExp("^(?:[0-9]●?){6,14}[0-9]$");
var emailPattern = new RegExp ("^[a-zA-Z0-9._-]*[@][a-zA-Z]*\.[a-zA-Z]{2,6}$");
var cityPattern = new RegExp("^[a-zA-Z\s-]+$"); | true |
dd3985491ba6d2e7bba7b307a842d478e79d0e12 | JavaScript | radioDevCreations/wsei-javascript-zadania-master | /wsei-javascript-zadania-master/11.DOM-wyszukiwanie/script.js | UTF-8 | 697 | 3.5 | 4 | [] | no_license | //Radosław Rozmus 12452 - DOM-wyszukiwanie
//Zadanie 1
const lists = document.querySelectorAll('.list');
console.log(lists);
//Zadanie 2
function SearchTag(tag){
const tags = document.querySelectorAll(tag);
console.log(tags);
}
SearchTag("li");
//Zadanie 3
var list = document.getEleme... | true |
eaf0b4782f42d8e5051635cf67e1e1a54d7c06a2 | JavaScript | sejalvyas13/Web-programming-I | /Lab 7/cs-546a-lab7/routes/likes.js | UTF-8 | 907 | 2.5625 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const data = require("../data");
const animalsData = data.animals;
const postsData = data.posts;
const ObjectID = require('mongodb').ObjectID;
router.post("/:animalId", async (req, res) => {
try {
console.log("postId" + req.query.postId)... | true |
79dc3c961266ae1b4204aea863568f7d62be1c85 | JavaScript | johniyere/Synnefo | /public/jqueryFiles/uploadBtn.js | UTF-8 | 929 | 2.984375 | 3 | [] | no_license | // On page load use the script.
$(function(){
// Get the information from the file upload.
$(".input-group").on('change', '.btn-file :file', function() {
// Get the intput.
var input = $(this);
// Get the amount of files selected.
var filesCount = input.get(0).files ? input.get(0).files.length : 1;... | true |
1eecbef9e726f2d072048c561d6d0dd61bde98d0 | JavaScript | Clo74/cloud_storage | /src/main/webapp/js/start.js | UTF-8 | 947 | 2.53125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//<c:import url="./login.jsp"/>
//leggo se esiste un token su local store
//se non esiste lancio la login e disabilito il menu
impo... | true |
3a5f4375e11479ecbe3aeecd1d5868198329f444 | JavaScript | lixueiq911/react-express-mogoonse-antd-mobile | /src/index2.js | UTF-8 | 1,017 | 3.140625 | 3 | [] | no_license | import { createStore } from 'redux'
/*
1、新建store
2、通过reducer建立
3、根据老的state 和action 生成新的state
*/
function counter(state=0,action){
switch(action.type){
case '加机关枪':
return state + 1;
case '减机关枪':
return state - 1;
default :
return 10;
... | true |
b2fbd113e48e23ac702e0e335b5fdb3b90acbf4d | JavaScript | ikutatoma/js-practice-code | /6-21.js | UTF-8 | 1,369 | 3.5625 | 4 | [] | no_license | function readUserInput(question) {
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
return new Promise((resolve, reject) => {
readline.question(question, (answer) => {
resolve(answer);
readline.close();
});
});
}
// メイン処理
(async... | true |
f6431c79108dfda86e1afc12790c393347453696 | JavaScript | larry1000/String_Calculator | /stringCalculator.js | UTF-8 | 1,576 | 3.359375 | 3 | [] | no_license | let calculator = (function() {
function add(numString) {
if (numString === "") {
return 0;
}
const delimiter = getDelimiter(numString);
const formattedInput = formatInput(numString);
return sum(getNumbers(formattedInput, delimiter));
}
function formatInput(input) {
const delimiterRe... | true |
5070d7da41b7ced04671657eca0a8e9e30cd64ef | JavaScript | oldThing/practice | /public/js/classify.js | UTF-8 | 2,402 | 2.640625 | 3 | [] | no_license | //增加操作
function addClassifyOK() {
// alert(123);
var column_name = document.getElementById("column_name").value;
var postData = {
"method": 'addColumn',
"column_name": column_name
}
var postData = (function (obj) {
var str = "";
for (var prop in obj) {
st... | true |
c27be2efad6ee5f85af63c79ed668164db156eef | JavaScript | f1sst36/Image-processing | /script/profile.js | UTF-8 | 1,175 | 2.609375 | 3 | [] | no_license | var profileOn = false;
let TurnOnProfile = () => {
profileOn = true;
}
canvParent.addEventListener('click', (e) => {
if(!profileOn) return;
let x = e.offsetX;
let y = e.offsetY;
let h = width * (y - ((canv.height - height) / 2)) * 4;
let arrayPixels = {
r: [],
g: [],
b: [],
}
for(let i = h + 1; i < (... | true |
f07eb8bf159a0b8fdc000dd6ea0811148bfbf633 | JavaScript | apertium/apertium-webext | /src/lib/translate.js | UTF-8 | 7,070 | 2.703125 | 3 | [] | no_license | function addHoverTag(targetLanguage, sourceLanguage) {
// (?![^<]*?>)([A-z0-9']+)
// - (?![^<]*?>) to not consider any html elements. or rather, to not consider anything wrapped in <>. But since all <'s are coded as < in html, it only affects tags
// - ([A-z0-9']+) apart from elements, we consider all wo... | true |
53c92ce7a91287d903995ca39fd7f815f020501a | JavaScript | ivankatliarchuk/jsessentials | /essentials/src/memoryhoisting.js | UTF-8 | 160 | 2.96875 | 3 | [] | no_license | //console.log(myName, printName());
var myName = 'Lawrence';
function printName() {
var a = 100;
return "John Doe";
}
module.exports = {printName}; | true |
4cab10cb70ed122c7376f22dc84cd067d862d729 | JavaScript | ksharifbd/currency-exchanger | /src/utils/__tests__/currencyConverter.spec.js | UTF-8 | 2,033 | 2.625 | 3 | [
"MIT"
] | permissive | import currencyConverter from '../currencyConverter';
describe('Currency Converter', () => {
const data = [
{
input: undefined,
output: [
{
from: {
currency: 'GBP',
value: 1,
},
to: {
currency: {
EUR: 1,
... | true |
cff36be3df2924e0ffffa16855dc9bb620f165d3 | JavaScript | theharveyz/bmqb-mns | /src/mq_msg.js | UTF-8 | 2,052 | 2.53125 | 3 | [] | no_license | import _ from 'lodash';
const priorityMapping = {
mns: {
low: 2,
normal: 8,
high: 12,
critical: 16,
},
};
const msgMeta = {
id: null,
msg: {
adapter: 'mns',
delay: 0,
priority: 'normal',
content: null,
},
enqueueTime: 0, // 入队列时间
nextVisibleTime: 0, // 下次可见时间
rawMsg: nu... | true |