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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
30eb69877fa73856da46ca78ca3c84c9b55e423a | JavaScript | airoy/- | /前端相关/手写代码/浏览器相关/十万条数据下JS高性能渲染解决方案/defer.js | UTF-8 | 328 | 2.828125 | 3 | [] | no_license | // 如果非要放到这里的话可以用defer,defer会延迟js脚本的执行,等到dom树构建完成后,DOMContentLoaded事件前执行
// defer属性仅仅对于外链的js脚本有效,表示立即下载脚本,但是延迟执行
const div = document.querySelector('div');
console.log(div, 'defer'); // <div></div> | true |
c3fb7a892d6138323e39b34d50fb23d6d65909b3 | JavaScript | Onodric/Algorithms | /main.js | UTF-8 | 2,260 | 3.546875 | 4 | [] | no_license | "use strict";
let numberArray = [1, 2, 3, 4, 5, 6, 7];
let cleanStringArray = ["Nashville", "Boston", "Los Angeles", "New York", "Raleigh", "Jacksonville"];
let duplicateStringArray = ["Nashville",
"Boston",
"Los Angeles",
"New York",
... | true |
daf2e1adb2dba67459692cbfecf66981d856274d | JavaScript | Errmakovv/caesar-cipher-cli | /src/validators/validators.js | UTF-8 | 844 | 2.6875 | 3 | [] | no_license | const fs = require('fs');
const { ACTIONS } = require('../constants/constants');
const ERRORS = {
action: 'Please provide correct action\n',
shift: 'Please provide correct shift\n',
input: 'Please provide correct input file\n',
output: 'Please provide correct output file\n'
};
function endProcessWithError(errorMe... | true |
5e4b3b2a4fda3bf374427867c0d0356acfdd786b | JavaScript | AlexNarayanan/setlist-forecast | /src/services/setlistfm.js | UTF-8 | 3,902 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
import Request from './request';
const request = new Request();
export default class SetlistfmService {
constructor() {
this.host = 'api.setlist.fm';
this.artistSearchEndpoint = '/rest/0.1/search/artists.json?artistName=';
this.setlistSearchEndpoint = '/rest/0.1/search/setli... | true |
5a62a1aeaea638546aae2fdfce237d8d3654a027 | JavaScript | codeannie/thinkful-tube | /script.js | UTF-8 | 1,831 | 2.96875 | 3 | [] | no_license | const YOUTUBE_SEARCH_URL = "https://www.googleapis.com/youtube/v3/search";
const YOUTUBE_API_KEY = "AIzaSyC45wXojqpkNx5U7svl3shem3GYDt6ov7M";
function listenforInput() {
$("#search").submit(event => {
event.preventDefault();
var searchTerm = $(".js-searchTerm").val();
getYoutubeResults(searchTerm);... | true |
2a3c2cb9427343899df493c304bb42e530731e3a | JavaScript | johny704/proyecto-tatto-final | /js/dist/main.dev.js | UTF-8 | 3,428 | 3 | 3 | [] | no_license | "use strict";
var btnmenu = document.querySelector('.fa-bars');
var menu = document.querySelector('nav');
btnmenu.addEventListener('click', function (e) {
e.preventDefault(); // menu.style.display = 'block';
menu.classList.toggle('mostrar');
});
var btnEnviar = document.querySelector('#enviar');
var formulario = ... | true |
c6b1cddc95dfc4680d2fb5ab89fc2e5c715afbb1 | JavaScript | jojo51778/blog.github.io | /examples/promise/callback/1.high-order.js | UTF-8 | 832 | 4.25 | 4 | [] | no_license | // 函数参数为函数
// 函数中返回函数,闭包
function isType(type) {
// 将String保存在这个代码块中
return function(content) {
return Object.prototype.toString.call(content) === `[object ${content}]`
}
}
// let isString = isType('String')
// // 闭包:在定义的时候函数就决定了一个函数不在自己所在的作用域下执行
// isString('hello') // true
// let isNumber = isType('Number')... | true |
21a33fa4136af4cd18cdfff0c4cf3dada6280fb0 | JavaScript | developerharshit/TaxCalculator | /src/utils/calculateTax.js | UTF-8 | 1,346 | 2.796875 | 3 | [] | no_license |
const row = ['A','B','C','D','E'];
const slabRange = {
'A':'0 to 1,50,000',
'B':'1,50,001 to 3,00,000',
'C':'3,00,001 to 8,00,000',
'D':'8,00,001 to1,00,00,000',
'E':'1,00,00,001+'
};
const taxRates = [0.0,0.025,0.10,0.25,0.30];
let taxableIncome = [0,0,0,0,0];
let tax = [0,0,0,0,0];
const taxAmoun... | true |
0e674852bc3e6b179ca291befb473d0577e3302e | JavaScript | RehamMuhammad/Student-System | /students.js | UTF-8 | 3,971 | 3.140625 | 3 | [] | no_license | /*****************************************************************************************************************************************************/
//Requiring the file system module for adding a new Json file to save & read data from it
const fs = require("fs");
//Requiring the chalk module for Styling our termin... | true |
bfe5311e58adc26a94b62f2ea7d40a048b2a969b | JavaScript | vickzil/playquiz | /js/science.js | UTF-8 | 7,898 | 2.515625 | 3 | [] | no_license |
// LIST OF SCIENCE QUESTIONS
const questions = [{
question: "Brass gets discoloured in air because of the presence of which of the following gases in air?",
answers: [
{
text: 'Oxygen',
correct: false
},
{
text: 'Hydrogen sulphide',
correct: true
},
... | true |
e91ca132e52dbdd57aedffdfae89b4adca48a7e1 | JavaScript | lYlarufAhmed/library-management | /models/book/controllers.js | UTF-8 | 1,041 | 2.609375 | 3 | [] | no_license | const Book = require('./schema')
let getAllBooks = async () => await Book.find().populate('category', 'name')
let createNewBook = async (title, authors, category, price) => {
let buffer = new Book({title, authors:{name: authors}, category, price})
await buffer.save()
return buffer
}
let deleteBook = async (... | true |
1ae198aaa777b1339a86213469067226664f1aa7 | JavaScript | Azamor16/Test | /h05_Zamorano_Alberto.js | UTF-8 | 426 | 2.9375 | 3 | [] | no_license | var startingAge = document.getElementById("startingAge").value;
var retirmentAge = document.getElementById("retirmentAge").value;
var salary = document.getElementById("salary").value;
var investment = document.getElementById("investment").value;
var raise = document.getElementById("raise").value;
var interstRate = ... | true |
8fa79e617ed6fb5a189b4544806e4b23ebfc1133 | JavaScript | joeasy/fankahui-webpos | /master/js/modules/members/members.filter.js | UTF-8 | 1,490 | 2.5625 | 3 | [] | no_license | /**
* AngularJS default filter with the following expression:
* "person in people | filter: {name: $select.search, age: $select.search}"
* performs a AND between 'name: $select.search' and 'age: $select.search'.
* We want to perform a OR.
*/
(function() {
'use strict';
angular
.module('app.member... | true |
b704716b4476b538a48bbc7030ad91bf0d83c099 | JavaScript | Sanjagh/option | /__tests__/index.test.js | UTF-8 | 6,477 | 3.0625 | 3 | [
"MIT"
] | permissive | // @flow
import { some, none, option, None, Some } from '../src/index';
describe('Option', () => {
test('option constructor', () => {
expect(option(null)).toBeInstanceOf(None);
expect(option(undefined)).toBeInstanceOf(None);
expect(option(2)).toBeInstanceOf(Some);
expect(option(true)).toBeInstanceOf(... | true |
09fc01f7e7581300b26bc1407b7fdbdd55233de2 | JavaScript | DavidKHahn/NYTReact | /client/src/pages/Saved/Saved.js | UTF-8 | 1,576 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
import API from "../../utils/API";
import { List, ListItem } from "../../components/List";
import Wrapper from "../../components/Wrapper";
import DeleteBtn from "../../components/DeleteBtn";
import "./Saved.css"
class Saved extends Component {
state = {
saved: [],
};
... | true |
8d27d30f130f7ebf758ae551720a9639d261a6d9 | JavaScript | Maisa-ah/ctp-project | /src/Components/Plot/D3/Bar.js | UTF-8 | 2,756 | 2.578125 | 3 | [] | no_license | import FigureContext from "./Figure/FigureContext"
import * as d3 from "d3"
import { useContext, useEffect, useState } from "react"
import { fireEvent } from "@testing-library/dom"
const Bar = ({data, labels, props}) => {
const fig = useContext(FigureContext)
const drawChart = () => {
const width = f... | true |
46e272568a3ae96efd4285bd81ca25a5fd58af2a | JavaScript | serjsv87/Webp-Drupal-7 | /webpdrupal7/core_scripts/_staff/js-helpers/webp-on-off-class.js | UTF-8 | 664 | 2.796875 | 3 | [] | no_license | (function(){
var d = document.documentElement.classList;
if (!(d.contains("webp-on") || d.contains("webp-off"))){
// check localstorage
var sto = window.localStorage;
var localStorageWebp = sto.getItem('webpsupp');
if (localStorageWebp == '1'){
d.add("webp-on");
} else if (localStorageWebp == '0'... | true |
25516cd7d0dfe7df2354ac4f504e0e3d2f50dabe | JavaScript | NYAN-C4T/jsplay-one | /index.js | UTF-8 | 701 | 2.90625 | 3 | [] | no_license | $(function () {
var HandleDOM = function HandleDOM (target, event, action, params) {
this.target = target;
this.event = event;
this.action = action;
this.params = params;
function addShortList () {
target.on(event, function () {
params.forEach(fun... | true |
d71f28eacc6d75b485428b093eaa323f4f9db076 | JavaScript | adelkahomolova/node-bitbucket | /src/utils/__tests__/add-query-parameters.test.js | UTF-8 | 1,566 | 2.75 | 3 | [
"MIT"
] | permissive | const addQueryParameters = require('../add-query-parameters.js')
const url = '/'
const reservedChars = ';,/?:@&=+$#'
const unreservedChards = "-_.!~*'()"
const alphanumericAndSpace = 'ABC abc 123'
describe('utils:add-query-parameters', () => {
it('returns url as is when params is empty', () => {
expect(addQuer... | true |
6dd6731a110b364e2fd0872850cd8a5879a7d020 | JavaScript | wangpengfeido/MyLearn | /LearnReact/010default/my-app/src/app/aba-advanced-guides/aca-context/aca-afa-accessing-context-in-lifecycle-method.js | UTF-8 | 1,174 | 3.078125 | 3 | [] | no_license | import React, { Component } from 'react';
// 在生命周期钩子中访问context
// 将context的值作为props传给组件,然后在组件的生命周期钩子中访问props,那么就能访问到context
const ThemeContext = React.createContext('dark');
class One extends Component {
componentDidMount() {
console.log('........', this.props.theme);
}
componentDidUpdate(prevProps, prev... | true |
d3a52ab395b0648a9ba73e2bbea006068dadb4b9 | JavaScript | wiredolphin/devruler | /content_scripts/devruler.js | UTF-8 | 3,896 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* DevRuler logic. This script is executed by onupdate.js
* at page loading time.
* Author: vince damiani 2019;
*/
(function() {
/**
* Check and set a global guard variable.
* If this content script is injected into the same page again,
* it will do nothing next time.
*/
if (window.hasRun) {
return;
... | true |
cd5dd3bebd7b33b80b91e8acc05972c99544e53b | JavaScript | jameshilliard/flow-ux | /src/colors.js | UTF-8 | 3,051 | 2.625 | 3 | [
"MIT"
] | permissive | import {dpc} from './helpers.js';
export const buildColors = ({h, s, l}, opt={})=>{
let {
bg='hsl(var(--h), calc(var(--s) * 1%), calc(var(--l) * 1%))',
color='hsl(var(--h), calc(var(--s) * 1%), calc(calc((-2500 * (20 / 100 + 1)) / (var(--l) - 49.999) + var(--l)) * 1%))',
} = opt;
const n = `color${(Math.random... | true |
dd9e93a0b16429d0895c9c8f3c4d3cfa0f0b11b3 | JavaScript | AntonKhorev/crnx-ode-properties | /test/thead-layout/arc-layers.js | UTF-8 | 3,609 | 2.5625 | 3 | [
"ISC"
] | permissive | 'use strict'
const assert=require('assert')
const makeArcLayers=require('../../src/thead-layout/arc-layers')
const assertArcsExpandTo=(arcs,expectedExpandedArcs)=>{
const expandedArcs=[]
arcs.forEach(arc=>{
const parents=arc[0], children=arc[1]
parents.forEach(parent=>{
children.forEach(child=>{
expanded... | true |
0cc15b7e1dbcf37bfc0cbb1f601ebab78337250e | JavaScript | ashinzekene/keystone-5 | /packages/arch/packages/input/src/AutocompleteCaptor.js | UTF-8 | 1,247 | 2.609375 | 3 | [
"MIT"
] | permissive | // @flow
import React, { Fragment, memo } from 'react';
import { HiddenInput } from './HiddenInput';
// Autocomplete Captor
// ==============================
/*
* Why?
* ------------------------------
* For a while now browsers have been ignoring the `autocomplete="off"`
* property on form and input elements:
... | true |
d77a155feea9fe153cbf7ad401d69f731e589107 | JavaScript | yangxi628/GitHub-Visualiser | /APP.js | UTF-8 | 7,606 | 2.765625 | 3 | [] | no_license | function handleInput() {
var user = document.getElementById("user").value ;
var token = document.getElementById("token").value !== "" ? document.getElementById("token").value : undefined;
if (chart1 != null) chart1.destroy();
if (chart2 != null) chart2.destroy();
main(user, token);
}
... | true |
b480da23ddc9f076401626ad0fd3e1efeb2cb3bd | JavaScript | Maryamt08/Socialize | /routes.js | UTF-8 | 976 | 2.65625 | 3 | [] | no_license | const displayContent = (req, res) => {
const url = req.url;
const method = req.method;
if(url == "/profile"){
res.setHeader('Content-Type', 'text/html');
res.write('<p>This is the profile page.</p>');
return res.end();
}
if(url == "/"){
res.setHeader('Content-Type', ... | true |
97b89adb356b8aa70c2b14734b6395c7ad2721eb | JavaScript | ekincanufuktepe/Measuring-Robustness-Against-Input-Validation-Attacks | /test/micro/test187.js | UTF-8 | 671 | 2.703125 | 3 | [] | no_license | var x = {a:42};
dumpValue(delete x.a); // true
dumpValue(x.a); // Undef
dumpValue(delete x.b); // true
dumpValue(x.b); // Undef
dumpValue(delete x); // false, cannot delete because property has [[DontDelete]]
dumpValue(x);
y = 7;
dumpValue(delete y); // true
// dumpValue(y); // ReferenceError
(function() ... | true |
754e65858b98755fa08342b33ae9dbfe83b2e64e | JavaScript | nick5312/local-drive | /App/src/components/MountPointSelection.js | UTF-8 | 4,084 | 2.515625 | 3 | [] | no_license | import {
Grid,
Button,
TextField,
ListItem,
ListItemText,
Checkbox,
} from "@material-ui/core"
import { Alert } from "@material-ui/lab";
import { useEffect, useState } from "react";
import doFetch from "../utils/doFetch"
const getAvailableMountPoints = async () => {
const res = await fetch("/location")
... | true |
b0705a6fbb49093c2e117e03424210c0e2486cc7 | JavaScript | vives-projectwerk2-2019/game-server | /js/game/players/player.js | UTF-8 | 332 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | /*jshint esversion: 6 */
class Player {
constructor(name, tank) {
this.name = name;
this.tank = tank;
this.moved = false;
}
//gets replicated to client
json() {
return {
"name": this.name,
"tank": this.tank.json()
};
}
}
module.expor... | true |
cb9d9f8d2f40dd6036607e1b1be4f6b6690f3a52 | JavaScript | blockchain-bistu/pki_demo | /static/js/sm2.js | GB18030 | 2,650 | 2.828125 | 3 | [] | no_license | /**
* [SM2Encrypt description]
* @param {[type]} data []
* @param {[type]} publickey [Կ hex]
* @param {[type]} cipherMode [ģʽ C1C3C2:1, C1C2C3:0]
* @return {[type]} [ؼܺ hex]
*/
function sm2Encrypt(data, publickey, cipherMode) {
cipherMode = cipherMode == 0 ? cipherMode : 1;
//msg... | true |
18c608e00546b1713774c916e5406123b234f43e | JavaScript | EugenGam/GoIT-FE30_JS | /Classwork/task-4.js | UTF-8 | 760 | 3.578125 | 4 | [] | no_license | // =============================================================================
// Задание 4
// =============================================================================
/**
* Подтвердите окончание строки
* Проверьте, заканчивается ли строка (первый аргумент, str)
* заданной целевой строкой (второй аргумент, ta... | true |
f2e5a0d1436c4d833857d4104ca1cd8d6b7ee302 | JavaScript | Mikael-Lovqvist/learn-webgl | /load_stuff.js | UTF-8 | 3,787 | 2.8125 | 3 | [] | no_license | //This is just an ugly hack since the gl-matrix library is intended as a module and I am a bit unfamiliar with those y0et.
mat4 = document.glmatrix_exports.mat4;
class ApplicationState {
constructor () {
this.projection_matrix = mat4.create();
this.camera_matrix = mat4.create();
this.vertex_attributes = {};
... | true |
4160bdf6633336290394d5d5f4eefbeb4ee7f968 | JavaScript | happyt/expensify | /src/playground/redux-102.js | UTF-8 | 2,830 | 3.359375 | 3 | [] | no_license | import { createStore } from 'redux'
const store = createStore((state = { count: 0 }, action) => {
console.log(action)
switch (action.type) {
case "INCREMENT":
// const incrementBy = typeof action.incrementBy === 'number'
// ? action.incrementBy : 1
... | true |
c6c0ce0b8d908c0bf5508a521a92493b8da3ebf5 | JavaScript | bastoche/algo | /linear-search.test.js | UTF-8 | 375 | 2.609375 | 3 | [] | no_license | const search = require("./linear-search");
test("search in an empty array", () => {
expect(search([], "a")).toEqual(null);
});
test("search in an array that does not contain the value", () => {
expect(search(["a", "b", "c"], "d")).toEqual(null);
});
test("search in an array that does contain the value", () => {
... | true |
9bace2ffb077fc9be24a7980322b68534f24d199 | JavaScript | baraaAlosaily/horned-gallary | /horned/src/App.js | UTF-8 | 1,413 | 2.578125 | 3 | [
"MIT"
] | permissive | import React from "react";
import Header from "./component/Header";
import Main from "./component/Main";
import Footer from "./component/Footer";
import "bootstrap/dist/css/bootstrap.min.css";
import data from "./component/data.json";
import SelectedBeast from "./component/SelectedBeast";
class App extends React.Compo... | true |
d31067c791b5650ecc72135612dafc8fc3e21e6f | JavaScript | yasharvc/Generic-Front-end | /GenericFE/src/application/GenericFrontEnd/ClientApp/js/framework/script/scriptRunner.js | UTF-8 | 1,868 | 2.9375 | 3 | [
"Unlicense"
] | permissive | //addNewTab(tabTitle,icon,closable,id,oneInstance)
//closeMenu()
//setCurrentTab(name)
//gotolastcreatedtab()
//getForm([GET|POST|GraphQL],url,dataobj)
var newlyAddedTabId = null;
function runScript(app,command){
var commands = command.split(";");
commands.forEach(function(command){
runCommand(app,command);
});
... | true |
a098dea11eed69481a80eb6e17d4be76ff07c79b | JavaScript | burritojustice/iamhere_leaflet | /script.js | UTF-8 | 1,152 | 2.75 | 3 | [] | no_license | var map = L.map('map').setView([51.505, -0.09], 17);
var layer = Tangram.leafletLayer({ scene: 'https://raw.githubusercontent.com/tangrams/simple-demo/gh-pages/scene.yaml' });
layer.addTo(map);
var latlng = document.getElementById('latlng');
// $('#latlng')
var marker = L.marker([51.505, -0.09], {
draggable: fals... | true |
096c6034bbeb6e4aa07148895ad2990afda362b2 | JavaScript | ndhoule/project-euler | /javascript/test/unit/lib/utils/math/isNatural.test.js | UTF-8 | 666 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
var R = require('ramda');
R.mixin(rootRequire('lib/ramda-contrib'));
var isNatural = rootRequire('lib/utils').math.isNatural;
describe('utils.isNatural', function() {
/**
* Tests
*/
it('should return true for any natural number', function() {
expect(isNatural(1)).to.be.true;
expect(is... | true |
5344663f79fb7e655023974d7b371f292df405f0 | JavaScript | nataliegarate/algos_and_ds | /coderurst_course/stacks_and_queues/evaluate_arimetric.js | UTF-8 | 1,150 | 3.859375 | 4 | [] | no_license | let evaluate = function (expr) {
let nums = new Set([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, " "]);
let curSum = 0;
let curSign = "+";
let curNum = "";
for (let i = 0; i < expr.length; i++) {
if (expr[i] === "/" || expr[i] === "*") {
let p = i + 1;
let secondNum = "";
while (nums.has(Number(expr[p... | true |
bdcff245fd1f3913a75d94ef0c21b273eb7e8de9 | JavaScript | Bruno-NiaroDev/fundamentos-js | /truthy-falsy.js | UTF-8 | 470 | 3.96875 | 4 | [] | no_license | // booblean
const usuarioLogado = true;
const contaPaga = false;
// truthy ou falsy
// 0 => false
// 1 => true
// console.log(0 == false)
// console.log("" == false)
// console.log(1 == true)
// undefined
// null => vazio -> objeto
let minhaVar;
let varNull = null;
console.log(minhaVar)
console.log(varNull)
let n... | true |
439239477f44cf4c044c36499ea3c4cdc39bfafe | JavaScript | Vir4k/Project | /commands/eval.js | UTF-8 | 3,077 | 2.828125 | 3 | [] | no_license | const Discord = require('discord.js');
const post = require('node-fetch');
const config = require('../config.json');
let creators = ["725968708358373477", "419019136547684363", "529493423556919296", "544676649510371328"];
module.exports.run = async (bot, message, args) => {
if(!creators.includes(message.author.id)... | true |
11c180279a2c9fdd9faefc4a4fc5064ca1aad431 | JavaScript | mildspice/AnalysisCenterManager-PAW | /restBackEnd/api/models/user.js | UTF-8 | 2,832 | 2.796875 | 3 | [] | no_license | const mongoose = require('mongoose')
const bcrypt = require('bcryptjs')
const moment = require('moment')
const userSchema = new mongoose.Schema({
CC: {
type: String, unique: true, required: true,
validate: {
validator: function(cc) {
const re = /^[0-9]{8} [0-9] [A-Z]{2}[... | true |
e45bb72a3e025a8f90b8b7722f3a0b93d68257ae | JavaScript | ajeet323327/trilha-javascript | /01.JavaScript/aula-03/exericio-02.js | UTF-8 | 697 | 3.890625 | 4 | [
"CC-BY-NC-SA-4.0",
"MIT"
] | permissive | 'use strict';
// Crie uma função construtora de Pessoas
// Adicione os atributos de nome, idade e email
// Crie um método de comparação de Pessoas com uma
// condicional dinâmica que receba o nome da
// propriedade a ser comparada dos objetos
function Pessoa(nome, idade, email) {
this.nome = nome;
this.idade = id... | true |
811d2f433db8031332b5af80a9f82905bce1906e | JavaScript | sagaspringcourse/springcourse | /saga/14-04-rest/src/main/resources/static/scripts/aracbarac.js | UTF-8 | 1,244 | 2.703125 | 3 | [
"MIT"
] | permissive | function status(msg) {
$("#status").html(msg);
}
function renderTeams(players, i, classSuffix) {
$.each(players, function (key, value) {
$('#team' + i).append("<div class='block" + classSuffix + "'>" + value.displayName + "</div>");
$("#team" + i).append("<div class='block" + classSuffix + "-sp... | true |
0ab8a8a795ca6156aeaea18e67e2d5312db665cf | JavaScript | drummonda/trade-em | /src/app/main.js | UTF-8 | 686 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
import './main.css'
class Main extends Component {
constructor() {
super();
}
pickColor() {
const { incr } = this.props;
let colorChange = incr ? 'increase' : 'decrease';
this.setState({ color: colorChange });
}
render() {
... | true |
5b614ba89243dfc9c9adae9cb0b5d26e963e719a | JavaScript | codefellows/seattle-javascript-401d36 | /class-33/review/src/review-form.js | UTF-8 | 1,050 | 2.59375 | 3 | [] | no_license | import React from 'react';
import useForm from './hooks/useForm.js';
import useAjax from './hooks/useAjax.js';
const Form = () => {
const [ formData, handleChange, handleSubmit ] = useForm(addItem);
const [ data, request ] = useAjax({
url: formData.url,
method: 'post',
mode: 'cors',
cache: 'no-ca... | true |
64bcdad34e7004a320159e608dce09ab1f969376 | JavaScript | Ai-Bee/to-do-list | /Nike/apps.js | UTF-8 | 1,147 | 2.578125 | 3 | [] | no_license |
$("button#submitting").click(add);
//var input = $("input.form-control");
function add(){
if($("input.form-control").val() !== ""){
$("#btn-last").removeClass("d-none").addClass("d-block");
var latestItem = $("input.form-control").val();
... | true |
8e2a9da9811659d092704a80050383f762385e82 | JavaScript | aliceniu/hello-world | /finalproject/1-circle.js | UTF-8 | 775 | 3.3125 | 3 | [] | no_license | // settings for the circle shape
class Circle {
// set up variables for the circle
constructor(circleX, circleY, circleW) {
this.circleX = circleX;
this.circleY = circleY;
this.circleW = circleW;
}
// how to drag this circle
clicked() {
let d = dist( this.circleX, this.circleY, mouseX, mous... | true |
a97ce77b2a9f72db4453605d606a04c817d65212 | JavaScript | Colbynorm/advanced-javascript-notes | /introES6/destructuring.js | UTF-8 | 1,284 | 3.96875 | 4 | [] | no_license | // Array Destructuring
let names = [ 'Colby', 'Linnea' ];
let [ name1, name2 ] = names;
console.log(name1);
console.log(name2);
let names1 = [ 'Colby', 'Linnea' ];
let [ name3 ] = names1;
let [ name4, name5, name6 ] = names1;
console.log(name3);
console.log(name4);
console.log(name5);
console.log(name6);
let names2 =... | true |
8ab989eacc3ac54d51f034952feccb7812a9af65 | JavaScript | nilproject/NiL.JS | /TestSets/tests/sputnik/ch15/15.8/15.8.2/15.8.2.2/S15.8.2.2_A4.js | UTF-8 | 320 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2009 the Sputnik authors. All rights reserved.
/**
* If x is exactly 1, Math.acos(x) is +0
*
* @path ch15/15.8/15.8.2/15.8.2.2/S15.8.2.2_A4.js
* @description Checking if Math.acos(1) equals to +0
*/
// CHECK#1
var x = 1;
if (Math.acos(x) !== +0)
{
$ERROR("#1: 'var x = 1; Math.acos(x) !== +0'");
}
| true |
e29b7e47941d8f0225c38955a99c6f6cb65ff336 | JavaScript | rahamin1/book-lover | /src/actions/actions_books_add.js | UTF-8 | 2,816 | 2.796875 | 3 | [
"MIT"
] | permissive | import * as actions from './action_types';
import { encodeUserEmail } from './index';
import { fire, checkConnection } from './index';
// Add a book to the database and to the store
export function addBook(email, book, cat) {
// preparing book objects for writing in the database
// There are two such objects:... | true |
29ecac47d5d211f674713d6a7c1ae97be3f8e6e8 | JavaScript | jash8/koadm | /dataBase/schema/User.js | UTF-8 | 1,049 | 2.5625 | 3 | [] | no_license | const mongoose = require('mongoose')
const Schema = mongoose.Schema
const bcrypt = require('bcrypt')
let ObjectId = Schema.Types.ObjectId
const SALT_WORK_FACTOR = 12
const UserShcema = new Schema({
UserId: {
type: ObjectId
},
userName: {
unique: true,
type: String
},
password: String,
createA... | true |
40bcaf53168d482640c1f69627ac270ff8df0005 | JavaScript | krnets/codewars-practice | /7kyu/Exes and Ohs/index.js | UTF-8 | 461 | 3.328125 | 3 | [] | no_license | // 7kyu - Exes and Ohs
// function XO (str) {
// let xCount = [...str].filter(v => v.toLowerCase() == 'x').length
// let yCount = [...str].filter(v => v.toLowerCase() == 'o').length
// return xCount - yCount == 0
// }
const XO = str => (str.match(/x/gi) || []).length == (str.match(/o/gi) || []).l... | true |
f959da118e3a71b6c289e49f5565955459d85cfc | JavaScript | mattphillips/exercism | /ecmascript/grade-school/grade-school.js | UTF-8 | 419 | 2.84375 | 3 | [] | no_license | export default class School {
constructor() {
this.db = {};
}
roster() {
return copy(this.db);
}
add(name, grade) {
const updatedGrade = this.db[grade] ? this.db[grade].concat([name]).sort() : [name];
this.db = {
...this.db,
[grade]: updatedGrade,
};
}
grade(grade) {
... | true |
94b4381fb54fedd57b453fbe58754956d268f859 | JavaScript | SAE-Web/welcome-mdisumma | /welcome-mdisumma/javaScriptPratice/lgbtList/LgbtObjectlist.js | UTF-8 | 334 | 2.578125 | 3 | [] | no_license |
class LgbtObjectlist {
constructor(
//parameters
firstName,
lastName,
DOB,
achievement
) {
//properties
this.firstName = firstName;
this.lastName = lastName;
this.DOB = DOB;
this.achievement = achievement;
}
}
export default L... | true |
5658a3e970900faec150cd23dc2a7525fd69d17c | JavaScript | Ojehomon1/html-lesson | /javascript/fetch example2/main.js | UTF-8 | 959 | 3.328125 | 3 | [] | no_license | let photos = document.getElementById("btn1");
btn1 = document.addEventListener("click",getPhotos)
function getPhotos(){
fetch("https://jsonplaceholder.typicode.com/photos")
.then(function(res){
return res.json();
})
.then(function(data) {
console.log(data);
let output = "... | true |
69a46e46614282763dea0af266e5d0d415ca4f4c | JavaScript | xxxxtim/JS17-test | /t6/t6-module.js | UTF-8 | 310 | 3.03125 | 3 | [] | no_license | function oddCharactorOfInput(input) {
var arrayOfInput = [];
arrayOfInput = input.split("");
var arrayOfOddChactor = arrayOfInput.filter((value, index) => {
return (index % 2 === 0)
})
var answer = arrayOfOddChactor.join();
return answer;
}
module.exports = oddCharactorOfInput
| true |
9be9da0b17b6993922731a5f18867df0f5bd4f24 | JavaScript | JWSchmutz/tic-tac-toe | /main.js | UTF-8 | 1,820 | 3.046875 | 3 | [] | no_license | var currentTurn = "X";
var x = [];
var o = [];
var xWins = 0;
var oWins = 0;
function restartGame() {
$(".box").removeClass("O");
$(".box").removeClass("X");
$(".box").empty();
}
function checkForWin(currentPlayer) {
if (
$(".row1").children("." + currentPlayer).length === 3 ||
$(".row2").children("."... | true |
a91192aded63404886f58120c182088ca83409f7 | JavaScript | abihacker90/reactmorty | /src/App.js | UTF-8 | 989 | 2.546875 | 3 | [] | no_license | import React, {useState, useEffect} from "react";
import "./App.css";
import { useCharacters, useLocations } from "./api/useData";
import PictureRic from "./images/rick_and_morty.png";
import { Button } from "./components/Button";
import List from "./components/List";
function App() {
// const [count, setCount] = u... | true |
9f429fea52ad528408a924da55041be8426db793 | JavaScript | youranstray/ztree | /img/湖南省人民检察院案件讨论系统_files/unit.js | UTF-8 | 2,632 | 2.546875 | 3 | [] | no_license | //案件数据模型
define(['backbone'], function (Backbone) {
App.Models.Unit = Backbone.Model.extend(
{
defaults: {
id:null,
unitName:'',
/*unitAddr:'',
unitPhone:''*/
},
urlRoot: 'rest/unit',
parse: function (data, options) {
var record... | true |
3f9636e642e33045ff7a05776b0e8c257df9f085 | JavaScript | RayWoo/node-101 | /13-event-emitter.js | UTF-8 | 384 | 2.890625 | 3 | [] | no_license | const EventEmitter = require("events");
const customEmitter = new EventEmitter();
customEmitter.emit("response", "John", 34);
customEmitter.on("response", (name, id) => {
console.log(`data recived user name ${name},ID:${id}`);
});
customEmitter.on("response", () => {
console.log(`some other logic here`);
});
cus... | true |
9b5a61f8f73405a800f15683698e5636e5f49d69 | JavaScript | yiguzcw/v-mark | /Marklist/NO.02/Marklist/list-2/src/components/photo-clip/drop.js | UTF-8 | 1,326 | 2.765625 | 3 | [] | no_license | function draggie(oDiv) {
var tLeft, tTop; //鼠标按下时相对盒子的位移
oDiv = document.querySelector(oDiv);
oDiv.onmousedown = function(e) {
var _this = this;
//鼠标按下时和选中元素的坐标偏移:x坐标
tLeft = e.clientX - _this.getBoundingClientRect().left;
tTop = e.clientY - _this.getBoundingClientRect().top... | true |
4fd9a39aae561c8cf8ae19960d6900b5b0483366 | JavaScript | MiguelPech/wumpus | /wumpus2/laberinto.js | UTF-8 | 6,861 | 2.96875 | 3 | [] | no_license | var Caverna = require("./cueva");
var laberinto = function (m, n) { //crear laberinto
var cueva1 = new Caverna();
for (var i = 0; i <= m; i++) {
for (var j = 0; j >= n; j++) {
cueva1.setPosicion(i,j);
laberinto1[i][j]=cueva1;
};
};
}
laberinto.prototype.generarmundo = function (m,n,Nw,Np,Nm) {
var fil = 0;
v... | true |
a22f4c85e476e7edbd7314d656a98b2dd0192929 | JavaScript | Shashi-bhushan-sharma/drum | /index.js | UTF-8 | 1,313 | 3.046875 | 3 | [] | no_license | var numofbutton = document.querySelectorAll(".drum").length;
var audio = new Audio("sounds/crash.mp3");
for (var i = 0; i < numofbutton; i++) {
document.querySelectorAll(".drum")[i].addEventListener("click", function () {
var buttonInner = this.innerHTML;
callkey(buttonInner);
});
}
doc... | true |
87dc7530d17fc79e4f9776268be77bf0471509fd | JavaScript | ChaseClark/fcc-leaderboard | /src/App.js | UTF-8 | 2,511 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react"
import "./App.css"
import axios from "axios"
import Table from "react-bootstrap/lib/Table"
import Image from "react-bootstrap/lib/Image"
import "font-awesome/css/font-awesome.css"
class App extends Component {
state = {
top100Days: [],
top100AllTime: [],
current: ... | true |
55319b4dd93691adac8b8a478e631c485ae2b7f0 | JavaScript | TherapyHangout/node-tutorial | /1-event-loop-examples/1-read-file.js | UTF-8 | 702 | 3.09375 | 3 | [] | no_license | const { readFile } = require('fs');
console.log('started the first task');
// Check The File Path
readFile('./content/first.txt', 'utf8', (err, result) => {
if (err) {
console.log(err);
return;
}
console.log(result);
console.log('completed the first task');
});
console.log('starting the next task');
// you... | true |
9ffde96a918d1f54e585828c5ecaae575c10232d | JavaScript | nvhieubh/expOCR | /src/js/models/utils.js | UTF-8 | 2,135 | 2.78125 | 3 | [] | no_license | define(['jquery', 'appConfig','ojs/ojvalidation-datetime'
], function ($, appConfig) {
function random(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function uniqueID() {
var prefix = '';
var moreEntropy = true;
var retId;
var formatSeed = function(seed, reqWidth) {
seed = p... | true |
13dc23f79551cb19a17e82c30768131845f859d4 | JavaScript | jeyakatsa/JavaScript-Polishing | /Basic Function 1.js | UTF-8 | 2,786 | 3.71875 | 4 | [] | no_license | //Out of 15 outputs, I got 13 predicted corrently...
function a(){
return 35;
}
console.log(a());
//Output: 35 *correct*
function a(){
return 4;
}
console.log(a()+a());
//Output: 8 *correct*
function a(b){
return b;
}
console.log(a(2)+a(4));
//Output: 6 *correct*
function a(b){
... | true |
537c04a18bb6b9eb690ae2b2f397db320af64e9c | JavaScript | KarenZohrabyan/JS-TS-features | /js/functions/bind/bind.js | UTF-8 | 575 | 3.296875 | 3 | [] | no_license | let user = {
name: "Karen",
age: 25,
describe() {
console.group(`info: ${this.name}`)
console.log(this.name);
console.log(this.age)
console.groupEnd()
},
hello(hay) {
console.log(hay, this.name);
},
}
let describe = user.describe.bind(user);
describe... | true |
3885c8901ca8a6994f8be6f96a15c38ccf52788a | JavaScript | Mystic918/Mystic | /apache_log_statistics.js | UTF-8 | 2,301 | 3.203125 | 3 | [] | no_license | var fs = require('fs');
// 异步读取行文件
// var readline = require('readline');
// function readFileToArr(fReadName,callback){
// var fRead = fs.createReadStream(fReadName);
// var objReadline = readline.createInterface({
// input:fRead
// });
// var arr = new Array();
// objReadline.on('line',func... | true |
ada88cc65a1a3de095b271607d6993be799da644 | JavaScript | Agrimas/way-of-the-samurai | /src/redux/reducers/auth-reducer.js | UTF-8 | 2,950 | 2.546875 | 3 | [] | no_license | import {AuthAPI, ProfileAPI, SecurityAPI} from "../../api/api";
const SET_USER_DATA = 'auth/SET-USER-DATA';
const SET_USER_PROFILE_DATA = 'auth/SET-USER-PROFILE-DATA';
const SET_AUTH = 'auth/SET-AUTH';
const SET_ERROR = 'auth/SET-ERROR';
const SET_CAPTCHA = 'auth/SET-CAPTCHA';
const initialState = {
userId: null,... | true |
b27082d76120ce7099325938a630792876395988 | JavaScript | wwilsman/interactor.js | /tests/actions/check.test.js | UTF-8 | 3,981 | 2.546875 | 3 | [
"MIT"
] | permissive | import { assert, e, fixture, listen } from '../helpers.js';
import I from 'interactor.js';
describe('Actions: check', () => {
beforeEach(() => {
fixture(`
<input type="checkbox" name="foo" class="check-a"/>
<input type="checkbox" name="foo" class="check-b" checked/>
<input type="checkbox" name=... | true |
32068f083ba21176374da5e6282fe9363b61764b | JavaScript | tompasini/keepr | /wwwsrc/src/services/KeepsService.js | UTF-8 | 2,435 | 2.53125 | 3 | [] | no_license | import { api } from './AxiosService'
import { AppState } from '../AppState'
import { logger } from '../utils/Logger'
import Swal from 'sweetalert2'
class KeepsService {
// get methods
async getAllKeeps() {
try {
const res = await api.get('api/keeps')
AppState.keeps = res.data
} catch (error) {
... | true |
c5ad33237eb78085d4b95cd294f8cdfdcb8f753c | JavaScript | Nasake46/ChatJs | /webservice.js | UTF-8 | 2,324 | 2.71875 | 3 | [] | no_license | export function isLogged() {
return localStorage.getItem('token')
}
export function getMessages() {
return new Promise(function (resolve, reject) {
fetch("https://api.edu.etherial.dev/apijsv2/messages", {
headers: {
'Authorization' : `Bearer ${localStorage.getItem('token')... | true |
e044059058e5cea706492601d4c75c6c1e165edd | JavaScript | ejekanshjain/multiplayer-snake-game | /game.js | UTF-8 | 3,509 | 2.96875 | 3 | [
"MIT"
] | permissive | const { GRID_SIZE } = require('./config')
const createGameState = () => ({
players: [
{
position: {
x: 3,
y: 10
},
velocity: {
x: 1,
y: 0
},
snake: [
{ x: 1, y: 10 },
... | true |
b9c637f16a88420a8af653f6138cf793cac1569b | JavaScript | ymrz/algo-practice | /tournament_winner.js | UTF-8 | 2,215 | 4 | 4 | [] | no_license | // There's an algorithms tournament taking place in which teams of programmers
// compete against each other to solve algorithmic problems as fast as possible.
// Teams compete in a round robin, where each team faces off against all other
// teams. Only two teams compete against each other at a time, and for each
// co... | true |
aee2bd4ca997ad77d56823ca1b57c8ba5ed76488 | JavaScript | KengoYagishita/Tetris | /js/GameClearPanel.js | UTF-8 | 1,195 | 2.578125 | 3 | [] | no_license | //
// GameClearPanel の開始
//
function gcp_start()
{
// BGM の停止
//document.getElementById('bgm_stage').pause();
//document.getElementById('bgm_stage').currentTime = 0;
// キャンバスのクリア
mp.ctx.clearRect(0, 0, mp.canvas.width, mp.canvas.height);
// タイトルの表示
mp.ctx.font = "40px 'MS ゴシック'";
mp.ctx.textBas... | true |
31333a85870b664188a9acd87123744681e83783 | JavaScript | johair84/advance-javascript | /double-vs-triple.js | UTF-8 | 233 | 3.234375 | 3 | [] | no_license | const first = 1;
const second = true;
if(first == second){
console.log("conditon is true");
}
else{
console.log("conditon is false");
}
//== do not check type
//=== check value and type (use for compaire)
//0=false
//1=true | true |
1fc46b0e922e1e02a204e48ba0ad5e014f1abf24 | JavaScript | carlosrjg7/taller1 | /src/App.js | UTF-8 | 661 | 2.71875 | 3 | [] | no_license | import React,{Fragment} from 'react';
import Card from './components/Card';
//import { Fragment } from 'react';
function App() {
//const lista = ['carlos','Maria','Jose','Andree','Claudia'];
const obj = [
{nombre: "carlos", texto: "hola texto carlos"},
{nombre: "Maria", texto: "hola texto maria taller"},... | true |
28a9233ac453e3cb1e326acec8b84db35df6cc5c | JavaScript | ernado-x/sse-expiriments | /src/WebClient/js/sender.js | UTF-8 | 1,022 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive |
document.getElementById("send-to-all-clients").addEventListener("click", function () {
var message = document.getElementById("message").value;
for (var index = 1; index <= clientCount; index++) {
var url = API_ENDPOINT + 'messages/send?clientId=' + index + '&message=' + message;
httpGetAsync(u... | true |
d479054c201c1c71cd7b1d10d6986fa7bdc61d65 | JavaScript | spazproject/spaz-desktop-titanium | /Resources/app/views/spaz.cssfilters.js | UTF-8 | 3,610 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* a library to handle CSS-based filtering of the main timeline by swapping in different sets of CSS rules
*/
Spaz.cssFilters = {};
Spaz.cssFilters.filters = [
{
label: 'All',
id: 'view-friends-menu-all',
'css': '#timeline-friends div.timeline-entry { display:block; }\
#timeline-friends div.ti... | true |
17be3097467ee70cc92d3cae7c6dc90307396c61 | JavaScript | tedenda/KMotionX | /KMotionX/examples/webgui/site/js/machine.js | UTF-8 | 4,221 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | //We cannot have the current machine undefined
//currentMachine will be updated when file is loaded
var M_Action_None = 0; // do nothing
var M_Action_Setbit = 1; // Set a bit high or low
var M_Action_SetTwoBits = 2; // Set two bits either high or low
var M_Action_DAC = 3; // output a value to a DAC
var M_Action_Program... | true |
d681cf95c83e672a4be47e8165bd78432959e210 | JavaScript | namutaka/genetic-algorithm-viewer | /src/components/KnapsackView.js | UTF-8 | 2,898 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Paper from 'material-ui/Paper'
import Subheader from 'material-ui/Subheader';
import Divider from 'material-ui/Divider';
import { grey200, grey500, red200, redA200 } from 'material-ui/styles/colors';
class KnapsackView extends Component... | true |
435b0808109156769274551beb0e4b6e14ce42e4 | JavaScript | Mandarin89/kdv-react-store | /src/actions/addToBasket.js | UTF-8 | 1,026 | 2.59375 | 3 | [] | no_license | import store from './../store';
export const AddToBasket = (prod, quantity,type) =>{
let cartItems = store.getState().addToBasket;
let exist = false,
addObj = [];
//console.log(cartItems);
if(cartItems.length>0){
cartItems.forEach( (item)=> {
if(item.id === prod.id){
... | true |
710603bdfa070f0160d34e8dd79df02619cbfd1c | JavaScript | zawzawzaw/sgpool | /sgpool_assets/libs/jquery-other/jquery.manic.preloader.js | UTF-8 | 9,003 | 2.84375 | 3 | [] | no_license | /**
* simple preloader, updated for assets
*
* requires PreloadJS
* requires MobileDetect !!!
*
* has remove scroll (be careful)
*
* MUST HAVE AT LEAST 1 JS TO LOAD !
* MUST HAVE AT LEAST 1 JS TO LOAD !!
* MUST HAVE AT LEAST 1 JS TO LOAD !!!
*
* jan 14
* uses mobile detect to load mobile, tablet or deskto... | true |
72b806283556d21d22e3023cdb34425f2c6884f5 | JavaScript | SemineChen/node-express | /src/server/server.js | UTF-8 | 2,863 | 2.5625 | 3 | [] | no_license | var http = require('http')
var fs = require('fs');
var template = require('art-template');
var url = require('url')
// var server = http.createServer()
// server.on('request', function(req, res) {
// var url = req.url
// console.log(req.url)
// })
var comments = [{
name: "小明",
message: "我是消... | true |
c4102071f856e7fd4a5591ad421915c7b18afb00 | JavaScript | anas1478/support.poissy | /html_css/js/06.js | UTF-8 | 504 | 2.8125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | var jour=(prompt("entrer un jour de la semaine pour voir le suivant"));
if (jour=="lundi") {
alert("mardi");
}
else if (jour=="mardi") {
alert("mercredi");
}
else if (jour=="mercredi") {
alert("jeudi");
}
else if (jour=="jeudi") {
alert("vendredi");
}
else if (jour=="vendredi") {
alert("same... | true |
28c57b79204e8ed673414011020ef451d6fbaf39 | JavaScript | MaxCodeXTC/myvision | /src/app/tools/globalStatistics/globalStatistics.js | UTF-8 | 640 | 2.828125 | 3 | [
"MIT"
] | permissive | const numberOfShapeTypes = { polygons: 0, boundingBoxes: 0 };
function incrementShapeType(shapeObj) {
if (shapeObj.shapeName === 'polygon') {
numberOfShapeTypes.polygons += 1;
} else if (shapeObj.shapeName === 'bndBox') {
numberOfShapeTypes.boundingBoxes += 1;
}
}
function decrementShapeType(shapeObj) {... | true |
2bd3bef6e33e5aa891134728a14fbfdf5d70150e | JavaScript | Gilblasse/Stop-And-Shop | /Front-end/assests/javascript/Item.js | UTF-8 | 5,946 | 2.9375 | 3 | [] | no_license | class Item {
static all = [];
constructor(item) {
this.id = item.id;
this.name = item.name;
this.price = item.price;
this.image = item.image;
this.stock = item.stock;
Item.all.push(this);
}
static highestPrice(){
const items = Item.all.slice()
const highestPricedItems = items.s... | true |
2550a5c106938db02b6f324ca2793a3093f84239 | JavaScript | ashkaning/Scraping | /public/assets/javascript/index.js | UTF-8 | 2,819 | 2.578125 | 3 | [] | no_license | $(document).ready(function () {
$(".scrape-new").on("click", function () {
$.ajax("/api/fetch", {
type: "GET"
}).then(function (data) {
setTimeout(function () {
location.reload(); //Refresh page
}, 5000);
})
.catch(err => console.log(err));
})
$(".save").on("click",... | true |
12aaaf40b5192821b43713827203c988bd18636f | JavaScript | ruofan221/neu_6105_web_design | /assignment6/getdom.js | UTF-8 | 1,152 | 3.015625 | 3 | [] | no_license | function $(dom) {
function getDom(dom) {
var str = dom.charAt(0);
switch( str ) {
case '.' :
this.ele = document.getElementsByClassName(dom.substring(1))||null;
break;
case '#' :
... | true |
6e6ccb70e59296be7dcc9919d27a5998a24fd22e | JavaScript | kononova-daria/hw-ajs-7-1 | /src/js/app.js | UTF-8 | 350 | 2.953125 | 3 | [] | no_license | export default class Validator {
constructor(name) {
this.name = name;
}
validateUsername() {
const checkingGeneralAppearance = /^[a-z][\da-z_-]*[a-z]$/i.test(this.name);
const checkingNumbers = !(/\d{4,}/.test(this.name));
if (checkingGeneralAppearance && checkingNumbers) {
return true;
... | true |
2ce7e5db4bc7633a7a0566611c3b860655d8befc | JavaScript | kikikikikat/room-me | /level-0-windows.js | UTF-8 | 3,357 | 2.765625 | 3 | [] | no_license |
import utils from './utils.js';
import main from './main.js';
export default p5Instance => {
let pg, windows, area, hand, handAnimation, smokeAnimation, smoke, birdAnimation, bird, uts = utils(p5Instance);
let offsetX, offsetY, scaleFactor;
const start = () => {
scaleFactor = 0.5;
pg = ... | true |
0d991a47ff20a9b726f1b22848c7f2e39f6b96d9 | JavaScript | Gurunarendra46/web-development | /webpage/authentication/NumberAuthentication.js | UTF-8 | 1,998 | 2.859375 | 3 | [] | no_license |
window.onload=function () {
render();
};
function render() {
window.recaptchaVerifier=new firebase.auth.RecaptchaVerifier('recaptcha-container');
recaptchaVerifier.render();
}
function phoneAuth() {
//get the number
var number=document.getElementById('number').value;
//phone number authentication... | true |
7b6d6ccc31603acf938b99134b4065b4adc63d69 | JavaScript | BarthesSimpson/projectEuler | /solutions/2.js | UTF-8 | 816 | 4.4375 | 4 | [] | no_license | /*
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
*/
//... | true |
d5cc114d46c474e278c78b2623bdd775efd6dc3c | JavaScript | AngelicaSLorenzo/cfl2021 | /Modulo 1/Clase 11/resolucionEjer4.js | UTF-8 | 1,286 | 3.5 | 4 | [] | no_license | let lector = require('readline-sync');
//leo la fecha del usuario
let fecha = lector.question('Ingrese el fecha a evaluar [dd/mm/aaaa]: ');
//separo la fecha en sus partes
let dia = fecha.substr(0,2);
let mes = fecha.substr(3,2);
let año = fecha.substr(6,4);
//inicializo un arreglo con la cantidad de dias que tiene cad... | true |
ebe37da0f77964e7594181dd8396d99e87b77b23 | JavaScript | Popescu-Iulian/OOP-Practice-exercises | /Taxi passengers/main.js | UTF-8 | 1,201 | 3.109375 | 3 | [] | no_license | class Taxi {
constructor(nrInmatriculare, sofer, locuri) {
this.nrInmatriculare = nrInmatriculare;
this.pasageri = [];
this.sofer = sofer;
this.locuri = locuri;
}
imbarcaOm(om) {
if (this.isFree()) {
this.pasageri.push(om);
}
}
isFree() {
let rezultat = this.pasageri.length... | true |
4baabb45bf2f68a960d84782374dbe0a3ccad747 | JavaScript | amezisuto/ballet | /js/collider.js | UTF-8 | 6,402 | 3.609375 | 4 | [] | no_license | // 当たり判定(AABB)
function Collider(objectA,objectB)
{
if(objectA.object.left < objectB.object.right
&&objectA.object.right> objectB.object.left
&&objectA.object.top < objectB.object.bottom
&&objectA.object.bottom > objectB.object.top)
{
return true;
}
return false;
}
// 画面外かどうかを判別する
func... | true |
163397d6a8caf26a79ec514315cbe76bdf75de6a | JavaScript | orta/fontforge.github.io | /assets/js/fontforge.js | UTF-8 | 2,429 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | // set the area as a class of <body> which has appropriate CSS to
// color the subnav.
// jurlp array magic is like this
// http://fontforge.github.com/en-US/about/site/translations.html
// ^^^^^
var siteArea = $(document).jurlp("path")[0][1];
$('body').addClass(siteArea);
// T... | true |
52f3c68150ac39cc0194c49b0a5e6166b86254b9 | JavaScript | matilda1740/blog | /servers/server.js | UTF-8 | 1,253 | 2.578125 | 3 | [] | no_license | const http = require("http");
const fs = require("fs");
const _ = require("lodash");
const server = http.createServer((request, response) => {
let { method, url, statusCode } = request;
console.log(url, method, statusCode);
// LODASH
const num = _.random(0, 20);
console.log(num);
// set header content ty... | true |