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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a45faf9024d9aa6b8cb41dedc15f2c1c419a72f8 | JavaScript | Database-Project-Group-CSE18/Back-End-NodeJS | /models/bankCardModel.js | UTF-8 | 2,039 | 2.640625 | 3 | [] | no_license | const db = require('../config/database');
const Cryptr = require('cryptr'); // a library to encrypt the bank card details
const cryptr = new Cryptr(process.env.CryptR_key);
const getBankCards = (userID)=>{
return new Promise((resolve, reject) => {
const query = "SELECT * FROM BankCard where customer_id... | true |
883ddd5caee038d930908f7c83b07c0b9ff19950 | JavaScript | habibun/javascript | /src/Core/array/methods/concat.js | UTF-8 | 314 | 4.34375 | 4 | [
"MIT"
] | permissive | /**
* The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.
*/
var arr1 = ["a", "b", "c"];
var arr2 = ["d", "e", "f"];
let res = arr1.concat(arr2);
console.log(res);
// results in a new array [ "a", "b", "c", "d", "e", "f" ]
| true |
fa98a0354aec3b3074c4bd76bcb65190697d2d6b | JavaScript | sdonich/react-hooks-codedojo | /src/pages/UseState/Counter.jsx | UTF-8 | 555 | 2.625 | 3 | [] | no_license | import React from 'react';
export default function Counter() {
const [count, setCount] = React.useState(0);
const increment = () => setCount(count + 1);
const decrement = () => setCount(count - 1);
return (
<div className="counter">
<div className="count">{count}</div>
... | true |
7000388290e1674dcd8c3c505af8191dbfcc9b22 | JavaScript | usedtobeme/rappeler-front-end | /src/utils/Functions.js | UTF-8 | 4,720 | 2.765625 | 3 | [] | no_license | export const transformTime = time => {
time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [
time
];
if (time.length > 1) {
time = time.slice(1);
time[5] = +time[0] < 12 ? " AM" : " PM";
time[0] = +time[0] % 12 || 12;
}
return time[0] + time[1] + time[2] + time[5];
};... | true |
9af04e1b489389e822c3a277c707d51fc5eeeec0 | JavaScript | ayushdutta10/c46 | /sketch.js | UTF-8 | 2,261 | 2.921875 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
var boyLeft, boyRight, boyStanding
var blackC, blueC, brownC, greenC, purpleCv2, purpleC, rainbowC, redC, whiteC, yellowC;
var m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21;
var engine,world;
function... | true |
3c253afe0ff1c2a095c1f01682200a27effb4e25 | JavaScript | JCansta/holbertonschool-higher_level_programming | /0x15-javascript-web_jquery/7-script.js | UTF-8 | 176 | 2.6875 | 3 | [] | no_license | // JS scipt that fetches the character name from an url
$.getJSON("https://swapi-api.hbtn.io/api/people/5/?format=json", function({name}) {
$("#character").text(name);
});
| true |
d32fc2aa32fe52188882f9ef9508696e773df37c | JavaScript | houdiniam/geodatin | /src/components/questions/Question1.jsx | UTF-8 | 1,281 | 3.53125 | 4 | [] | no_license | import React, {useState} from 'react'
import Main from '../templates/Main'
//Var que irá exibir o número de letras no input
var count = 0;
function Question1(props){
//Const que exibirá o que foi digitado pelo usuário
const [text, setText] = useState('');
//Função que atualizará o input com o que o ... | true |
9078c7ba3a8cde68d4fa39fdb38037beb66a402b | JavaScript | fccgszn/redux-tutorial | /07_dispatch-async-action-1.js | UTF-8 | 3,357 | 3.734375 | 4 | [] | no_license | // 第7节 - dispatch-async-action-1.js
// 我们先前看到的我们如何dispatch action并且我们如何将这些actions修改的。
// 我们感谢这些reducers来处理我们应用的state
// 但是到目前为止,我们仅仅只是考虑了同步点actions情况,或者更精确的说是同步的action creators
// 这会制造同步的action:当我们调用它 action会立即返回。
// 让我们一起想想如何做一个简单的异步模型。
// 1)用户点击一个Say Hi的按钮2秒钟
// 2)当按钮A点击后,我们希望2秒钟后看到HI
// 3)2秒钟后,我们的界面被信息Hi刷新。
// 当... | true |
b9a07576abf69e6081fa0a5c810c5dccc617af16 | JavaScript | jdorfman/react-toggled | /src/index.js | UTF-8 | 2,708 | 2.796875 | 3 | [
"MIT"
] | permissive | import {Component} from 'react'
import PropTypes from 'prop-types'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn && fn(...args))
const noop = () => {}
class Toggle extends Component {
static propTypes = {
defaultOn: PropTypes.bool,
on: PropTypes.bool,
onToggle: PropTypes.func,
childr... | true |
30408d1de3c946cec21c3dbd7450fe1a62940446 | JavaScript | halfed/projects | /web-examples/javascript/backbone-examples/class-list-example/js/models/list.js | UTF-8 | 570 | 2.703125 | 3 | [] | no_license | /*global Backbone */
var listApp = listApp || {};
// List Model
// ----------
// Model contains student name, grade and if failing.
listApp.List = Backbone.Model.extend({
// Default attributes for the class List
// and ensure that each person created has 'name', 'grade', and 'failing' keys.
defaults: {
... | true |
b360ef9f6b2e5647e5779a4eebe46eb29bc98ee9 | JavaScript | fistozvoti/bootcamp-terminal-tests | /mostProfitableDepartment.js | UTF-8 | 629 | 2.5625 | 3 | [] | no_license | module.exports = function (mostProfit) {
var mostProfitable = 0;
var mostProfitableDept = '';
var departmentProfit = {};
for (var i = 0; i < mostProfit.length; i++) {
if (departmentProfit[mostProfit[i].department] === undefined) {
departmentProfit[mostProfit[i].department] = 0;
... | true |
eab346c6b06ada14f6ca17859e8cbc02c2bc7ba3 | JavaScript | miketikh/crypto-trade-router | /client/src/utils/axiosHandlers.js | UTF-8 | 3,283 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import axios from 'axios';
const server = axios.create({
baseURL: process.env.SERVER_URL || 'http://localhost:4001',
});
/**
* Maps all connections between coins from binance, called on load
* Creates connectionHolder Object which holds:
* tradeCoins: Object with all coins connected to a tradeCoin. Ex: 'REQ'... | true |
cc72dbef9832ebd9936b53024df5142af0374c44 | JavaScript | franklinpr2010/poc_ExpressaoRegular | /caracteres/Metacaracteres.js | UTF-8 | 474 | 3.375 | 3 | [] | no_license | // . ? * + - ^ $ | [ ] { } ( ) \ :
const texto = '1,2,3,4,5,6,a.b c!d?e'
//Usando o ponto como o valor literal com ESCAPE ('\')
const regexPonto = /\./g
console.log(texto.split(regexPonto))
//Colocando a virgula que não é um metacaractere, Ou ( \| ), Ou ( \. ) Ou ( \? ) Ou (!) Ou / (Espaço)
// g - Flag Global vai acha... | true |
1fb3dd0a38a77c936677077fa5904d8813be34dc | JavaScript | CodyAu/MealTeam6 | /functions.js | UTF-8 | 8,438 | 3.25 | 3 | [] | no_license | let checkout = new Map(); // checkout map object, maps store object to an array of checkout item objects selected from that store
let itemsInCart = 0;
//Allow home button to bring you to the home page
var homeButton = document.getElementById("home_b");
homeButton.addEventListener('click', function (hp) {
setPage("... | true |
cb3d94595be8a70fa43b8d0ffd0a3195fe442dfa | JavaScript | sinewtech/taxi_functions | /functions/index.js | UTF-8 | 20,301 | 2.515625 | 3 | [] | no_license | const functions = require("firebase-functions");
const admin = require("firebase-admin");
const express = require("express");
const fetch = require("node-fetch");
const consts = require("./Constants");
const API_KEY = "AIzaSyApNgtxFBp0SXSHljP_xku6peNCzjTFWM4";
const REFERENCE_RADIUS = 100;
const location = express();
v... | true |
189c7d74c21dc6cf04e0e92cd6b0e6193b7703a2 | JavaScript | olegkhazanov/nodejs | /weather-app/geocode/geocode.js | UTF-8 | 1,219 | 2.65625 | 3 | [] | no_license | const request = require('request');
var geocodeAddress = (address, callback) => {
var encodedAddress = encodeURIComponent(address);
request ({
url: `http://www.mapquestapi.com/geocoding/v1/address?key=hhARyAjcGamnYAa7fpiwyO8HrE69F6ai&location=${encodedAddress}`,
json: true
}, (error, resp... | true |
a5926f8d9ef2fb5eb7002ba159ac0b089533f055 | JavaScript | Protonull/js-utilities | /main.js | UTF-8 | 8,016 | 3.265625 | 3 | [
"MIT"
] | permissive | "use strict";
// ------------------------------------------------------------ //
// Miscellaneous
// ------------------------------------------------------------ //
Object.defineProperty(exports, "__esModule", { value: true });
exports.setTotalHeight = exports.setTotalWidth = exports.parseDate = exports.stringSort = ex... | true |
739c241269db115594baff7fd791f916abeab2e2 | JavaScript | cquevedod/bookshelf-backend | /middlewares/auth.js | UTF-8 | 854 | 2.515625 | 3 | [] | no_license |
const jwt = require('jwt-simple');
const moment = require('moment');
const msg = require('../controllers/statusMsg');
const secret = 'one_second'; // secret key to hash createToken object
module.exports = function (req, res, next) {
if (!req.headers.authorization) {
return res
.status(401)
.send('Ac... | true |
09259eee3b491bfa2b2de89058e245ef5bf907d1 | JavaScript | RM66/leetcode-may-challenge | /Week 1/May5th.js | UTF-8 | 1,185 | 3.390625 | 3 | [] | no_license | /**
* @param {string} s
* @return {number}
*/
var firstUniqChar = function (s) {
var notUniq = [];
for (var i = 0; i < s.length; i++) {
var c = s[i];
if (notUniq.includes(c)) continue;
var pos = s.indexOf(c, i + 1);
if (pos === -1) return i;
else notUniq.push(c);
}
return -1;
};
/*
104 /... | true |
39b564089955dbfa7f251dbcd201faf0b1664e26 | JavaScript | Lightnet/USlimeDungeon2D | /Assets/scripts/js/Progressbar.js | UTF-8 | 878 | 2.59375 | 3 | [
"CC-BY-4.0"
] | permissive | import UnityEngine.UI; // Force unity to laungh the UI components
#pragma strict
//var foregroundImage : UnityEngine.Transform;
var foregroundImage:UnityEngine.UI.Image;
var count :float = 0;
var bcount: boolean = true;
function Start () {
//foregroundImage = gameObject.GetComponent(UnityEngine.UI.Image) as Unit... | true |
9d609e2ad59b19c381a1fca41982f173884f66a2 | JavaScript | lambry/batchpress | /assets/scripts/admin.js | UTF-8 | 3,056 | 2.6875 | 3 | [] | no_license | /* Run updater */
(function($) {
let ajax = null
let form = null
const bp = $('.batchpress')
const upload = $('.batchpress-upload')
const message = $('.batchpress-message')
const log = $('.batchpress-log')
const nonce = bp.data('nonce')
// Events
bp.on('click', '.batchpress-option', option)
bp.on('... | true |
6dda60d04f78117f0e7c9c4e0666c2c98adf66d4 | JavaScript | ANYALGO/ANYALGO | /code/js/128.longestConsecutive.js | UTF-8 | 365 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | /**
* @param {number[]} nums
* @return {number}
*/
let longestConsecutive = function (nums) {
const set = new Set(nums);
let max = 0;
for (const num of nums) {
let count = 0;
let temp = num;
while (set.has(temp)) {
count++;
temp--;
}
max = M... | true |
0d75e0f9db909e3a5779f8f21acc992d819728f3 | JavaScript | andrewsnapz/algorithms | /LeetCode/runningSum.js | UTF-8 | 182 | 3.296875 | 3 | [] | no_license | var runningSum = function (nums) {
let sum = 0;
let sumArr = [];
for (let i = 0; i < nums.length; i++) {
sum = sum + nums[i];
sumArr.push(sum);
}
return sumArr;
};
| true |
512db77556601ceede787716bc5270bbc6b1b505 | JavaScript | rcatwr/guitar-shop-app | /src/components/Nav.js | UTF-8 | 2,314 | 2.703125 | 3 | [] | no_license | import React from "react";
import { useSelector } from "react-redux";
import { Link, useLocation } from "react-router-dom";
const Nav = () => {
const { pathname } = useLocation();
// get orders from redux store
const orders = useSelector((state) => state.orders);
// sorting logic as an object
// parameter ... | true |
bd85b9fcad28f7acdce44cacaed5eabb25623765 | JavaScript | manualweb/manual-javascript | /numeros/number/convertir-entero-con-base.js | UTF-8 | 202 | 3.140625 | 3 | [] | no_license | let numero = '10';
let numero_convertido = Number.parseInt(numero);
console.log(numero_convertido + 1);
let numero_convertido_base = Number.parseInt(numero,2);
console.log(numero_convertido_base + 1); | true |
4dc9c77c2ccb3b7c11c5e8d61066bfd161346268 | JavaScript | Mikatto/JS-courses-tasks | /11 "products render"/script.js | UTF-8 | 2,781 | 3.078125 | 3 | [] | no_license | let kitchenProducts = [
{
type: 'grater',
price: 10
},
{
type: 'pastry-bag',
price: 25
},
{
type: 'scale',
price: 5
},
{
type: 'whisk',
price: 15
}
];
let devicesProducts = [
{
type: 'desktop',
price: [10... | true |
b9b74b4a88d8a8203a9cd2ab8ea826ec4484055f | JavaScript | AnnaBurova/proj--design | /_STYLE--static_HTML/0001/script.js | UTF-8 | 292 | 2.515625 | 3 | [] | no_license | function noStyles() {
document.styleSheets[0].disabled = true;
document.styleSheets[1].disabled = true;
document.styleSheets[2].disabled = true;
document.styleSheets[3].disabled = true;
}
function reStyle(n) {
noStyles();
document.styleSheets[n].disabled = false;
}
reStyle(0);
| true |
4bf44f1a795b78f77201b0926fff1bedecf655ff | JavaScript | TheTeck/JustPuzzles | /src/pages/PuzzlePage/PuzzlePage.jsx | UTF-8 | 1,537 | 2.578125 | 3 | [
"MIT"
] | permissive | import React, { useState } from 'react'
import { useLocation, useParams, useHistory } from 'react-router-dom'
import ColorSelector from '../../components/ColorSelector/ColorSelector'
import Timer from '../../components/Timer/Timer'
import Puzzle from '../../components/Puzzle/Puzzle'
import './PuzzlePage.scss'
export d... | true |
6ac48e75fbd3a54e326479c93ced070c5fcc69ab | JavaScript | sweetje5us/greendata-app | /src/table/ReactTable.jsx | UTF-8 | 3,650 | 2.546875 | 3 | [] | no_license | import React, { useEffect } from 'react';
import { useTable, useRowSelect } from 'react-table'
// Добавляем Столбец с чекбоксами
const IndeterminateCheckbox = React.forwardRef(
({ indeterminate, ...rest }, ref) => {
const defaultRef = React.useRef()
const resolvedRef = ref || defaultRef
useEffect(() => ... | true |
2c9fc4e0b5a15748c5cc7fbc401d77cce7f7087b | JavaScript | prasadmadu/Vanilla_JS_Game_Memory_Game | /app.js | UTF-8 | 2,881 | 3.21875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", () => {
const cardArray = [
{
name: "flag1",
img: "./images/1.png"
},
{
name: "flag1",
img: "./images/1.png"
},
{
name: "flag2",
img: "./images/2.png"
},
{
name: "flag2",
img: ".... | true |
dcee71543e1e4146857a79a069e0065dd728cf30 | JavaScript | gcostacoelho/Calc_matrix | /Calculadora/Aula2-Calc.js | UTF-8 | 1,034 | 4.25 | 4 | [] | no_license | var primeiroValor = parseFloat(prompt('Insira o Primeiro valor: '))
var operacao = prompt ('Insira a operação desejada:\nX = Multiplicação\n/ = Divisão\n+ = Adição\n- = Subtração')
var segundoValor = parseFloat(prompt('Insira o segundo valor: '))
//parseFloat para tranformar as strings em numbers Float ou Int
if (oper... | true |
2da224907b52da1a6b122538fff3a19cbdb28576 | JavaScript | reikrom/codewars-solutions | /8-kyu/find-the-smallest-integer-in-the-array/javascript/solution.js | UTF-8 | 111 | 2.84375 | 3 | [] | no_license | class SmallestIntegerFinder {
findSmallestInt(args) {
args.sort((a,b)=> a - b);
return args[0];
}
} | true |
b42ee21d00fe71845de0be46b9464c0b24e8e2bc | JavaScript | dieharders/example-css-grid | /app.js | UTF-8 | 4,342 | 3.09375 | 3 | [] | no_license | // Banner stuff
function goGitHub() {
window.open('https://github.com/dieharders/example-css-grid', '_blank');
}
// Grid container reference
var g = document.getElementById('example1');
// 'Try it' buttons
function doAddItem() {
let rand = Math.random();
let colorList = ['#38a5ff', '#ffe54f', '#eb4b2f', '... | true |
e99dae21f7f3e4fc9be3ce606804cb3a0e542ed1 | JavaScript | MarkSort/marksort-html | /marksort.js | UTF-8 | 489 | 2.984375 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', () => {
// Get "navbar-burger" element
const navbarBurger = document.querySelector('.navbar-burger');
const navbarMenu = document.querySelector('.navbar-menu');
// Add a click event
navbarBurger.addEventListener('click', () => {
// Toggle the "is-acti... | true |
bf63314f64aee32d82944cccb014d4e534300b45 | JavaScript | laurenrosie/javascript_day1_airport | /src/plane.js | UTF-8 | 257 | 3.046875 | 3 | [
"MIT"
] | permissive | function Plane(id) {
this._id = id;
this._state = 'Flying';
}
Plane.prototype.state = function() {
return this._state;
}
Plane.prototype.id = function() {
return this._id;
}
Plane.prototype.newState = function(string) {
this._state = string;
}
| true |
ed10b5d337854ab05aca04550534ea4b5131a483 | JavaScript | rmadhavan25/barter-web | /src/views/explore.js | UTF-8 | 615 | 2.515625 | 3 | [] | no_license | import { useEffect,useState } from "react";
import ProductList from '../components/productList';
const Explore = () => {
const [products, setProducts] = useState(null)
useEffect(() => {
fetch('http://localhost:3000/products')
.then(res => {
return res.json();
})
.t... | true |
9b24100506af40a5a647952d6b787b364bf5e355 | JavaScript | halid-durakovic/substance | /ui/ContainerAnnotator.js | UTF-8 | 1,738 | 2.578125 | 3 | [
"MIT"
] | permissive | 'use strict';
var oo = require('../util/oo');
var _ = require('../util/helpers');
var Component = require('./Component');
var ContainerEditor = require('./ContainerEditor');
var $$ = Component.$$;
/**
Represents a flow annotator that manages a sequence of nodes in a container. Instantiate
this class using {@link ... | true |
cb001f6c18468dbcd9ac25880de7bbf1ac5538fa | JavaScript | vanribeiro/vanribeiro.github.io | /00-anos-anteriores/2020/js/portfolio/tag-status.js | UTF-8 | 1,236 | 2.71875 | 3 | [
"MIT"
] | permissive | const tagStatus = () => {
let statusTag = document.querySelectorAll('.status');
for(let i = 0; i < statusTag.length; i++){
let status = '';
status = statusTag[i].textContent;
switch (status) {
case 'concluído':
statusTag[i].style.backgroundColor = '#2f963b... | true |
c77f10c1a49e7936ab83a38acc076cfa2352890c | JavaScript | ApiBootstraper/pusher-server | /model/channels.js | UTF-8 | 2,613 | 2.734375 | 3 | [
"MIT"
] | permissive | var Channel = function(id, name) {
this.name = name;
this.id = id;
this.users = new Users(this.name);
this.created = new Date().getTime();
// Wrapper for Users.addUser
this.addUser = function(user) {
this.users.addUser(user);
};
// Wrapper for Users.getUser
this.getUser = f... | true |
438fd93330f1f682c6334128d677be4bf25e50e2 | JavaScript | DaniilKadezevich/social_network | /server/modules/formValidation.js | UTF-8 | 503 | 3 | 3 | [] | no_license | const { REGEXPS } = require('../constants');
function formValidation(userObj) {
let {name, surname, middleName, email, age, gender} = userObj;
let isFormValid = (
REGEXPS.name.test(name) &&
REGEXPS.surname.test(surname) &&
(REGEXPS.middleName.test(middleName) || middleName === '') &&
... | true |
5670422e49a451b40e7d9b384d9d82d5b2d4a4b6 | JavaScript | meiminjun/Javascript | /我的框架/thin-master/js/modules/role/vm/orgViewModel.js | UTF-8 | 2,877 | 2.75 | 3 | [] | no_license | thin.define("OrgViewModel", ["TreeGrid"], function (TreeGrid) {
function OrgViewModel() {
this.state = "View";
this.enableForm = false;
this.editing = false;
this.genderArr = [
{
key: "0",
label: "Female"
},
{
key: "1",
label: "Male"
}
];
}
OrgViewModel.prototype = {
init: f... | true |
011a2b4c0da8f447a9c56c1ffaa48cf8f413f399 | JavaScript | PedroOthinus/Minor-JS-projects | /form-validator/JS/main.js | UTF-8 | 1,756 | 3.265625 | 3 | [] | no_license | const formElement = document.getElementById("form");
const usernameInput = document.getElementById("username");
const emailInput = document.getElementById("email");
const passwordInput = document.getElementById("password");
function showError(input, message) {
const actualForm = input.parentElement;
const smallTex... | true |
367c6d85d81f51c99954dfb3dfbbf81dfe54fbc9 | JavaScript | MischaGithub/Github-Finder-Project | /src/components/users/Search.js | UTF-8 | 1,550 | 2.890625 | 3 | [] | no_license | // All the imported files
import React, { useState, useContext } from "react";
import GithubContext from "../../context/github/githubContext";
import AlertContext from "../../context/alert/alertContext";
// Converted a Search class to a functional component and using the useState Hook
const Search = () => {
const g... | true |
fd10d74ec4df48a8d3ac1f02310e2b8f0b22751c | JavaScript | Willslima/logica | /if/if-10.js | UTF-8 | 532 | 4.3125 | 4 | [] | no_license | // 10. Fazer um programa para receber um número e verificar se está entre 100 e 200.
// Se estiver na faixa, imprimir:
// Você digitou um numero entre 100 e 200.
// Senão estiver na faixa, imprimir
// Você digitou um numero fora da faixa entre 100 e 200.
var user = require('readline-sync')
var num = user.question('Di... | true |
807ea8d01362bc9aa66d96ad52a281363fed7593 | JavaScript | az777777/accept-a-payment | /prebuilt-checkout-page/client/html/index.js | UTF-8 | 1,387 | 2.859375 | 3 | [
"MIT"
] | permissive | // When the form is submitted...
var submitBtn = document.querySelector('#submit');
submitBtn.addEventListener('click', async (e) => {
// Fetch your Stripe publishable key to initialize Stripe.js
// In practice, you might just hard code the publishable API
// key here.
const {publishableKey} = await fetch('/con... | true |
7ea03b2b0de320811eb7cd0e9cdf72d4655a87ba | JavaScript | RavellHeerdegen/RichMediaHausarbeit | /Experiment/public/functions.js | UTF-8 | 467 | 2.953125 | 3 | [] | no_license | function showHideButton(text) {
var x = document.getElementById(text);
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
function showHideButtonOpacity(text) {
var x = document.getElementById(text);
if (x.style.opacity == 0) {
... | true |
41f8d4b00b6825a3ee77ab39d9e011554f72ebcc | JavaScript | nestoralonsovina/piscine-php | /day09/ex04/todo.js | UTF-8 | 1,081 | 2.984375 | 3 | [] | no_license | let ft_list;
$(window).on('load', () => {
$("#new").click(take_element);
$("#ft_list div").click(delete_element);
ft_list = $("#ft_list");
loadData();
});
function loadData() {
ft_list.empty();
$.ajax({
url: 'select.php',
method: "GET",
data: null,
}).done((respons... | true |
12bfdaaff8033145d9f3469d2a9961b1524cd2d9 | JavaScript | briandunnington/AzureBlobUploader | /AzureBlobUploader.js | UTF-8 | 4,839 | 2.625 | 3 | [] | no_license | class AzureBlobUploaderPrivate {
constructor() {
this.uploadUrl = null
this.maxBlockSize = 256 * 1024 // Each file will be split into 256KB chunks
this.numberOfBlocks = 1
this.currentFilePointer = 0
this.totalBytesRemaining = 0
this.blockIds = []
this.blockIdP... | true |
4c512bc47775da3b37116924ffe2e52e98a86d47 | JavaScript | sahanavijay/C-37 | /js/Player.js | UTF-8 | 1,195 | 3.15625 | 3 | [] | no_license | class Player
{
constructor()
{
//write properties of player
this.name=null;
this.index=null;
this.positionX=0;
this.positionY=0;
}
//Declare getCount function to get the count of player
getCount()
{
var playerCountRef = database.ref("playerCount");
playerCountRef.on("value"... | true |
1aad1747fc836ef379cf23b0c11a7595c7bc8795 | JavaScript | josno/word-nerd-client | /src/components/HeaderMessage/HeaderMessage.js | UTF-8 | 496 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./HeaderMessage.css";
const ScrambledMessage = ({ oldMessage, newMessage }) => {
const [message, setMessage] = useState(oldMessage);
useEffect(() => {
const timer = setTimeout(() => setMessage(newMessage), 1500);
return () => clearTimeout(timer);
}, [... | true |
4fd069bc5790aaf82b157295c05b0f3ed8db703f | JavaScript | Snowmqn/character-sheet | /controllers/CharacterCtrl.js | UTF-8 | 1,485 | 2.578125 | 3 | [] | no_license | var Character = require('../models/Character');
module.exports = {
create: function(req, res, next) {
var charObj = {
stats: req.body.statsId,
spell: req.body.spellId,
misc: req.body.miscId,
name: req.body.name,
level: req.body.level
... | true |
2457138a16934d198276aad01951014b4b8ff942 | JavaScript | davidalexteixeira/lab-node-elevator | /starter_code/person.js | UTF-8 | 325 | 2.84375 | 3 | [] | no_license | class Person {
constructor (name, originFloor, destinationFloor) {
this.name = name
this.originFloor = originFloor
this.destinationFloor = destinationFloor
}
}
module.exports = Person
let test = new Person('David', 3, 6)
let waitingList = []
let passengers = []
let requests = []
console.log(test.n... | true |
837d35c762a7c65b57376e0a043d7d2ff2ac28b5 | JavaScript | deepaksingh63584/FundooNotes | /fellowShipCode/Designpattern/prototype.js | UTF-8 | 566 | 3.875 | 4 | [] | no_license | function Robot(name, job) {
this.name = name;
this.job = job;
}
Robot.prototype.introduce = function () {
console.log("Hi! I'm " + this.name + ". My job is " + this.job + ".");
};
var bender = new Robot("Bender", "bending");
bender.introduce(); // Hi! I'm Bender. My job is bending.
console.log(Object.ge... | true |
cf890e4a5be94db048b6726e4340ac2adb3f14af | JavaScript | mcl53/football-index | /data_collector/mongo.js | UTF-8 | 5,664 | 2.59375 | 3 | [] | no_license | const secrets = require("./secrets");
const utils = require("./utils");
const fs = require("fs");
const csv = require("csv-parser");
let current_connections = 0;
async function listDatabases(client) {
databasesList = await client.db().admin().listDatabases();
console.log("Databases:");
databasesList.dat... | true |
fc5468986f2f84828f5f5d094e959f39de0ac816 | JavaScript | Cyurainya/codingBook | /js-Base/babelPlugin/plugin.js | UTF-8 | 881 | 2.875 | 3 | [] | no_license | //babel插件模块需要我们暴露一个function,function内返回一个visitor对象
module.exports = function ({ types: t }) {
return {
visitor: {
VariableDeclaration (path) {
const node = path.node;
['let', 'const'].includes(node.kind) && (node.kind = 'var');
},
//箭头函数对应的访问者方法(节点)
ArrowFunctionExpression ... | true |
31737a9553247efd6a722c697e75d7077289625b | JavaScript | aufamutawakkil/kasir-reactjs | /src/helper/Helper.js | UTF-8 | 542 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | const formatCurrency = (angka,pref="Rp. ") => {
if( angka === undefined || angka == null ) return "0";
angka = angka.toString();
angka = Number(angka);
var rupiah = '';
var angkarev = angka.toString().split('').reverse().join('');
for(var i = 0; i < angkarev.length; i++) if(i%3 == 0) rupiah += angkarev... | true |
88fe537648bd8b74b47bd3c567a3afa9f9aee46b | JavaScript | liuXxxxxxxx/newgit | /myLastIndexOf.js | UTF-8 | 657 | 3.75 | 4 | [] | no_license | var array=[1,2,3,4,5];
console.log(array.lastIndexOf(3));
Array.prototype.myLastIndexOf=function (callback,index) {
if(typeof callback!=='object'){
try{
throw new TypeError(callback+' is not a function');
}
catch(e){
// console.error(e);
}
}
for(var ... | true |
567303c0103b51b641162a6f718ab27f69e1d1c7 | JavaScript | AtelierNum/projet_Yearbook_2020 | /Girard_Myriam/image_libre/sketch.js | UTF-8 | 3,538 | 3.09375 | 3 | [
"MIT"
] | permissive | //Ce programme à pour but de mettre en 3D une image, de pouvoir jouer sur la profondeur, les formes et les couleurs.
let img
let dataImage = []
let menu
let params = {
'offset': 10,
'formtype': 0,
'mode': 0
}
function preload() {
img = loadImage("fleurs.jpg", function () {
console.log("image l... | true |
447e570490651b42e05dccb3d9d6034a6fe5e038 | JavaScript | AneezaKhawaja/aneeza.github.io | /lab_4/Lab_4.js | UTF-8 | 3,071 | 4.46875 | 4 | [] | no_license | // 1 Change the content of the div with class "header" to "[Your name]'s Lab 4"
// 13 characters in name...not including space
function changeContent() {
let x = document.getElementsByClassName("header");
x[0].innerHTML = "Aneeza Khawaja's Lab 4";
}
// 2 Insert two paragraphs into the div with the class "conte... | true |
5ad76da6f8cd30c1b8a7d6890b625d03d547130f | JavaScript | tnoborio/unsung-kingdom | /src/map/town1.js | UTF-8 | 2,729 | 2.515625 | 3 | [
"MIT"
] | permissive | import townChapter0 from '../event/townChapter0'
import townChapter1 from '../event/townChapter1'
import townChapter2 from '../event/townChapter2'
import townChapter3 from '../event/townChapter3'
import townChapter4 from '../event/townChapter4'
import townChapter5 from '../event/townChapter5'
import storage from '../da... | true |
0e781016b6f1b2e127f6bf699d72e2e83851832c | JavaScript | eliav-touitou/JWT | /rout.js | UTF-8 | 5,113 | 2.625 | 3 | [] | no_license | const express = require("express");
const jwt = require("jsonwebtoken");
const USERS = [
{
email: "admin@email.com",
name: "admin",
password: "$2b$10$7QT3g8m1s925VZyPOa/9f.xjjJR9bq2.m1cm3ev..Yh2ECeNxQFfC",
isAdmin: true,
},
];
const bcrypt = require("bcrypt");
const { hashSync, genSaltSync, compareS... | true |
7dbc07bb231c47caba8392e1b7ed9cfe3481ef07 | JavaScript | leannieloop/IntroToWebDev | /javascript/FindMaxExercise/findMax.js | UTF-8 | 609 | 4.03125 | 4 | [] | no_license | function findMax(numbers) {
// defines the function "findMax" whose input is defined as the variable "numbers"
var max = numbers[0];
// defines the variable max equal to the first array index
for (i = 0; i < numbers.length; i++) {
// for the variable i, starting at 0, if i is less than the length of the... | true |
98e4358bbe17712947b687382074514d9e97306f | JavaScript | moe87/burger | /public/assets/js/burger.js | UTF-8 | 633 | 2.828125 | 3 | [] | no_license | $(function() {
$(".create-form").on("submit", function(event) {
event.preventDefault();
var newBurger = {
burgerName: $("#burgerName").val().trim()
};
// Send the POST request.
$.ajax("/addBurger", {
type: "POST",
data: newBurger
}).then(
function() {
loca... | true |
237e1d3bf67a04db111a5c47ae49d984c3b1ba00 | JavaScript | brycebarsness/planB | /client.js | UTF-8 | 1,176 | 3.484375 | 3 | [] | no_license | let garage = [];
/*
Do not change newCar for base mode!
*/
function newCar(yearInput, makeInput, modelInput){
console.log('in newCar:', yearInput, makeInput, modelInput);
const newCarObject = {
year: yearInput,
make: makeInput,
model: modelInput
}
garage.push(newCarObject);
return true;
} // end ... | true |
be94890c3fcbdd42e26ed93a4370534d03d68e59 | JavaScript | nju33/get-descendant | /lib/get-descendant.js | UTF-8 | 221 | 2.6875 | 3 | [
"MIT"
] | permissive | export default function getDescendant(el, target) {
el = el.parentElement;
while (el.tagName !== 'HTML') {
if (el.parentElement === target) {
return el;
}
el = el.parentElement;
}
return null;
}
| true |
e486da1fc41a607d2683f375b238c0886e316d38 | JavaScript | Jaomar92/setGoals | /src/Components/TodoForm.js | UTF-8 | 702 | 2.953125 | 3 | [] | no_license | import React, { useState } from "react";
import "./TodoForm";
function TodoForm(props) {
const [goal, setGoal] = useState("");
const handleNewGoal = (e) => {
setGoal(e.target.value);
};
const handleSubmit = (e) => {
e.preventDefault();
if (goal.trim().length === 0) {
return;
}
const... | true |
cd2d6fe6750e68187a0af80ed5eaa8cb65099fa5 | JavaScript | AlexandreAlvesDeCarvalho2/WebModerno-Cod3r | /JavaScript-Aulas/FactoryFunctions/FactoryCriarPessoa.js | UTF-8 | 286 | 3.875 | 4 | [
"MIT"
] | permissive | //Através de uma função fabrica (Factory function), Criar uma pesso:
function CriarPessoa(nome, idade, endereço) {
return {
nome,
idade,
endereço
}
}
const Pessoa1 = CriarPessoa('Alexandre', 28, 'Av melchert 439, apto 32')
console.log(Pessoa1)
| true |
d2bb551d2edcf9750dbe6c68f78bb51744118e66 | JavaScript | benssj5/JQUERY | /use-sass/src/assets/js/07.js | UTF-8 | 834 | 3.1875 | 3 | [
"MIT"
] | permissive | $(function(){
$("button:nth-of-type(1)").click(function() {
var firstText = $("li:first").text();
firstText = firstText.substr(-1);
var firstNumber = parseInt(firstText,10);//parser en int en base 10
var ul = $("ul");
if(firstNumber>1) {
firstNumber--;
ul.prepend("<li>item "+firstNu... | true |
9da60744dc240db25ba2aeebc370a90d807654fb | JavaScript | saikrishna-muppa/react-todo-list-talinode | /src/App.js | UTF-8 | 2,613 | 2.65625 | 3 | [] | no_license | import React, { useState } from "react";
import "./styles.css";
import { GrRefresh } from "react-icons/gr";
const App = () => {
const [inputValue, setInputValue] = useState("");
const [items, setItems] = useState([]);
// const addeditem = (e) => {
// setInputValue(e.target.value);
// };
const addItem = ... | true |
e31088717bae0429179ed4b0636b03dc9e49979a | JavaScript | justinwb/LDflex | /test/unit/PathExpressionHandler-test.js | UTF-8 | 1,898 | 2.609375 | 3 | [
"MIT"
] | permissive | import PathExpressionHandler from '../../src/PathExpressionHandler';
describe('a PathExpressionHandler instance', () => {
let handler;
beforeAll(() => handler = new PathExpressionHandler());
it('ignores an immediate link has no predicate', async () => {
const parent = { subject: 'abc' };
const child = {... | true |
fb240e577f2485c55aa46e5181daa5bfec3f75c1 | JavaScript | vatsrahul79/Data-Structure | /solutionsDsa/makeItStronger_code.js | UTF-8 | 361 | 3.40625 | 3 | [] | no_license | function processData(input) {
//Enter your code here
input = input.split("\n")
var n = Number(input[0])
var arr = input[1].trim().split(' ').map(a=>parseInt(a)).sort((a,b)=>(a-b))
// console.log(a)
var diff = 0
for(var i = 0;i<Math.floor(n/2);i++){
diff+=Math.abs(arr[i]-arr[arr.lengt... | true |
5da67891d4cd7c17a7d09bd080a1be4908e88917 | JavaScript | hcshashank/09-09-2021 | /js/createDiv.js | UTF-8 | 447 | 2.84375 | 3 | [] | no_license | let createDiv = document.createElement('div');
document.body.appendChild(createDiv)
createDiv.style.height= '400px';
createDiv.style.width = '400px';
createDiv.style.borderRadius= '10px';
createDiv.style.background = 'grey';
createDiv.style.border = '2px solid black';
function img(image='./images/logo.png'){
... | true |
3c601230b6d3f6d30e5b23e21ebe4915b25ecaf1 | JavaScript | ankit0812-hue/vocabfrontend | /src/container/reducers/WordReducer.js | UTF-8 | 631 | 2.9375 | 3 | [] | no_license | // defines the initial state of the application
const initState = {
//length: 0,
wordList: [],
};
// defines the reducer function where state is updated according to action type
export const WordReducer = (state = initState, action) => {
switch (action.type) {
case "GET_ALL":
return {
...state,
... | true |
4266cec94ec0e44b6d415d34e9790a7875e98aff | JavaScript | RoryDuncan/webhint.io | /src/webhint-theme/source/components/tabs/tabs.js | UTF-8 | 2,668 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | /* eslint-disable no-var, prefer-template, strict, prefer-arrow-callback, object-shorthand */
/* eslint-env browser */
(function () {
'use strict';
var createTabControl = function (element) {
var tabList = [].slice.call(element.querySelectorAll('[role="tab"]'));
var tabPanels;
var dese... | true |
617a7df4a476811e2f8fbd898dc1dff2c1d30449 | JavaScript | azbykov/node-school-streams | /practice/15-my-transform-stream.js | UTF-8 | 337 | 2.515625 | 3 | [] | no_license | const {Transform} = require('stream');
const myReadable = require('./12-my-readable-stream-classes');
const upperCaseTr = new Transform({
transform(chunk, encoding, callback) {
this.push(`${chunk.toString().toUpperCase()}\n`);
callback();
}
});
const readable = new myReadable();
readable.pipe(upperCaseTr).pipe(... | true |
bfb10a6bdd170d17e0abe8f4be3d7101c2f5bc37 | JavaScript | fengjianjunstudy/zf | /jiagou7/3thday/4.reduce.js | UTF-8 | 610 | 4.09375 | 4 | [] | no_license | let count = [1, 2, 3].reduce((prev, next, index, arr) => {
console.log(prev, next, index, arr);
return prev + next;
}, 0);
console.log(count);
let arr = [1, [2, [3]]];
//方法一: 缺点 其中所有值都会被转化为字符串
console.log(arr.toString().split(","));
//方法二:
console.log(arr.flat(Infinity));
//方法三:
function flat(arr) {
let newAr... | true |
2a4f71515213e409d0f00605a5dc28b52f99f017 | JavaScript | KariHe/demo-graphql-modules-in-gcp | /utils/create-user.js | UTF-8 | 1,102 | 2.609375 | 3 | [] | no_license | require('dotenv').config();
var admin = require("firebase-admin");
var inquirer = require("inquirer");
admin.initializeApp();
const prompt = inquirer.createPromptModule();
prompt([
{
type: "input",
name: "name",
message: "Users full name"
},
{
type: "input",
name: "email",
... | true |
73d2fcd68921ad042c5e217924fc088808efa607 | JavaScript | a810434655/xykhd-wx | /resources/j4scPlayer/j4scPlayer.js | UTF-8 | 1,936 | 2.515625 | 3 | [] | no_license | var _audio = require("../../service/audio.js")
var that
Component({
properties: {
course: Object,
title: {
type: String
},
src: {
type: String
}
},
data: {
playing: !1,
endTime: '00:00',
curTime: '00:00'
},
attached: function() {
that = this
console.log(this... | true |
c815f538f153e192a49cecb9361399773d77d713 | JavaScript | booldook/2109-kn-node-mongoose | /public/javascripts/save.js | UTF-8 | 357 | 2.53125 | 3 | [] | no_license | function userChg(id) {
axios.get("/users/li/"+id)
.then(function(result){
console.log(result.data);
var f = document.querySelector("#userForm");
f.userid.value = result.data[0].userid;
f.username.value = result.data[0].username;
f._id.value = result.data[0]._id;
f.action = "/users/chg";
})
.catch(functi... | true |
396acd4c4d236cda3389851158415b6ad4a24c0a | JavaScript | silvestrevivo/wikipedia-viewer | /main.js | UTF-8 | 2,346 | 2.6875 | 3 | [] | no_license | window.onload = function(){
//Complete Url
window.location.replace('https://silvestrevivo.github.io/wikipedia-viewer/?#');
//variable declararions
var styleSheet = document.styleSheets[3];
var input = document.getElementById('input');
var container = document.querySelector('.container');
//Init animati... | true |
10d02c6126001ae61d7b9c2729b00cd7d92d1322 | JavaScript | dejo55/ColorFilter | /Reviews/app.js | UTF-8 | 2,675 | 3.46875 | 3 | [] | no_license | //Declaring the person structure
const reviews = [
{
id:1,
name: "Bill anderson",
job:"the boss",
img:
"https://images.pexels.com/photos/9940878/pexels-photo-9940878.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500",
text:" ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sed facilisis ligula. Phasellus... | true |
ef6b6ffda52878bbd6f3201afa16b49b46a33565 | JavaScript | joamart1nez/crud-cerveceria | /src/public/javascript/contador.js | UTF-8 | 483 | 2.984375 | 3 | [] | no_license | var pc = {
resta : document.querySelector('#span1'),
suma : document.querySelector('#span2'),
unidad : document.querySelector('#unidad'),
result : 1
}
var mc = {
captOperation : function(){
pc.suma.addEventListener('click', function(){
pc.result = pc.unidad.innerHTML++... | true |
d10bb1fb5f32f4a57d086bafbc3faae977fa5e00 | JavaScript | kamte/challenge-front-katas | /src/kata-2.js | UTF-8 | 351 | 2.890625 | 3 | [] | no_license | export function kata2 (obj, def, path) {
const args = [...arguments];
// if we're missing arguments, curry the function
if (args.length < kata2.length) return (...newArgs) => kata2(...[...args, ...newArgs]);
const parts = path.split('.');
try {
return parts.reduce((o, prop) => o[prop], obj) || def;
} c... | true |
add9e22e0d3002e1974b1c85d3cf06b5beb8fa1f | JavaScript | fu-chau/nodewpg | /browser_api/ex002/script.js | UTF-8 | 185 | 3.640625 | 4 | [] | no_license | const oddNumbers = function () {
for ( let number = 0; number <= 1000; number++ ) {
if (number % 2 === 1) {
console.log(number);}
}
}
oddNumbers(); | true |
c330a2d9438260ca7b9fd057bb4b0d70da9429e6 | JavaScript | ukicaaa96/Timesheet_APP | /MyProject/App/app/src/components/ModalAction.js | UTF-8 | 4,099 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react'
import '../App.css'
import DateReturn from '../functions/DateReturn'
import axios from 'axios'
import Modal from 'react-modal'
import plusLogo from '../images/icon-plus.svg'
export default class ModalAction extends Component {
constructor(props) {
super(props);
thi... | true |
0846246a2b1e5dcc2605485905dad74c6a34a85b | JavaScript | sonya-irsay/morse_puredata | /script.js | UTF-8 | 4,612 | 2.9375 | 3 | [] | no_license | var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d",{antialias: true, antialiasSamples: 6});
var width = window.innerWidth;
var height = window.innerHeight;
canvas.width = width;
canvas.height = height;
var myDotSound;
var myDashSound;
var backgroundTexture;
var alphabet = {
... | true |
38f5e0e88187e2ca00ebcb899d68fd5b0aa5c530 | JavaScript | tsinat/Banking-App-backEnd | /public/main.js | UTF-8 | 1,412 | 2.53125 | 3 | [] | no_license | 'use strict';
var app = angular.module('myapp', []);
app.controller('mainCtrl', function($scope){
$scope.balance= 0;
$scope.amount = [];
$scope.debitTotal =0;
$scope.creditTotal = 0;
$scope.addBalance = () => {
$scope.amount.push($scope.newAmount);
$scope.debitTotal += Number($sco... | true |
864a2741e480d85466f15e972d20e7b330b8622f | JavaScript | Beingadam1/Todo-list | /app.js | UTF-8 | 4,325 | 3.53125 | 4 | [] | no_license | // Defining the DOM
const form = document.querySelector('.d-flex');
const filter = document.querySelector('#filter');
const todoList = document.querySelector('.list-group');
const clearBtn = document.querySelector('.clear-todo');
const todoInput = document.querySelector('#todo');
// Load all event listeners
loadEventL... | true |
1afc5d866b32986c7386ceef8ab54a41d85c65c3 | JavaScript | larsberg/CurveComposer | /src/CurvePlayer.js | UTF-8 | 2,113 | 3.125 | 3 | [] | no_license | // CurvePlayer.js
import Curve from './Composer/Curve'
import StringCurve from './Composer/StringCurve'
class CurvePlayer{
constructor( options ) {
Object.assign(this, {
start: 0,
duration: 1,
curves: [],
onChangeEvents: {},
_position: 0,
_values: {},
}, options || {})
... | true |
52becf0f648737ef1e3e2bf00705b7ee36e3c26a | JavaScript | nemesmia-gm/React_Unicafe | /src/Part3-Phonebook/services/persons.js | UTF-8 | 728 | 2.59375 | 3 | [] | no_license | import axios from "axios";
const baseUrl = 'http://localhost:3001/persons';
const getAll = () => {
return axios
.get(baseUrl)
.then( response => response.data )
};
const create = (newPerson) => {
return axios
.post( baseUrl, newPerson )
.then( response => response... | true |
ff09aa7779171cfb7d227e4bf782fb0dbb078d68 | JavaScript | soyuka/cabal | /commands.js | UTF-8 | 2,799 | 2.53125 | 3 | [] | no_license | var through = require('through2')
function Commander (view, cabal) {
if (!(this instanceof Commander)) return new Commander(view, cabal)
this.cabal = cabal
this.channel = 'default'
this.view = view
this.pattern = (/^\/(\w*)\s*(.*)/)
this.history = []
var self = this
this.commands = {
nick: {
... | true |
7b8f1dc373db995b94dc6a76100d29262b8257bf | JavaScript | lilyhoratio/webtesting-iii-challenge | /src/controls/Controls.spec.js | UTF-8 | 2,406 | 2.953125 | 3 | [] | no_license | // Test away!
// provide buttons to toggle the closed and locked states.
// buttons' text changes to reflect the state the door will be in if clicked
// the closed toggle button is disabled if the gate is locked
// the locked toggle button is disabled if the gate is open
import React from 'react'
import { render, cle... | true |
ffff1f6925186ba781ed24b71167d07d1f93ee94 | JavaScript | vertig0ne/ss-node | /api/models/Phone.js | UTF-8 | 1,762 | 2.625 | 3 | [] | no_license | const mongoose = require('mongoose')
const uuid = require('uuid')
const setPrice = (value) => value*100
const getPrice = (value) => parseFloat((value/100).toFixed(2))
const schema = new mongoose.Schema({
id: { type: String, default: uuid.v4(), required: true, unique: true },
make: { type: String, required: true }... | true |
b0d689e85239cfb3de72be365f11393ed690da8a | JavaScript | karanysingh/GroFarWeb | /src/reducers/reducer.js | UTF-8 | 1,567 | 2.75 | 3 | [] | no_license | ////FOR LATER
const axios = require("axios");
const initalState = {
tasks: [],Products : {}
}
const appReducer = (state = initalState, action) =>{
switch(action.type) {
case 'GET_DATA':
// console.log('added ')
return{
...state,
tasks:state.tasks.concat(action.task),
}
... | true |
f866f9c22346987f42da6c68a6a75622efc898df | JavaScript | EliseevTimofey/scripts | /script/тест/test.js | UTF-8 | 1,049 | 3.546875 | 4 | [] | no_license | describe("pow", function() {
describe("возводит х в степень n", function() {
function makeTest(x) {
var expected=x*x*x;
it("при возведении " + x + "в степень 3 результат" + expected, function() {
assert.equal(pow(x, 3), expected);
});
}
for(var x=1; x<=5;x++){
makeTest(x);
... | true |
bc9fe89f41142f6f2df1917467abdb7ba3c02f36 | JavaScript | ghYoon93/WEB | /miniProject/WebContent/js/member.js | UTF-8 | 3,786 | 2.5625 | 3 | [] | no_license | //function checkWriteForm(){
//유효성 체크
// if(document.writeForm.name.value=="")
// alert("이름을 입력하세요");
// else if(document.writeForm.id.value=="")
// alert("아이디를 입력하세요");
//else if(document.writeForm.pwd.value=="")
// else if(document.getElementById("pwd").value=="")
// alert("비밀번호를 입력하세요");
// else if(document.wr... | true |
c3334aed15409d942241157541921b5b8abb2aea | JavaScript | Bossmojoman/GummyFish | /scripts/terrain_gen.js | UTF-8 | 815 | 3.078125 | 3 | [] | no_license | function setup() {
noLoop();
createCanvas(windowWidth -25, windowHeight -25);
//noiseSeed(120000)
background(color(0, 0, 255));
// noprotect();
}
function draw() {
for (var x = 10; x < width -10; x+=1) {
for (var y = 10; y < height -10; y+=1) {
var c = 255 *... | true |
5b793274640b1df20b5279e0562506db2ab8496e | JavaScript | gaochen/enjoyread | /test/user.test.js | UTF-8 | 3,647 | 2.609375 | 3 | [] | no_license | var user = require('../controllers/modal/user.js');
var should = require('should');
var user1 = new user(29,'acs1899@163.com','123123');
var user2 = new user(0,'acs1899@163.com','123123');
describe('user.js',function(){
this.timeout(5000);
/*test emailAlreadyExists*/
it('test function emailAlreadyExists : ... | true |
1588bc47edf723623f5903e2405dddf0fbdfd723 | JavaScript | Tris92/Eddo---Template | /public/javascripts/Z-Sample/ChangerTypeBalise.js | UTF-8 | 365 | 2.734375 | 3 | [] | no_license | //CODE
//ici transforme l'élément avec la class .col-product-media en <li>
var attribute = { };
jQuery.each(jQuery(".col-product-media")[0].attributes, function(id, atr) {
attribute[atr.nodeName] = atr.nodeValue;
});
jQuery(".col-product-media").replaceWith(function () {
return jQuery("<li />",
attri... | true |
1ef01b7876da162469aabec4f5b5e94a72f4296a | JavaScript | SawyerMerchant/project_game_center_browser | /javascript/view.js | UTF-8 | 2,134 | 2.625 | 3 | [] | no_license | var view = {
initialize: function() {
// $('.score-board').hide();
model.sizeOptions();
model.speedOptions();
},
initializeBoard: function(size) {
$('#messages').hide("slow");
$('#welcome').hide("slow");
view.renderGrid(size);
$('.score-board').show("slow");
$('#grid').addClass('... | true |