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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
89d3fdfc5ba0c1b905a2f9b856ba454a385b9d9d | JavaScript | jaconsta/sentiment_analysis | /client/src/components/SentimentResults.js | UTF-8 | 1,663 | 2.859375 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import queryString from 'query-string'
import styled from 'styled-components'
import Emoji from './Emoji'
const SentimentsContainer = styled.div`
margin-top: 20px;
display: flex;
flex-direction: column;
border-top: 1px ... | true |
be6e9190a82a8e027824fd63d05a3ab1b01c8587 | JavaScript | MarkExecution/test_execution | /js/requestTask.js | UTF-8 | 461 | 2.78125 | 3 | [] | no_license | export async function requestTask(options) {
const url = window.location.href.slice(0, window.location.href.indexOf('?')) + '/index.php';
let response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.string... | true |
117ceca96ba75be9c38a19746d224b77acd13586 | JavaScript | churchie317/functional-programming | /IO.js | UTF-8 | 759 | 3 | 3 | [] | no_license | var _ = require('ramda');
var IO = function(f) {
this.unsafePerformIO = f;
}
IO.of = function(x) {
return new IO(function() {
return x;
});
}
IO.prototype.map = function(f) {
return new IO(_.compose(f, this.unsafePerformIO));
}
var io_window = new IO(function() {
return window;
});
io_window.map(func... | true |
ba8cef117ade8356b5b61cee5bff5213c6632098 | JavaScript | GaneshEChavan/js-programs | /data_structure/linked_list/double_linked_list.js | UTF-8 | 3,351 | 3.578125 | 4 | [] | no_license | class Node {
constructor(data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
class doubleLL {
constructor() {
this.head = null;
this.tail = null;
}
addNode(val) {
let node = new Node(val);
if (this.head === null) {
thi... | true |
f0fdab708c1c0c7b056519c9e22b3617a3193647 | JavaScript | OksanaZherevko/goit-js-hw-03 | /src/task-3.js | UTF-8 | 1,352 | 3.734375 | 4 | [] | no_license | const findBestEmployee = function (employees) {
'use strict';
// Write code under this line
const values = Object.values(employees);
const max = Math.max(...values);
const entries = Object.entries(employees);
let maxName = "";
for (const entry of entries) {
if (entry[1] === max) {
maxName = entr... | true |
c52850d8ae49f2a8fe4c1bc788355a3b157781ce | JavaScript | Livradoch/bomberman-test-2 | /bomberman/assets/script.js | UTF-8 | 2,513 | 3.4375 | 3 | [] | no_license | let cube = document.getElementById("cube");
let ennemy = document.getElementById("ennemy");
// je veux bouger le cube//
function move(element, direction) {
let top_element = parseInt(
window.getComputedStyle(element).getPropertyValue("top")
);
let left_element = parseInt(
window.... | true |
d42da570ad1603120ae6644a7f9c94cd4ef3b95e | JavaScript | alehRodrigues/ASOS_PHP | /public/js/main.js | UTF-8 | 10,801 | 2.953125 | 3 | [] | no_license | /**
* Autor: Alexandre Rodrigues <btt.ale@gmail.com>
* Description: Responsável pela configuração dos elementos do DOM
*/
/**Função de inicialização do arquivo
*/
function AppConfig() {
MainConfig();
CarregaSidenav();
CarregaMenuMobile();
CarregaTabConfig();
ValidaSenha();
}
/**Função de co... | true |
92e369ad558f0174a7c3c13f5ca4111a7c9a9ca7 | JavaScript | VaclavSir/t9-homework | /backend/suggest.test.js | UTF-8 | 1,240 | 2.8125 | 3 | [] | no_license | const suggest = require('./suggest');
test('Suggest letters for a digit', () => {
expect(suggest('2')).toEqual(['a', 'b', 'c']);
expect(suggest('3')).toEqual(['d', 'e', 'f']);
expect(suggest('4')).toEqual(['g', 'h', 'i']);
expect(suggest('5')).toEqual(['j', 'k', 'l']);
expect(suggest('6')).toEqual(['m', 'n',... | true |
6ca27e45342b0076fa7a876b6f24c5eef42162ad | JavaScript | nmuldavin/js-assessment-answers | /app/async.js | UTF-8 | 870 | 2.640625 | 3 | [] | no_license | exports = (typeof window === 'undefined') ? global : window;
exports.asyncAnswers = {
async(value) {
return new Promise(resolve => {
resolve(value);
});
},
/**
* promisified xhr with data manipulation
*/
manipulateRemoteData(url) {
return new Promise((resolve, reject) => {
const ... | true |
955d474ce2e186979fefa45b318559cc74b07bf4 | JavaScript | javierlopez987/interfaces | /tp1/Practicos/js/testDrawing.js | UTF-8 | 844 | 3.078125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
const HEIGHT = 300;
const WIDTH = 300;
// Creación de lienzo
let canvas = document.querySelector("canvas");
canvas.height = HEIGHT;
canvas.width = WIDTH;
// Obtener contexto del lienzo
let ctx = canvas.getContext("2d");
... | true |
2b965ec6de05f9311cf78e1de0fc5acc0107f200 | JavaScript | TomaszJanusz/js_fun | /literaly_obiektow/index.js | UTF-8 | 502 | 3.484375 | 3 | [] | no_license | /**
* Created by tomaszjanusz on 10/07/2016.
*/
// Rozszerzone literały obiektów
function es5_getUser(id, name, email) {
return { id: id, name: name, email: email }
}
function es6_getUser(id, name, email) {
return { id, name, email }
}
// Mapy
var map = new Map();
var x = { id: 1 },
y = { id: 2 };
... | true |
673f0ed9c8c50f9402a1c5e5ef0493810bcfced2 | JavaScript | avadhuttaru/angular | /P1/js/main.js | UTF-8 | 1,167 | 2.890625 | 3 | [] | no_license | function submituserdata()
{
var inputdata=document.getElementById("textdata").value;
tododata(inputdata);
}
function tododata(todo)
{
var i=0;
//main div
var myDiv = document.getElementById("useroutput");
//dynamic div
var todolist=document.createElement("di... | true |
901da1de3a6a764854d0b98f26b213955ed28021 | JavaScript | ArturStahov/goit-js-hw-06 | /js/task-10.js | UTF-8 | 904 | 2.90625 | 3 | [
"MIT"
] | permissive | "use strict";
import users from "../js/users.js";
const getSortedUniqueSkills = users => {
const sortArray = [...users]
.reduce((acc, someUser) => {
acc.push(...someUser.skills);
return acc;
}, [])
.sort()
.filter(
(someSkillName, index, arr) => arr.indexOf(someSkillName) === index... | true |
fb05817c9049639e9f9eca0205502f0a64abc10d | JavaScript | VigneshPT/gecricketauction | /models/captain.js | UTF-8 | 477 | 2.578125 | 3 | [] | no_license | var mongoose = require("mongoose");
var Schema = mongoose.Schema;
var captainSchema = new Schema({
name: String,
teamName: String,
pointsRemaining:Number
});
//if model is already defined, then creating it again will throw exception.
//so, use model if already created, otherwise, create model.
var Captai... | true |
8136e790940be8761222c92310d119ee1151099b | JavaScript | Tagolfirg/moleculer-antivirus | /test/unit/service/methods/size.spec.js | UTF-8 | 833 | 2.5625 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const {PassThrough} = require("stream");
const method = require("service").methods.size;
describe("Service", () => {
describe("methods", () => {
describe("size", () => {
it("resolves with an object containing the size in bytes", () => {
const stream = fs.createReadStream(__dirname +... | true |
8dd94a48ac4393f7194df0cf76ac7f8e3d2cd4bc | JavaScript | SSD-OSTF/dbiv | /classes/Dice.js | UTF-8 | 605 | 3.375 | 3 | [
"MIT"
] | permissive | //*****************************************************************************
//********************************* D I C E ***********************************
//*****************************************************************************
function Dice() {
this.roll = function() {
return Math.floor((Math.random... | true |
b48c2e37e5d1289f35b68db57d15454a7d6ab1bb | JavaScript | hernanudea/AprendiendoAngularJS | /MiPrimerAngularJS/WebContent/resources/js/cuestionario.js | ISO-8859-2 | 1,794 | 2.71875 | 3 | [] | no_license | var cuestionario = angular.module('cuestionario', []);
cuestionario.controller('contCuestionario', function($scope) {
$scope.respuestasValidas = 0;
$scope.estadoUsuario = ""
$scope.preguntas = [
{
id : 1,
texto : "cual es la capital de colombia?",
respuestaValida : 1,
... | true |
afbc6de387d8f98d77c0ec13649e569ecedb94d8 | JavaScript | rajib26oct/maatr | /src/components/user/userDetail.js | UTF-8 | 373 | 2.59375 | 3 | [] | no_license | import { useState } from 'react';
export default function UserDetails() {
const getUser = () => {
const userString = localStorage.getItem('user');
const userData = JSON.parse(userString);
return userData
};
const saveUser = user => {
localStorage.setItem('user', JSON.stringify(user));
};
re... | true |
30b668a0ea0a223afeb51f2db0def4414b847877 | JavaScript | jemimatheus/T9-jquery | /Aula 2 - Eventos e Efeitos/Exercicios/2_menu/js/script.js | UTF-8 | 801 | 2.734375 | 3 | [] | no_license | $(document).ready(function() {
// $('#botaoAbrir').on('click', function() {
// $('#menulateral').toggleClass('visible');
// });
//1ª resolução
// $("#botaoAbrir").click(function() {
// $("#menulateral").css("display", "block");
// $(".div-botao").css("margin-left", "250px")
//... | true |
08798db11882a10ad391c874f40269f1dc35940c | JavaScript | tysonmcleod/translate-app | /src/utils/API/index.js | UTF-8 | 1,572 | 2.671875 | 3 | [] | no_license | export const isUserInDatabase = async (user) => {
const USER_URL = "https://translate-app-deluxe-db.herokuapp.com/users?name=" + user;
const response = await fetch(USER_URL);
const names = await response.json();
if(names.length === 0){
return false;
}
return true;
}
export con... | true |
05fd5410ed7ffe695d76d409a06cc8b743625f6a | JavaScript | linusnorton/sudoku-solver | /js/gpu.js | UTF-8 | 4,417 | 3.40625 | 3 | [] | no_license |
function create(row) {
const cells = [];
let numAnswered = 0;
for (let i = 1; i < values.length; i++) {
if (values[i] !== 0) {
numAnswered++;
cells.push([values[i]]);
}
else {
cells.push([1, 2, 3, 4, 5, 6, 7, 8, 9]);
}
}
return { id, cells, numRemaining: cells.length - numAn... | true |
8e40e384443cf5ba12f67a91bf8bccccdb4b013c | JavaScript | awarakyun/Indecision-App | /src/utils.js | UTF-8 | 287 | 3.09375 | 3 | [] | no_license |
const square = x => x * x;
export { square };
export const isAdult = x =>
{
if(x>=18)
return true;
else {
return false;
}
}
export const canDrink = x => {
if(x>=21)
return true;
else {
return false;
}
}
const subtract = (a,b) => a-b;
| true |
be20186f86ce4a5ccde5f613ac18cd87d93a7da5 | JavaScript | duff81/typeScript | /diceyBizTs/app.js | UTF-8 | 2,378 | 3.921875 | 4 | [] | no_license | //setting all my global variables here
let buttonNewDie = document.getElementById("newDie");
let buttonReroll = document.getElementById("reroll");
let buttonSumDie = document.getElementById("sumDice");
let resultsDiv = document.getElementById("results");
let diceArr = [];
let btnCount = 0;
// console.log(resultsDiv);
... | true |
639cca02cbe486a9c5ec6e36e9324f019c24dc8a | JavaScript | kaitSith/sample_boid | /assets/js/main.js | UTF-8 | 2,650 | 3.359375 | 3 | [] | no_license | (function(){
window.addEventListener('load', init, false);
// variables
var FPS = 30;
var SCREEN_SIZE = 1000;
var NUM_BOIDS = 100;
var BOID_SIZE = 5;
var MAX_SPEED = 7;
var canvas = document.getElementById('world');
var ctx = canvas.getContext('2d');
var boids = [];
// simulate
var simulate =... | true |
fec2c5d2db243d10d28fcbaf632cc70c16e19ae2 | JavaScript | wedburst/javaScript-drum | /renzo.js | UTF-8 | 290 | 2.71875 | 3 | [] | no_license | var numberOfDrumButtons = document.querySelectorAll(".drum").length;
for (var i = 0; i < numberOfDrumButtons; i++) {
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
var tom1 = new Audio(this.getAttribute("src_audio"));
tom1.play();
});
} | true |
49e9da5f3a77ea34487a366191460debdb522631 | JavaScript | sanjanajain1689/JS-Programming-Constructs | /PalindromeNo.Functions.js | UTF-8 | 658 | 3.765625 | 4 | [] | no_license | function checkPalindrome(num1,num2){
if(num1.toString().length != num2.toString().length) {
console.log(num1 + " and " + num2 + " are NOT Palindromes");
return;
}
let reverseOfNum1 = 0;
let num = num1;
while(num > 0){
let digit = num % 10;
reverseOfNum1 = reverseOfNum... | true |
f9b3d7b12e2fb16d3ee2cf39cdc5c4a9b9b4d42f | JavaScript | DMarinsa/lab-canvas-race-car | /starter_code/script.js | UTF-8 | 2,021 | 3.140625 | 3 | [] | no_license | window.onload = function() {
var greyColor = 'rgb(128, 128, 128)';
var greenColor = 'rgb(0, 129, 0)';
var whiteColor = '#fff';
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var car = new Car(187.5, 500);
var obstacles = [];
document.getElementById("start-button").onclick = funct... | true |
6bba4673477da6794cf41261cb3e29378cc3f1ee | JavaScript | akashmt/designsystem | /src/appsystem/modules/datafilter/FilterForm.js | UTF-8 | 2,336 | 2.859375 | 3 | [] | no_license | import React, { Component } from 'react'
import FilterOptions from './FilterOptions'
import FilterItems from './FilterItems'
export default class FilterForm extends Component {
constructor(props) {
super(props)
this.state = {
data: this.props.data,
bender: '',
nation: '',
person: '',
... | true |
374985a6012643da72cef9f7d8cd1e7453af011e | JavaScript | john-holland/electron-quick-start | /renderer.js | UTF-8 | 1,987 | 2.828125 | 3 | [
"LicenseRef-scancode-public-domain",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // This file is required by the index.html file and will
// be executed in the renderer process for that window.
// No Node.js APIs are available in this process because
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.
let levelScanner = require(... | true |
3c5fd8fcb3b0548a3310b52cca9269183a262f4a | JavaScript | radhamedasani/Vidatech | /Vidatech/app/utilities/__tests__/utilities.test.js | UTF-8 | 886 | 2.59375 | 3 | [] | no_license | import { sortList, formatDate } from '../'
describe('Test Utilites ==>', () => {
it('Test Sorting', () => {
const data = [{
"id": "1",
"name": "Rhett",
}, {
"id": "2",
"name": "Jan",
}, {
"id": "3",
"name": "Langosh",
... | true |
4b2ae25481c84eeb2f496396e836c7fafa4b6672 | JavaScript | project-hexagon/hex | /public/javascripts/game/tile.js | UTF-8 | 2,795 | 3.5 | 4 | [] | no_license | /**
* The formula for a regular hexagon is:
* height = (sqrt(3) / 2) * width
* so, unfortunately, if our choice of hexagon will snap to the pixel grid, we
* cannot have a perfect hexagon. The width and height were chosen such that the
* values are close to the sqrt(3)/2 ratio. The width must also be divisible by... | true |
337ae82fc5a30aa8d23dbe910d5a38b4a426eab5 | JavaScript | daniellespell21/ExtraXPLevel7Part2 | /ExtraXPLevel7SecondpartSpell.appstudio/forms/Form1/Form1.js | UTF-8 | 311 | 3.40625 | 3 | [] | no_license | //making variables
let rows = parseInt(prompt("Enter the number of rows you want to be shown in the output."))
let columns = parseInt(prompt("Enter the number of columns you want shown in the output."))
for (i = 1; i<=rows; i++){
for (j = 1;j<=columns;j++){
document.write("*")
}
document.write("<br />")
} | true |
a81c6864d0c28b1ba7be0bfb7de6645199536d34 | JavaScript | owenroberts/mmp350 | /examples/week2/server.js | UTF-8 | 653 | 2.984375 | 3 | [] | no_license | const http = require('http');
const port = 8000;
let counter = 0;
http.createServer(function(request, response) {
// callback
const path = request.url;
console.log("requested=", path);
response.writeHead(200, {'Content-Type': 'text/html'});
if (path != "/favicon.ico") {
counter = counter + 1;
}
console... | true |
ca2dd2bf7ecedb9800e0ac17b53d281d82089f53 | JavaScript | itaewon-coding-dojo/cs-study | /자료구조/Heap/Woomin-Jeon/heap.test.js | UTF-8 | 1,535 | 3.90625 | 4 | [] | no_license | class Heap {
constructor() {
this.items = [];
}
insert(value) {
this.items.push(value);
this.heapifyByInsert(this.items.length - 1);
}
heapifyByInsert(index) {
const parentIndex = Math.floor((index - 1) / 2);
const childIndex = index;
if (this.items[parentIndex] < this.items[childIn... | true |
7d738543f42d137160958dc70b64e70e64b3f0d9 | JavaScript | AllenTBates/DotNet-Development | /MovieService/Scripts/app.js | UTF-8 | 3,898 | 2.8125 | 3 | [] | no_license | var ViewModel = function () {
var self = this;
self.detail = ko.observable();
self.editView = ko.observable(false);
self.selectedDirector = ko.observable();
self.movies = ko.observableArray();
self.directors = ko.observableArray();
self.error = ko.observable();
var moviesUri = '/api/mo... | true |
5ab60a240423dd0b1c73118d1ed8decf0df780c9 | JavaScript | pyre/flo | /client/hooks/useMouseDown.js | UTF-8 | 1,382 | 3.015625 | 3 | [] | no_license | // external imports
import { useEffect, useState } from 'react'
// local imports
import { useEvent } from '~/hooks'
export default targetElement => {
// State for keeping track of whether mouse is pressed
const [mouseDown, setMouseDown] = useState(null)
// when the mouse is pressed
function downHandle... | true |
d1ac1533396e65c4275abdb35495f1171b37053a | JavaScript | rauscka/AdmissionsApplication | /screens/SignInScreen.js | UTF-8 | 4,404 | 2.765625 | 3 | [] | no_license | //This file is where the sign in screen is built. It includes the functionality for Firebase
//to authenticate the user and navigate to the student or tour guide view of the app depending on the user type.
import React, {useEffect, useState} from 'react'
import {StyleSheet, View, Button, TextInput, Image, Text, Scrol... | true |
f311dfa17e0c91e5a17c2329d470743534a71362 | JavaScript | AshenHermit/webinar-people-scanner | /src/storage.js | UTF-8 | 2,633 | 3.03125 | 3 | [] | no_license | async function getValueFromStorage(key){
return new Promise((resolve, reject)=>{
chrome.storage.local.get(key, (data)=>{
if(key in data){
resolve(data[key])
}
})
})
}
/**
* returns dict of translated keys and values from storage
* @param {Object<string,... | true |
62e59f65a3f7576c865e765a80317e4cac220c1b | JavaScript | hexiaozhen/css3_3D | /js/index3.js | UTF-8 | 1,040 | 2.96875 | 3 | [] | no_license |
var box1 = document.getElementById('box1');
var btn1 = document.getElementById('btn1');
var btn2 = document.getElementById('btn2');
var box = box1.getElementsByTagName('div');
var currPage=6;
btn1.onclick=function(){
if(currPage==1)return;
box[currPage-1].style.transform="rotateX(-90deg)";
currPage--;
box[cur... | true |
89abd032e718fc94e8eb0b6966938242854e5b80 | JavaScript | Ali-X/js-dom | /js/script1.js | UTF-8 | 366 | 2.59375 | 3 | [] | no_license | function getAttributes() {
let element = document.getElementById('w3r');
console.log('href: ' + element.getAttribute('href'));
console.log('hreflang: ' + element.getAttribute('hreflang'));
console.log('rel: ' + element.getAttribute('rel'));
console.log('target: ' + element.getAttribute('target'));
console.l... | true |
3cfcfb6affd2cedc39170e1653de765837874334 | JavaScript | kminkov/hacker-news-react | /js/components/postlist.js | UTF-8 | 1,018 | 2.578125 | 3 | [] | no_license | var React = require('react');
var Post = require('./post.js');
var PostList = React.createClass({
getInitialState: function() {
return {data: []};
},
loadTopPostsFromServer: function() {
$.ajax({
url: 'https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty',
dataType: 'json',
... | true |
43946129ed2c8cf9cdc7623f2b4faa30408d48c9 | JavaScript | Mowriana/JavaScript | /JS-Fundamentals-Exam-11-02/newthree.js | UTF-8 | 956 | 3.28125 | 3 | [] | no_license | function neshto(input) {
let pattern = /<svg>(.*?)<cat>(.*?)<text>(.*?)(\[[A-Za-z0-9]+ - [A-Za-z0-9]+\])(.*?)<\/text>(.*?)<\/cat>(.*?)<\/svg>/g;
let pattern2 = /((<[a-z]+>([0-9])(<\/[a-z]+>)([0-9]+)))/g;
let result = 0;
let count = 0;
let final = result / count;
let match2 = pattern2.exec(inp... | true |
5cacbfaf1e7e0db849ac4bc06e1b34f3ed84edd9 | JavaScript | welintondeveloper/Programacao-Para-Principiantes | /exercicio 16/metodosDeClasse.js | UTF-8 | 1,569 | 4.15625 | 4 | [] | no_license | console.log('exercício 16 Métodos De classe');
class Carro {//classe
constructor(marca, tipo, portas, foiCriado) {//construtor
this.marca = marca;
this.tipo = tipo;
this.portas = portas;
this.foiCriado = foiCriado;
this.ligado = false;
}
//aqui temos a situação seguinte veja que acima o car... | true |
9a3fcd422e41b09ecd893456f5b6f0c8a5da510a | JavaScript | butlariz/react-app | /src/App.js | UTF-8 | 1,822 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import Form from "./Form.js";
import Button from "./Button.js";
import Tracks from "./Tracks.js";
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
isLogged: false
}
this.signUp = this.signUp.bind(this... | true |
fa8e8aec8686636b5f4c3420e593d99ed004a3d7 | JavaScript | luisantos5/monumental | /js/controllers/index.js | UTF-8 | 1,920 | 3.09375 | 3 | [] | no_license | import { mons } from "../models/main.js"
const myCatalog = document.querySelector("#myCatalog")
const btnFilter = document.querySelector("#btnFilter")
btnFilter.addEventListener("click", function(event){
const txtName = document.querySelector("#txtName").value
const sltCountry = document.querySelector("#sltCo... | true |
0d8a9a147773ae2b1c009f476ad3a3a2c9dd4bd7 | JavaScript | kevinyieh/sorting_algo_visualizer | /src/algos/heap_sort.js | UTF-8 | 2,278 | 3.21875 | 3 | [] | no_license | import '@babel/polyfill';
import Sorter from "./sort_base";
export default class HeapSort extends Sorter {
constructor(viz,speed){
super(viz,speed);
}
describe() {
return "Heap sort takes advantage of a tree structure's ability to quickly restructure itself. This heap sort uses a ... | true |
81a2394358b38ba23eb57536e9b8df1e020e9e41 | JavaScript | kumar93shashank-UI/Javascript-Tutorial | /Javascript Notes/Functions/Closures.js | UTF-8 | 6,726 | 4.03125 | 4 | [] | no_license | /*Nested Functions and Closures
The nested (inner) function is private to its containing (outer) function.
It also forms a closure. A closure is an expression (most commonly, a function)
that can have free variables together with an environment that binds those variables
(that "closes" the expression).
To summari... | true |
a05f838406c6316582da1330bbfc57ac725c1287 | JavaScript | Victor-UA/Galaxy_String2IntArray | /WebString2IntArray/scripts/script.js | UTF-8 | 3,159 | 2.984375 | 3 | [
"MIT"
] | permissive | var galaxy;
$(document).ready(function () {
var input1 = document.getElementById('input1');
var form1 = document.getElementById('form1');
var table = document.getElementById('outputTable');
var inputParseSym = document.getElementById('inputParseSym');
var isCode = document.getElementById('isCode')... | true |
46e97d254fbf88f0b889d0f0dc90e8b41126b043 | JavaScript | korsehindi/react-whiteboard | /src/CanvasPane.js | UTF-8 | 2,992 | 2.578125 | 3 | [
"MIT"
] | permissive | // @flow
import React from 'react'
import * as Constants from './Constants'
import type {AnyReducedEventType, ImageDataType, PointDataType} from './EventStore'
import {EventStore} from './EventStore'
type propsType = {
eventStore: EventStore,
width: number,
height: number,
style: {
backgroun... | true |
ce5166826d0ae44eb3f24640f2a471cd55d117ea | JavaScript | stivaliserna/scripts | /javascript30/07-array-cardio/main.js | UTF-8 | 1,205 | 3.671875 | 4 | [
"MIT"
] | permissive | const people = [
{ name: 'wes', year: 1998},
{ name: 'Kait', year: 1986},
{ name: 'Irv', year: 1970},
{ name: 'Lux', year: 2015}
]
const comments = [
{text: 'Love this!', id: 523423},
{text: 'Super good', id: 823423},
{text: 'You are the best', id: 2039842},
{text: 'Ramen is my fav food ever', id: 1235... | true |
e669de9f12101a84d37fec99643fcd7a63cd2548 | JavaScript | narayan-ratawa/react_redux_corona_app | /src/reducer/country.js | UTF-8 | 744 | 2.515625 | 3 | [] | no_license | import {
REQUEST_DATA, RECEIVE_DATA,RECEIVE_CLIST
} from '../constants/index.js';
export default (state = {
isFetching: false,
countryData: null,
countryList:[],
country:""
}, action) => {
switch (action.type) {
case REQUEST_DATA:
return {
...state,
is... | true |
a40805bbac224fa4906b508f8983e6230909dc61 | JavaScript | oieusouobixo/jogo-velha-dio | /script.js | UTF-8 | 3,508 | 3.734375 | 4 | [] | no_license | var selectedPlayer = document.getElementById('selected-player');
var selectedWinner = document.getElementById('selected-winner');
var player, winner = null;
changePlayer('X');
function chooseSquare(id) {
if (winner !== null) {
return;
}
var square = document.getElementById(id);
if (square.te... | true |
dc878143e9cdbf20908154312ecb7e94d3f918e8 | JavaScript | Bryanromerou/ecommerce-frontend-template | /src/Services/Auth.js | UTF-8 | 954 | 2.71875 | 3 | [] | no_license | import axios from 'axios';
const URL = 'http://localhost:4000/api/v1/users'
class AuthModel {
static googleLogin = async(tokenId)=>{
console.log(tokenId)
const {data} = await axios.post(`${URL}/googleLogin`,{tokenId:tokenId})
if(!data) return new Error("Invalid Credentials")
this.saveUserFromLocalSto... | true |
de2f67ad01904c1f20c7afcc66d6f6ec3b55eed0 | JavaScript | elijanaemilyson/IngresoUTN2018 | /8-TPs/jsFerreteIluminacion.js | UTF-8 | 3,197 | 3.28125 | 3 | [
"MIT"
] | permissive | /*4. Para el departamento de iluminación:
Tomando en cuenta que todas las lámparas están en oferta al mismo precio de $35 pesos final.
A. Si compra 6 o más lamparitas bajo consumo tiene un descuento del 50%.
B. Si compra 5 lamparitas bajo consumo marca "ArgentinaLuz" se hace un descuento del 40 % y si es de otra mar... | true |
463e243356552aa99cfe4609bbdb6b80fae58976 | JavaScript | Carlosl93/AngularJS-To-Do-Webapp | /js/controller/task.js | UTF-8 | 1,907 | 2.65625 | 3 | [] | no_license | (function() {
angular
.module('userModule')
.controller('taskCtrl', ['$scope', '$interval', 'dataFactory', TaskController]);
TaskController.$inject = ['dataFactory'];
function TaskController($scope, $interval, dataFactory) {
//Declarations
$scope.dataFactory = dataFactory... | true |
16d2f59548d93047a4b2f4e387af515e2ec64b75 | JavaScript | Tony-devops/codewars | /solution/Extract the domain name from a URL.js | UTF-8 | 556 | 3.5 | 4 | [
"MIT"
] | permissive | // (5kyu) Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example:
// domainName("http://github.com/carbonfive/raygun") == "github"
// domainName("http://www.zombie-bites.com") == "zombie-bites"
// domainName("https://www.cnet.com") == "cnet"
const d... | true |
1ac0ab7424f8e195374d3868d5fb082762f718cf | JavaScript | Apesosmarc/RockPaperScissorsJS | /app.js | UTF-8 | 1,893 | 3.984375 | 4 | [] | no_license | const playerName = prompt("Enter Player Name").toLowerCase();
const gameMode = prompt(
"Would you like to play Single or Best Of Three?"
).toLowerCase();
if (gameMode === "single" || gameMode === "single mode") {
singleMode();
} else {
bestOf();
}
function bestOf() {
let playerWin = 0;
let botWin = 0;
w... | true |
3edb4fad5431dec57e91ccf7057b5b9830d5d1cd | JavaScript | josiahphua/newyork_MTA | /newyork.js | UTF-8 | 8,449 | 3.515625 | 4 | [] | no_license |
// All 3 subway lines intersect at UnionSq
/* Find out the number of stops from point A to point B and in which order.
Meaning indexof() point A and indexof() point B, and the difference between.
Use for loop if coming from back of line. Which also means that idOf(B)- idOf(A) === "positive"
^ to test for positive, can... | true |
c52ad603845acc48ce186ac45f2d47ecda06c445 | JavaScript | Hedzer/JSUI | /Tests/Utilities/Paths/getter.js | UTF-8 | 3,642 | 3.109375 | 3 | [] | no_license | import getter from 'Framework/Utilities/Paths/getter';
export default describe("Framework/Utilities/Paths/getter", function () {
var testProperty = "prop";
var testValue = "value";
it("should get prop from object", function () {
var testObject = {
[testProperty]: testValue
... | true |
d9398b0428d9b65a2fba7c4497e7fbc2f3cf75a0 | JavaScript | RolandoAR29/Codigo03 | /Sem29-30/my-first-app/src/files/exportaciones.js | UTF-8 | 700 | 2.75 | 3 | [] | no_license | // import { artistas } from './data/artistas';
// import artist, { genero } from './data/artistas';
import artistas from '../tests/data/artistas'
// const getArtistaById = (nombre) => {
// return artistas.find( (artista) => {
// if(artista.nombre === nombre){
// return true;
// } else ... | true |
c18eb7d2ea85bc99a03e071243fc2b33eb9d3feb | JavaScript | liriliri/licia | /src/golangify.js | UTF-8 | 1,564 | 3.09375 | 3 | [
"MIT"
] | permissive | /* Handle errors like golang.
*
* |Name |Desc |
* |------|------------------------------------------|
* |fn |Function that returns a Promise |
* |return|Like fn, but resolves with [result, error]|
*
* |Name |Desc |
* |-----... | true |
91088dd48a572f65ae8308d6cc53867d0aa0ff33 | JavaScript | wfparrish/LaunchSchool | /JS100/objects/exercise2.js | UTF-8 | 385 | 3.921875 | 4 | [] | no_license | // Which of the following values are valid keys for an object?
// 1 //no <-- incorrect
// '1' //yes
// undefined //no <-- incorrect
// 'hello world' //yes
// true //no <-- incorrect
// 'true' //yes
// A. They were all vali... | true |
7df0d418eabd3ea70d6765139d26d647018fcdab | JavaScript | Zuoxiaoxian/mabo_eim | /src/assets/eimdoard/3d/js/soldier.js | UTF-8 | 19,634 | 2.53125 | 3 | [
"MIT"
] | permissive |
let THREE = require('three');
let OrbitControls = require('three/examples/jsm/controls/OrbitControls');
let GLTFLoader = require('three/examples/jsm/loaders/GLTFLoader');
let SkeletonUtils = require('three/examples/jsm/utils/SkeletonUtils');
let soldierjs = {
initsoldier(){
initScene();
initRend... | true |
8ed7fbc88371ebbafe8e84c47ca8a4abe0e91591 | JavaScript | dnnstone/ReacDnns | /Reac/src/src/app-dist.js | UTF-8 | 4,607 | 2.6875 | 3 | [] | no_license | 'use strict';
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*ejercicio 1 */
//document.getElementById('app').innerHTML="<h1>Esto no es lo indicado</h1>";
//const e1=document.cr... | true |
308a1d1dc11a3948913d6f5e82681cc1534ef766 | JavaScript | VirgileLyon/Yoshi-save-the-baby | /js/footer.js | UTF-8 | 336 | 2.53125 | 3 | [] | no_license |
function openWin(url){
newwin=window.open(url,'','width=400,height=400,top=200,left=200');
if(newwin){
window.onfocus=function(){newwin.window.close()}
}
}
function merci(){
var elem = document.getElementById('merci')
return window.alert('Yoshi vous remercie et vous enverra vos oeufs au p... | true |
c340e23163d0def834c5e0fbeba3113453417970 | JavaScript | CraigNock/project-module-3-slingair | /public/seat-select/js/admin.js | UTF-8 | 5,312 | 3 | 3 | [] | no_license |
const flightInput = document.getElementById('flight');
const seatsDiv = document.getElementById('seats-section');
const invalid = document.getElementById('invalid');
const seatsTable = document.getElementById('seatsTable');
//data box
const conIdNum = document.getElementById('idNum');
const conFlightNum = document.ge... | true |
e4b18c9d5762a4e8e0fe83cc7568a9f9c204a60e | JavaScript | fredsmit/hello-world | /t67.js | UTF-8 | 2,378 | 2.78125 | 3 | [] | no_license | import { getRequiredHTMLElements, queryRequiredElement, queryRequiredElementByClassSelector } from "./pageUtils.js";
customElements.define('user-card', class extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
const shadowRoot = this.shadowRoot;
if (shadowRoot) {... | true |
989ea69da1e161f135bfa90d7f402e91f51d1621 | JavaScript | TheWarming/leetcodePractice | /485最大连续1的个数.js | UTF-8 | 1,140 | 3.265625 | 3 | [] | no_license | /**
*
* 给定一个二进制数组, 计算其中最大连续1的个数。
示例 1:
输入: [1,1,0,1,1,1]
输出: 3
解释: 开头的两位和最后的三位都是连续1,所以最大连续1的个数是 3.
注意:
输入的数组只包含 0 和1。
输入数组的长度是正整数,且不超过 10,000。
通过次数64,122提交次数112,715
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/max-consecutive-ones
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。} nums
*/
/**
* @param {number[]} nums... | true |
41086078e4c2b072c76347a9ac5176fc8b0e018b | JavaScript | yadlaganesh/Angular-Js | /Directives/Scripts/directives.js | UTF-8 | 5,385 | 2.609375 | 3 | [
"MIT"
] | permissive | /*-----------------Directive01-------------------------*/
var app = angular.module("directivesApp",[]);
app.directive("helloworldelement",function(){
return {
restrict:"E",
template: "<h1>Hello World Element from Directive</h1>"
}
});
app.directive("helloworldattr",function(){
return {
restrict:"A"... | true |
3d383c74296d41e9fbbeedadc6ddd6eebac1983c | JavaScript | RdeHevia/Launch-School | /JS230-Frontend-JavaScript/lesson5/fluid-photo/slideshow.js | UTF-8 | 719 | 3.1875 | 3 | [] | no_license | /*
ALGO:
- EVENT click on a photo:
- remove class "active" of all the photos
- add class "active" to that photo
- read src of the photo
- change src of the main photo
*/
document.addEventListener('DOMContentLoaded', () => {
document.querySelector('.thumbnail ul').addEventListener('click', event => ... | true |
e10aef74aa418f733d18ef383eeebae317f868eb | JavaScript | rohitjsarma/repoOne | /public/uiTechWorks/uiTechNotes/3_May/test/studentDetails.js | UTF-8 | 705 | 2.703125 | 3 | [] | no_license | var studentDetails=[];
function loadStdnDetails() {
$("#stdnContainer").loadTemplate($("#stdnTemplate"), studentDetails, {append:true});
}
function loadDetails() {
$(".loadingBlock").show();
$.ajax({
url: 'http://localhost:8081/getStudentDetails/student',
method: 'GET',
dataType: 'JSON',
success: function... | true |
5a48aada131235e5c4a63d6e36f797eb5a1ca1c7 | JavaScript | apremkumar/algorithms-problem-solving | /0-algorithms/insertionsort/insertionsort.js | UTF-8 | 783 | 3.78125 | 4 | [] | no_license | let input = [9, 3, 5, 1, 4, 3]
function arrayEquals(a, b) {
return a.length === b.length && a.every((e, i) => e === b[i]);
}
function swap(list, firstIndex, secondIndex) {
list[firstIndex] += list[secondIndex];
list[secondIndex] = list[firstIndex] - list[secondIndex];
list[firstIndex] -= list[secondIn... | true |
b91e1d60b81d8fc749bc4c6ea23067b7ec938a2f | JavaScript | dragosbln/aroundy | /src/services/holidays.js | UTF-8 | 1,853 | 2.875 | 3 | [] | no_license | import axios from 'axios'
import holidaysCacheService from './cache/holidaysCache'
import moment from 'moment'
//TODO: get holidays for a 1 year interval
export default class HolidaysService{
static baseUrl = 'https://calendarific.com/api/v2/holidays'
static apiKey = '6898d6d6bfbf09ab189f14360bd95fd94491804b'
... | true |
b117d87b25a57021038b82b81ff6a198c5a8462e | JavaScript | Potentii/w-srvr | /libs/booting/api.js | UTF-8 | 3,489 | 2.984375 | 3 | [
"MIT"
] | permissive | // *Getting the needed dependencies:
const middlewares_util = require('../utils/middlewares');
const APIResource = require('../types/api-resource');
const headers_util = require('../utils/headers');
const { METHODS } = require('../utils/methods');
/**
* Builds a new API resource for handling CORS preflight flow
* ... | true |
9b496be95cb3ab11f57712d87494a51c4c57f6c0 | JavaScript | ivanapostolov/EKATTE-Backend | /routes/api.js | UTF-8 | 4,267 | 2.671875 | 3 | [] | no_license | const EKATTEDatabase = require('../database-tools/EKATTEDatabase');
const express = require('express');
const router = express.Router();
//Utility functions
const handleDBResponse = (promise, response) => {
promise.then(res => {
response.status(200).json({ result: res.rows });
}).catch(err => {
... | true |
1715cc36c70701099445b88e39ec7edb09fc82b7 | JavaScript | youssefnagdy/ecmaScript | /Classes.js | UTF-8 | 1,650 | 4.09375 | 4 | [] | no_license | /**
* Created by YoussefNagdy on 7/22/2020.
*/
/*
syntactic sugar of the way we do prototype and inheritance in js
classes simply make it easier implement inheritance
and create objects based on blueprints
so in es5 these blueprints are called function constructor
and we added method to their prototype propert... | true |
fccaeb7fedaa0c7ab4dee1090723b5628ccd7760 | JavaScript | SaraHasan224/laravel-chatapp | /public/assets/scripts/login.js | UTF-8 | 232 | 2.59375 | 3 | [
"MIT"
] | permissive |
//GET LOGIN USER TIME ZONE
if (document.body.contains(document.getElementById("user_timezone"))){
var timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
document.getElementById("user_timezone").value = timezone;
} | true |
c873190c9fcc40212aa1fb9f68ef57936e7e9fd0 | JavaScript | nfmastroianni/tomtool2 | /analyze.js | UTF-8 | 25,652 | 3.015625 | 3 | [
"MIT"
] | permissive | function createSheet(title, index) {
const ss = SpreadsheetApp.getActive();
const sheet = ss.insertSheet(title, index).getSheetId();
const ssInfo = {
ssheet: ss,
sheet: sheet,
};
return ssInfo;
}
/**
* Takes a positive integer and returns the corresponding column name.
* @param {number} num The po... | true |
913aa6a617b3385b3bb585bd29e43d25b504c2f1 | JavaScript | minimicrowave/TennisGame | /test/TennisGame.spec.js | UTF-8 | 4,618 | 3.0625 | 3 | [] | no_license | const { expect } = require('chai');
const TennisGame = require('../src/TennisGame');
describe('TennisGame', () => {
describe('.tally()', () => {
describe('error catching', () => {
it('Should throw TypeError if score is not a number', () => {
expect(() => new TennisGame('a', 'b')).to.throw(`Score "a" is not a... | true |
f73dfe9d5090ae0c8196337665daa669d88dbce1 | JavaScript | seattle-area-tolls/seattle-area-tolls.github.io | /src/App.js | UTF-8 | 1,022 | 2.6875 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
import {getText} from './costText';
import Div100vh from 'react-div-100vh'
import './App.css';
function Road({name}) {
const [text, setText] = useState("");
useEffect(() => {
async function fetchData() {
setText(await getText(name))
}
let interva... | true |
6bd623dfd7db2aace07a91f1cb40dbffb70c3787 | JavaScript | aldenkeshap/aldenkeshap.github.io | /Chacma/demo/programs.js | UTF-8 | 743 | 3.734375 | 4 | [] | no_license | const hello = `print('Hello, world!')`;
const square = `func square(n: Int64) -> Int64:
return n * n
print(square(9))`;
const ack = `func ack(m: Int64, n: Int64) -> Int64:
if m == 0:
return n + 1
elseif n == 0:
return ack(m - 1, 1)
else:
return ack(m - 1, ack(m, n - 1))
print... | true |
7cec0bfa04332fa947e880d48bd34ab4775335a4 | JavaScript | calumlim/personalwebsite | /oldideas/script/welcomepage.js | UTF-8 | 3,781 | 3.09375 | 3 | [] | no_license | //Get input
var input = document.getElementById("nameBox");
var username = {};
if (localStorage.clickcount>0) {
document.getElementById("welcomeVideo").style.visibility = "hidden";
document.getElementById("welcomeText").style.visibility = "hidden";
document.getElementById("enterName").style.visibility = "hidden";... | true |
9bb02099fe1f319a6149ec80f74e0246257eaac0 | JavaScript | posty72/volition | /www/js/window.js | UTF-8 | 339 | 2.8125 | 3 | [] | no_license | window.onload = function () {
var windowSize = document.width;
var container = document.getElementById("content");
container.style.width = windowSize + "px";
};
window.onresize = function () {
var windowSize = document.width;
var container = document.getElementById("content");
container.style.width = win... | true |
8bc56c415e925392daf6d8b54bdf761d4ddf2f75 | JavaScript | conerton/dogfight | /src/components/hotDogs/HotDogForm.js | UTF-8 | 2,042 | 2.71875 | 3 | [] | no_license | import React, { useContext, useEffect, useState, useRef } from "react";
import { HotDogContext } from "./HotDogDataProvider";
import "./HotDog.css";
export const HotDogForm = (props) => {
const { getHotDogById, addHotDog } = useContext(HotDogContext);
const [hotDog, setHotDog] = useState({});
const hotDogNote =... | true |
0813fe59e18ef6f352dc4f4db75b59e1b7b9ebb9 | JavaScript | Koulinski/JS-SoftUni | /Fundamentals/EXAM PRP/Exam 3.js | UTF-8 | 839 | 3.65625 | 4 | [] | no_license | function breakStuff(arr, start, value) {
let numsToWork = arr;
//console.log(numsToWork);
let index = arr[start];
//console.log(index);
let left = arr.splice(0, start);
let right = arr.splice(1, arr.length - 1);
if (value === 'cheap') {
left = left.filter(x => x < index);
ri... | true |
2d66b5c3d99ecc777dc362e2a55b55a527d5b602 | JavaScript | AlessioMurgia/AvalancheBurnedFee | /functions/aggregation.js | UTF-8 | 4,260 | 2.515625 | 3 | [] | no_license | const { MongoClient } = require('mongodb')
const connectionString = require('../connection-string')
const redisManager = require('./redis-manager')
const client = new MongoClient(connectionString.uri, { useNewUrlParser: true, useUnifiedTopology: true })
// wrapper for setInterval function
function setInterval_ (fn, d... | true |
bfb4fbd836cad02f46f7f056fc61e89a04eccd56 | JavaScript | ram5550/Javascript | /forloop/nestedloop.js | UTF-8 | 156 | 3.3125 | 3 | [] | no_license | var num=Number(prompt("enter a number"))
for (let i=0;i<=num;i++){
for(let j=0;j<=i;j++){
console.log(j,end="")
}
console.log()
} | true |
ce96f42d1650d4a68964627e32e58206034b0443 | JavaScript | YotamZiv298/blackjack-app | /client/src/components/clientGameLogic.js | UTF-8 | 789 | 3 | 3 | [] | no_license | // Be in client (server) (get chips from server)
// const placeBet = (amount) => {
// console.log("entered: placeBet");
// setBet(amount);
// setBalance(Math.round((balance - amount) * 100) / 100);
// setGameState(GameState.INIT);
// };
// Be in client (Logic)
// const checkWin = () => {
// consol... | true |
c546c8d3d3cd0993e0e7a30896ccaf5a1a1d9d7f | JavaScript | brianephraim/monorepo | /packages/study/src/breadth-depth.js | UTF-8 | 761 | 3.34375 | 3 | [] | no_license | var o = {
v:1,
l:{
v:2,
l:{
v:4
},
r:{
v:5
}
},
r:{
v:3,
l:{
v:6
},
r:{
v:7
}
}
};
console.log(o);
var queue = [];
var recurse = function(n){
console.log(n.v);
if(n.l){
queue.push(n.l);
}
if(n.r){
queue.push(n.r);
}
while(queue.length){
var a = queue[0];
queue.shift... | true |
c2588cb038b981b4b4a385c9ec3ae5255f5ad13b | JavaScript | felishaww/recursive-triangle | /script.js | UTF-8 | 366 | 4.03125 | 4 | [] | no_license | function stars(x){
if (x===1){
return '*'
}
else {
return '*' + stars(x-1)
}
}
function recursiveTriangle(n) {
// your code here
if (n == 1){
console.log('*')
}
else {
console.log( stars(n))
recursiveTriangle (n-1)
}
}
// test case
recursiveTriangle(5)
// *****
// ****
// ***
// *... | true |
050092be0a1b1518c12b4313645803c27e080e6a | JavaScript | daaisymoon/homework4 | /homework_4.js | UTF-8 | 2,563 | 3.71875 | 4 | [] | no_license | //2
const computeStr = function (num) {
let str = '';
while (num > 0) {
num = num -1;
str = str + '*'
};
return str;
};
const computeSpace = function (num) {
let spc = '';
while (num > 0 ){
num = num - 1
spc = spc + ' '
};
return spc;
};
const triangleStars = function (h) {
let sp... | true |
84febd2bd67e17cf169766d7c8ad90ad7d18832c | JavaScript | hehuaguo90/pioneer | /pioneer/src/main/webapp/res1/sys/main/validator.js | UTF-8 | 6,141 | 2.84375 | 3 | [] | no_license | var myreg = {
mobilePhone: /^(13([0-9])|15([0-9])|18([0-9]))\d{8}$/,//手机
phone: /^((\(0\d{2,3}\))|(0\d{2,3}\-))?[1-9]\d{6,7}$/,//座机
email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
money : /^\-?[0-9]{1,8}(?:\.[0-9]{1,2})?$/,//整数或负数金额
zsmoney : /^[0-9]{1,8}(?:\.[0-9])?$/,//整数金额
zmoney : /^\d{1,8}(?:\.... | true |
a1eba9234f262be4ba0099dd424456c5441331ff | JavaScript | ngochoanit/Todo-List-reactjs | /src/components/Header.js | UTF-8 | 805 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Header extends Component {
constructor(props) {
super(props);
this.inputEle=React.createRef();
}
//
componentDidMount(){
this.inputEle.current.focus();
}
render(){
const {newIte... | true |
b1585aa800fcd252792db14421dbea1208d247bd | JavaScript | federicocipriani/fcc-pomodoreact-clock | /src/App.js | UTF-8 | 6,028 | 2.625 | 3 | [] | no_license | import React from 'react';
import './App.css';
import Break from './components/Break';
import Session from './components/Session';
import Timer from './components/Timer';
import StartStopBtn from './components/buttons/StartStopBtn';
import ResetBtn from './components/buttons/ResetBtn';
class App extends React.Componen... | true |
528dba00323b491dbc73cb5781997ef15b92c6f3 | JavaScript | navio/Directed-Survey-JS | /core.js | UTF-8 | 1,351 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | function verifier(answers,quetion_prefix,fn) {
var text = [];
var cleanAnswers = cleanArray(answers);
function vq(selections,questions,validator,response){
var answers = getAnswers();
if(response !== null && typeof response === 'object'){
var redirect = function(link){ window.location.href = link};
re... | true |
13be46aab383ba3bb5c4ac3dba8474349a52f585 | JavaScript | Bunnyster43/Flashcard-Generator | /BasicCard.js | UTF-8 | 1,202 | 3.8125 | 4 | [] | no_license | var inquirer = require("inquirer");
var cards = []
var cardCount = 0
function BasicCard(front, back) {
this.front = front
this.back = back
}
var card1 = new BasicCard("Who was the first president of the United States?", "george washington");
var card2 = new BasicCard("What was the first president to get assassinate... | true |
d6b57ba6a48f94585be63de0bcb5de409cb8acea | JavaScript | humantautology/comit | /js/index3.js | UTF-8 | 162 | 2.546875 | 3 | [] | no_license | var firstName, lastName, age, address, dateOfBirth;
firstName = 'Dipo'
lastName = 'Daramola'
age = 27
dateOfBirth = '01/24/1992'
address = '51 southbridge drive' | true |
d9242af196e1cdf0fd3de344cd05eb344c2ee20a | JavaScript | moabe/meetingPlanner | /js/controllers/addDayViewController.js | UTF-8 | 407 | 2.828125 | 3 | [] | no_license | //Creates a new day each time the add day-button is clicked
var AddDayViewController = function(view, model) {
view.addButton.click(function(){
var nextDay = model.days.length;
model.addDay();
window.viewsMap["day"+nextDay] = new DayView($("#dayView"), model, nextDay);
window.controllersMap["day"+nextDay] ... | true |
bbb80d20c17431c4890898de87b7fd4765d5fe03 | JavaScript | debasispanda/backbonejs | /routing/views/view.js | UTF-8 | 2,063 | 2.5625 | 3 | [] | no_license | var EventView = Backbone.View.extend({
initialize: function(){
//this.render();
},
render: function() {
//var data = this.model;
var content = this.model;
var self = this;
$.get(self.templateUrl , function (data) {
var template = Handlebars.compile(data);
var html = template({events : content});
... | true |
54aace70c97454b0ddbc23fd659c0817af2014b5 | JavaScript | cs-fullstack-2020-spring/200324-react-routes-ic-autumn-ragland | /ic-app/src/components/DeveloperQuotes.jsx | UTF-8 | 1,271 | 2.921875 | 3 | [] | no_license | import React, { Component } from 'react'
import { Fragment } from 'react';
class DeveloperQuotes extends Component {
constructor(props) {
super(props);
// set initial state
this.state = {
quoteList: [], // array to store data from fetch
}
}
// lifecycle method to ... | true |