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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
82cb4d8d7b53608d512a763309dd05428673e615 | JavaScript | makevertti/full-stack-open-2018 | /osa1/1.12-1.14/src/index.js | UTF-8 | 2,336 | 3.109375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
selected: 0,
votes: [0, 0, 0, 0, 0, 0],
mostVoted: 0
}
}
nextAnecdote = () => {
return () => {
this.setS... | true |
565eb5a8832d1bc0221a4abbcc7898cf99e7a0b4 | JavaScript | mokhlaroyim/JavaScript-tutorials | /FuncProg/filter_tru_prototype.js | UTF-8 | 512 | 3.921875 | 4 | [] | no_license | // The global variable
var s = [23, 65, 98, 5];
Array.prototype.myFilter = function(callback){
// Only change code below this line
var newArray = [];
var arr = [];
var bool = true
for(let x=0; x<this.length; x++){
arr.push(callback(this[x], x, this))
bool = arr[x]
if(bool == true){
newArray... | true |
6fbe691778430bd095759c5a1c64f6776b0eb0bd | JavaScript | lukebrdn/mines-app | /public/javascripts/controllers/GameController.js | UTF-8 | 3,128 | 3.109375 | 3 | [] | no_license | function GameController () {
// start game
this.start();
}
GameController.prototype.start = function () {
// set event system
events = new Events();
// set up controls
controls = new ControlsController();
var gridContainer = document.getElementsByClassName('js-grid-container')[0];
// build grid
this.grid ... | true |
f27287967edf53e957875c8d8d5369749ff09cbf | JavaScript | cartermagee/google-trends-visualizer-clone | /src/components/GridChooser.js | UTF-8 | 1,501 | 2.625 | 3 | [] | no_license | import React, {Component} from 'react';
import Square from './Square';
import PropTypes from 'prop-types';
class GridChooser extends Component {
constructor(props) {
super(props)
this.state = {
hover: false
}
}
renderSquares(){
const { setGrid } = this.props;
... | true |
d16bafaee48e287c97ce046018ca1c6eb25ead2e | JavaScript | IkayAdebi/Team09_Repo | /Assets/Standard Assets/FloorController.js | UTF-8 | 4,240 | 2.53125 | 3 | [] | no_license | #pragma strict
import Phidgets;
var instructions : GUIText;
private var motionFloor : Analog;
//23
//01
function Start () {
motionFloor = new Analog();
motionFloor.open();
motionFloor.waitForAttachment(1000);
// instructions.text = " Up Arrow = Front Up \n Down Arrow = Back Up \n Left Arrow = Left Up ... | true |
9e5bfe2da6b7116454b5e165fdb7bb47240fac10 | JavaScript | KatWakahisa/Discord-bot | /commands/kiss.js | UTF-8 | 1,137 | 2.75 | 3 | [] | no_license | const Discord = require('discord.js');
module.exports= {
name: 'kiss',
description: 'kiss someone',
usage: '>kiss @user',
execute(message, args) {
var kissgif= [
'https://media.giphy.com/media/bGm9FuBCGg4SY/giphy.gif',
'https://media.giphy.com/media/KmeIYo9IGBoGY/giphy.gif',
... | true |
fb49aba884eaa4d56d2d87326e9b4f685f8cacdb | JavaScript | nwilcox11/general-practice-learning | /training/sorting/insertionSort.js | UTF-8 | 1,160 | 4.15625 | 4 | [] | no_license | const assert = require('assert');
/**
* O(n^2) Quadratic running time
*
* Sorts in place, by maintaining a sorted sublist starting at index 0
* First loop iterates over every element
* Second element will loop through currently sorted list to find place for key,
* second loop will iterate as long as key is less ... | true |
652ed77e3f07a64db979b3b62c63a658e5b831c6 | JavaScript | nickvandewiele/Burcat-viz | /js/scatterplot.js | UTF-8 | 3,200 | 3.078125 | 3 | [
"MIT"
] | permissive | function createScatterPlot(dataset) {
//Width and height
var w = 1000;
var h = 500;
var padding = 30;
var xScale = d3.scale.linear().domain([d3.min(dataset, function(d) {
var hf_entry = select_hf298_1(d);
return parse(hf_entry)[0];
}), d3.max(dataset, function(d) {
var hf_entry = select_hf298_1(d);
retu... | true |
382b47856bfb01317129a3e0b78006664dee2ba5 | JavaScript | Fybro/fengyun.cc | /webapp/common/store/middlewares/promiseMiddleware.js | UTF-8 | 1,028 | 2.5625 | 3 | [
"MIT"
] | permissive | function isPromise(val) {
return val && typeof val.then === 'function'
}
export default function promiseMiddleware({ dispatch, getState }) {
return next => (action) => {
const { promise, types, ...rest } = action
if (!promise) {
return next(action)
}
const [REQUEST, SUCCESS, FAILURE] = types... | true |
0cb4bded37af2f4d393d465605513a6cd79ec4a0 | JavaScript | jaab30/extract-xml | /server.js | UTF-8 | 4,161 | 2.703125 | 3 | [] | no_license | const util = require('util');
const decompress = require('decompress');
const decompressTargz = require('decompress-targz');
const csv = require('csvtojson');
// This example will extract the files from the LSR tar.gz file
// and save inside a folder called "/assets/extracted"
const extractTar = async () => {
try... | true |
6907e16d423e26db737cbbc4e0bf97a1941e979f | JavaScript | ysxhd/100-days-webgl-challenge | /src/01-hello-webgl/index.js | UTF-8 | 5,504 | 2.9375 | 3 | [] | no_license | import "reset.css";
import "../styles/index.css";
// https://webglfundamentals.org/webgl/lessons/zh_cn/webgl-fundamentals.html
// 创建着色器方法,参数:渲染上下文,类型,数据源
function createShader(gl, type, source) {
// 创建着色器对象
const shader = gl.createShader(type);
// 提供数据源
gl.shaderSource(shader, source);
// 编译生成着色器
gl.compil... | true |
138e1087c5a28cb184b118f286f7b45267e90b0b | JavaScript | mschultz4/practice | /answers/greatestCommonDivisor.js | UTF-8 | 1,513 | 3.78125 | 4 | [
"MIT"
] | permissive | /**
* Assumptions
* 1. Divisor includes self
* 2. Positive integers only
*/
"use strict";
var test = require('tape');
/**
* find the greatest common divisor between two numbers
* @param {number} first number
* @param {number} second number
* @returns {number} the commond divisor
*/
function ... | true |
2aced8684d5a6b6268fbffcc66c132f94060c0ce | JavaScript | jondcoleman/game-of-life | /js/app.js | UTF-8 | 4,673 | 3.296875 | 3 | [] | no_license | function createBoard(rows, cols, clear){
var board = []
for (var i = 0; i < rows; i++){
board.push([])
}
board.forEach(function(row, index){
for (var i = 0; i < cols; i++){
if (clear) {
var isLiving = false
} else {
var isLiving = randomTrueOrFalse()
}
row.push({l... | true |
93bac6f9259704f0aa730a471655b62f0992c716 | JavaScript | rohitbrai/pintura | /lib/media/csv.js | UTF-8 | 1,157 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Registers CSV media type handling
*/
var Media = require("../media").Media,
forEachableToString = require("../media").forEachableToString;
Media({
mediaType:"text/csv",
getQuality: function(object){
return 0.4;
},
serialize: function(object, request, response){
return {
forEach: function(write){
... | true |
f31d032f2aca18a7749c195ec7f40ca38ae4489d | JavaScript | kilicmustafa/Java-Script | /FilmProject copy/ui.js | UTF-8 | 1,245 | 3.09375 | 3 | [] | no_license | class UI{
static addFilmToUI(FilmInfo){
const filmList = document.getElementById("films");
filmList.innerHTML += `<tr>
<td><img src="${FilmInfo.url}" class="img-fluid img-thumbnail"></td>
<td>${FilmInfo.title}</td>
<td>${FilmInfo.director}</td>
<td><a href="#" id ... | true |
91283b7d3db31ceaa127592b757de7a3375caec9 | JavaScript | cikay/Tamerlane-Chess | /src/auth/VerifyEmail.js | UTF-8 | 1,192 | 2.640625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import { withRouter } from 'react-router-dom'
import queryString from 'query-string'
import axios from 'axios'
const EmailVerify = ({ history }) => {
const initialState = {
default: 'default',
verified: 'verified',
failed: 'failed',
}
const [emailSt... | true |
afdfe63629ef14a7005f52378ce0c9ba32c1c88c | JavaScript | mauriciomartinss/exercicios-gabrieldarezzo-helpjs-ravi-resolvidos-e-nao-resolvidos | /resolvidos/ex32/js/script.js | UTF-8 | 745 | 3.4375 | 3 | [] | no_license | let find = document.querySelector('#find')
find.addEventListener('click', () => {
let frase = 'LoL é melhor que Dota'
if (frase.indexOf('Dota') == -1) {
return window.alert('falso')
}
else {
return window.alert('verdadeiro ')
}
})
let find1 = document.querySelector('#find1')
find1... | true |
7e4b5e44904753689723c7421ca0e2bf26dad7b8 | JavaScript | CassioRubens-CR/projects-developed-in-trybe | /Projects_Back_End/sd-06-mongodb-commerce/challenges/desafio18.js | UTF-8 | 581 | 3.0625 | 3 | [] | no_license | // Desafio 18
// Conte quantos documentos contêm a expressão feito com utilizando o operador $text.
// Para isso, escreva no arquivo desafio18.js duas queries, nesta ordem:
// Crie uma query que faça a criação de um índice do tipo text
// no campo descricao com o idioma padrão portuguese.
// Crie uma query que retorne ... | true |
731e886c239d2861bac1b1a4c8b3af5c5e902680 | JavaScript | clasesucatmarlon/DOM-JS-Udemy-15proy | /10-Estructuras/js/02-app.js | UTF-8 | 458 | 4.21875 | 4 | [] | no_license | // Veamos otras comparaciones
// No es igual
if(puntaje != 1000) {
console.log("Si! es diferente!");
} else {
console.log("No, no es diferente");
}
// comparador estricto de tipo y valor
if(puntaje === 1000) {
console.log("Si es igual!");
} else {
console.log("No no es igual");
}
// comparador estri... | true |
d94c8b86b3bf5e4933980d66f0c7d3607b4fc300 | JavaScript | corbin-r/proxymity | /src/proxymity-ui.js | UTF-8 | 16,983 | 2.546875 | 3 | [
"MIT"
] | permissive | function evalAndReplaceExpessionQueue(originalText, sourceEle, evalQueue){
forEach(evalQueue, function(queuedItem){
originalText = originalText.replace(queuedItem.drop, function(){
try {
return safeEval.call(sourceEle, queuedItem.run)
}
catch(o3o){
console.error("failed to render expression [" + que... | true |
fafe1686031725e05f3289617f0d24dbeb385271 | JavaScript | cptran777/syruptale | /client/scripts/hud.js | UTF-8 | 1,972 | 3.453125 | 3 | [] | no_license | class HUD {
constructor(image, health) {
this.image = image;
this.health = health;
this.portrait;
// The full health bar is supposed to remain static while the current health bar acts as
// an overlay of sorts and decreases in size when the player is hit, therefore giving
// the appearance that a single ... | true |
e07c4353d70e1391e58265432f7670d43b620700 | JavaScript | The-Coding-Network/Safeguarding | /utils/image.js | UTF-8 | 3,722 | 2.625 | 3 | [] | no_license | const axios = require('axios')
require('dotenv').config()
module.exports = (client, Discord) => {
console.log("Image module has loaded")
let badcontent = ``
client.on('message', (message) => {
if (message.author.bot) return;
if (!message.guild) {
return;
}
let b... | true |
f7c2eea3951dfcf865859d9aee0dfdd1cce2a735 | JavaScript | rojinaAmatya/ProjectEuler | /problem3.js | UTF-8 | 474 | 4.46875 | 4 | [] | no_license | /* The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ? */
let factor = 2;
function largestPrime(num){
while(num != factor){
if(num % factor === 0){
num = num / factor;
//console.log(num);
}
else{
... | true |
5d3d591fe3ef61328797d102b8e695a0caf32be4 | JavaScript | echernenko/sfmuni-transport-challenge | /js/transport.js | UTF-8 | 5,835 | 2.546875 | 3 | [] | no_license | /**
* Transport module
* It is responsible for fetch of the map layers and vehicle locations on the
* map. Passes information to ui.js module for rendering and is feeded by some
* configuration from config.js. Implements localStorage caching if available.
*/
import {
mapLayers,
mapLayerVehicles,
mapLayerSca... | true |
a271d203be1150c89bf820b5777d45b3981065b1 | JavaScript | iaucab/ia-dino | /js/enemies.js | UTF-8 | 1,275 | 3.203125 | 3 | [] | no_license | class Cactus
{
constructor()
{
this.x=WIDTH;
this.y=PLAYERY-10;
this.w=CACTUS_WIDTH;
this.h=CACTUS_HEIGHT;
this.image=BCAC1;
}
draw()
{
ImageLoader.drawImage(this.image,this.x,this.y,this.w,this.h);
}
move(delta)
{
this.x-=delta;
... | true |
0b88d143e5c9ed8c4322827c51e85e934175d22d | JavaScript | barneycarroll/emjay | /index.js | UTF-8 | 2,012 | 2.984375 | 3 | [
"MIT"
] | permissive | var pugLexer = require( 'pug-lexer' )
var pugParser = require( 'pug-parser' )
var html = require( 'common-tags' ).html
function attrs_to_hash( attrs, transformer ){
var hash = {}
for( var i = 0; i < attrs.length; i++ )
hash[ transformer( attrs[i].name ) ] = transformer( attrs[i].val )
return hash
}
... | true |
6d99702d8b29992d988e64d21b0a24a5022d822d | JavaScript | maynarddemmon/myt | /src/js/myt/extra/DrawButton.js | UTF-8 | 3,360 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /** An myt.Button that makes use of an myt.DrawingMethod to display itself.
Events:
None
Attributes:
drawingMethodClassname:string the name of the class to draw with.
drawingMethod:myt.DrawingMethod the instance to draw with. Obtained
by resolving the drawin... | true |
66da3bc24a350fc31f2d8c092a3ee8fbc1ff9dec | JavaScript | aginert/tic-tac-toe-React | /src/square.js | UTF-8 | 360 | 2.515625 | 3 | [] | no_license | import React from 'react';
function Square(props) {
return (
<button className="square" onClick={props.onClick}>
{props.value}
</button>
);
}
//Ejemplo de componente de funcion, una forma más simple
//de escribir componentes que solo contienen un método render
//y no tienen estado... | true |
445f590ddd58995e6ead5e9daecc5a9ea7ccdb34 | JavaScript | EricksonSiqueira/JS-basico-ao-avancado-Udemy | /3-Funções(avançado)/Treino/funcao/funcao-8(soma-impares).js | UTF-8 | 229 | 3.546875 | 4 | [
"MIT"
] | permissive | // Calcular a soma dos números impares maiores que 10 e menores que 30
function somaImpares10A30(){
let soma = 0
for(let i = 11;i <= 30;i += 2){
soma += i
}
return soma
}
console.log(somaImpares10A30())
| true |
442220037e397cd5580cfecc5c3a3e2eca47014b | JavaScript | haikyuu/audio-player | /src/db/index.js | UTF-8 | 496 | 2.578125 | 3 | [] | no_license | let SONGS
// put export in top of the file so that
// it's easier to peek at the file and see its contents
module.exports = { loadDb, getAllSongs, getSongById, getSongFile }
// run at startup and during tests
function loadDb(data) {
SONGS = data
}
function getAllSongs() {
return SONGS.ids.map(id => SONGS.data... | true |
b0b35a15f3aaa957dfdb6189153516b76083c962 | JavaScript | carlpeaslee/es2016-demo | /lessons/09_template_literals/code.js | UTF-8 | 381 | 3.78125 | 4 | [] | no_license | /* Template Literals*/
let exclamation = 'yowza'
let noun = 'jumbo jet'
//the template literal allows us to easily
//insert variables into a string
const madlibs = `"Oh ${exclamation}!" they said.
"I've never seen a ${noun} before!" `
console.log('madlibs = ', madlibs)
/*
madlibs = '"Oh yowza!"... | true |
bc959b5e0096c7530a94eabb144fed97c6a986d0 | JavaScript | julieg18/project-euler-challenge | /solutions.js | UTF-8 | 2,810 | 3.921875 | 4 | [] | no_license | const thousandDigits = require('./thousand-digits.js');
// problem 1
function multiplesOf3And5(num) {
const multiples = [];
for (let i = 1; i < num; i += 1) {
if (i % 3 === 0 || i % 5 === 0) {
multiples.push(i);
}
}
return multiples.reduce((maxNum, num2) => maxNum + num2);
}
// problem 2
functio... | true |
0195a3620ea51c5ac84710ea9574815e106f2028 | JavaScript | jon-j-warren/leetcode-challenges | /challenges/complete/#0019 - Remove Nth Node From End of List/solution.test.js | UTF-8 | 499 | 2.671875 | 3 | [] | no_license | const { removeNthFromEnd, ListNode } = require('./solution');
describe("Remove Nth Node From End of List", () => {
// Example 1
test("it should pass Example 1", () => {
const input = [
new ListNode(1, new ListNode(2, new ListNode(3, new ListNode(4, new ListNode(5))))),
2
... | true |
0305398ccb143da9e4925bdeadda9888d1ca8790 | JavaScript | karlbennett/scratch-frontend-examples | /scratch-frontend-examples-html-js/src/test/javascript/usernameHandlerFactory_spec.js | UTF-8 | 941 | 2.578125 | 3 | [] | no_license | describe('Handle the username HTTP response', function () {
it('Can create a username handler', function () {
var usernameReplacer = mockFunction();
var response = mock(Response);
var username = 'some user name';
var body = new function () {
};
// Given
when(response).body().thenReturn... | true |
b26c3d38cafd98ab47220c7570c606293a3e5635 | JavaScript | eGospodine/JS_BASIC | /Week_5/Lab/04. Walking.js | UTF-8 | 602 | 3.421875 | 3 | [] | no_license | function solve(input) {
let aim = 10000;
let steps = 0;
let diff = 0;
while (steps <= 10000) {
let command = input.shift();
if (command == "Going home") {
steps += +input.shift();
if (steps < aim) {
diff = aim - steps;
console.l... | true |
6ab38e2ff5433a15e58a41b2b5d60931aa192dc3 | JavaScript | BuchHolzing/Zend-2master | /public/js/form/add.form.js | UTF-8 | 1,177 | 2.671875 | 3 | [] | no_license | $(document).ready(function()
{
$('#add_form_text').live("click", function(e){
e.preventDefault();
var formId = $('#add_form_data');
addForm(formId, 'input', 'form_input');
});
$('#add_form_paragraph').live("click", function(e){
e.preventDefault();
var formId = $('#add_form_data');
addForm(formId,... | true |
0da2c6bff3bb8fbad4a565996bf4be165a608a5a | JavaScript | caescass/exercices_javascript | /Ajax/ex02/assets/js/main.js | UTF-8 | 879 | 3.09375 | 3 | [] | no_license |
function requete(fichier){
let demo = document.getElementById("demo");
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
console.log(this);
if(this.readyState == 4 && this.status == 200){
demo.innerHTML = this.responseText;
... | true |
a4c715312175a39412c6210d01d8ebb0322b4d38 | JavaScript | qf-jonathan/competitive-programming | /toptal-speedcoding/2021/multiplier-count.js | UTF-8 | 409 | 4.125 | 4 | [] | no_license | /*
Given x and y are numbers,
how many times can you multiply y and keep it lower than or equal to x?
*/
multiplierCount = (x, y) => {
return Math.floor(x / y);
};
console.assert(multiplierCount(134, 2) === 67);
console.assert(multiplierCount(1, 3) === 0);
console.assert(multiplierCount(123, 12) === 10);
console.... | true |
3ffb30ccf8693cc2d29e3d53b309c7ee250d10b2 | JavaScript | EysteinnO/LokaverkefniLaravel | /public/js/departures.js | UTF-8 | 2,269 | 3 | 3 | [
"MIT"
] | permissive | "use strict"
$(document).ready(function() {
console.log("ready!");
var jasonUrl = "http://apis.is/flight?language=is&type=departures"; //Json string
$.getJSON(jasonUrl, function(data) {
var flightInfoDepartures = [];
console.log(flightInfoDepartures);//Array init
... | true |
b4e709fec820c781c6c983cca5fe0d6fd71948ce | JavaScript | jole141/RecipeBook-Web-App | /src/Recipe.js | UTF-8 | 3,074 | 2.546875 | 3 | [] | no_license | import React, { useRef } from "react";
import axios from "axios";
import PopUpAdd from "./PopUpAdd";
const Recipe = (props) => {
const modalRef = useRef();
const editRef = useRef();
const recipeData = {
recipeName: "",
ingredients: "",
};
const deleteData = async () => {
const url... | true |
e77dc43cae6beda2d5f71c40e1590212a9c79cdb | JavaScript | syzygyexe/Link-Shrinker | /routes/link.routes.js | UTF-8 | 2,128 | 2.53125 | 3 | [] | no_license | const { Router } = require("express");
const {} = require("express");
const config = require("config");
const shortid = require("shortid");
const Link = require("../models/Link");
const auth = require("../middleware/auth.middleware");
const router = Router();
// auth middleware is protecting our end point from an una... | true |
4249e856c1772b85bfb88eed50adfb1b66f15473 | JavaScript | nautilus-framework/nautilus-framework | /nautilus-framework-web/src/main/resources/static/js/controller/execution.js | UTF-8 | 5,905 | 2.8125 | 3 | [
"MIT"
] | permissive | var userSettingsDTO;
var executionSettingsDTO;
var red = 0;
var green = 100;
function getColorize(){
return $("#colorize").val();
}
function showLines(){
return executionSettingsDTO.showLines;
}
function normalize(value, a, b, min, max) {
return a + (((value - min) * (b - a)) / (max - min));
}
function getColor... | true |
f0521a66f0888884d6fb82c51832893de41b492a | JavaScript | shiny-lee/proto | /proto.js | UTF-8 | 1,597 | 2.796875 | 3 | [] | no_license | /*
* @copyright 2012 Shiny Lee (liqrliqr [at] gmail.com)
* @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0-standalone.html
*/
/**
* Implement `Object.setPrototypeOf` function to encapsulate `__proto__`.
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/proto#Example
*/
(func... | true |
fb87c23de8af77745185877a0eaea05b44f68945 | JavaScript | Oodmincheg/JS_algorithms | /react/test/src/topics/React.RenderProps/ComponentComposition.js | UTF-8 | 876 | 2.953125 | 3 | [] | no_license | import React, { Component, Fragment, Children } from 'react';
const Euro = ({ amount }) => <p>Euro: { amount * 0.86 }</p>;
const Pound = ({ amount }) => <p>Pound: { amount * 0.76 }</p>;
class Amount extends Component {
state = {
amount: 0
};
onIncrement = () => this.setState(state => ({ amount: state.amoun... | true |
c9336e36a8d81a85807715e4db75f826c7b66767 | JavaScript | bmj-school/udacity_blockchain | /PROJECT4_star_notary/server/models/Star.js | UTF-8 | 1,128 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | /**
* The Star data model.
*/
class Star {
constructor(data) {
this.data = data;
console.log('New Star object instantiated');
}
validate() {
// TODO: How to properly handle these errors in Hapi???
if (!('dec' in this.data['star'])) { return 'Missing dec' }
if (this... | true |
9da0120b80dd548a858f14a9307e2e0e5181eb47 | JavaScript | Tedza/tedza-app | /web-app/js/script2.js | UTF-8 | 4,296 | 2.734375 | 3 | [
"MIT"
] | permissive | $(function() {
var breadcrumb = $("#breadcrumb");
function loadData(callback) {
$.ajax({
url:"home/applicationData",
dataType: "json",
type: "GET",
success: function(data) {
loadedData = data;
callback();
}
});
}
function drawButton(image, label, callback) {
var a = $("<a href='javasc... | true |
1a58b23dfe3188a6212b32fff8833b2b57aa21ff | JavaScript | j0rg3n/shadow-ninja-monkey | /CPPNinjaMonkey/src/lib/math/Edge.js | UTF-8 | 3,528 | 3.234375 | 3 | [] | no_license |
/**
* Create an edge between two point,
* it is only visible from it's left side.
*
* @param from
* @param to
* @return
*/
function Edge(from, to)
{
this.from = from;
this.to = to;
// Link the points back to us
this.from.edge = this;
this.to.edge = this;
}
/**
* Tell if this edge is
* @param Point ... | true |
48852953f7b48784e54c0f4f656d9f82fbf6a291 | JavaScript | moh-i-ahmed/Car-Sharing | /src/main/resources/static/js/car-sharing/date-time-picker.js | UTF-8 | 3,585 | 3.328125 | 3 | [
"MIT"
] | permissive | /**
* GIJGO DateTimePicker Custom Configuration & Validation
*
*/
//Initialize DateTimePicker
function dateTimePickerInitializer() {
var dateTimeFormatter = 'hh:mm A DD/MM/YYYY';
var startMoment = moment().add(15, 'minutes').format(dateTimeFormatter); //start time 15 minutes from now
var endMoment =... | true |
c212698e878c92705ee0e9318c8e1bce5941b400 | JavaScript | idkjs/Learn-Type-Driven-Development | /learn-type-driven-development/src/Ch07/Ch07_DomainTypes.bs.js | UTF-8 | 940 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
function makeExn(string) {
if (string === "") {
throw {
RE_EXN_ID: "Assert_failure",
_1: [
"Ch07_DomainTypes.re",
8,
4
],
Error: new Error()
};
}
return string;
}
var NonEmptyString = {
makeExn: makeExn
};
... | true |
be28c47560bb49e6ee87b923be24c75d4ba5620b | JavaScript | Husseinm1/CarParkSystem | /tests/app.js | UTF-8 | 2,622 | 2.75 | 3 | [] | no_license | $('#navbar').load('navbar.html');
//register
$('#register').on('click', function(){
const username = $('#user').val();
const rego = $('#vehicleRego').val();
const password = $('#password').val();
const conpassword = $('#conPassword').val();
const register = JSON.parse(localStorage.getItem('regist... | true |
7fd20fc5e3f5d06276c2357a8324c73f6d2d3979 | JavaScript | prjchecjcardona/programacionGE | /js/detalle_Intervencion_Coordinadora.js | UTF-8 | 5,730 | 2.796875 | 3 | [] | no_license | $(document).ready(function(){
traerNombre();
/*Extrae los parametros que llegan en la url
* parametro:
*/
$.get = function(key) {
key = key.replace(/[\[]/, '\\[');
key = key.replace(/[\]]/, '\\]');
var pattern = "[\\?&]" + key + "=([^&#]*)";
var regex = new RegExp(pat... | true |
eeb0d40a3030069bedfa39321241873dd72787d8 | JavaScript | bmullis/vanilla-js-todo-app | /js/todo-app.js | UTF-8 | 511 | 2.625 | 3 | [] | no_license | import {renderTodos} from './render-todo-app.js'
import {addEventListeners} from './event-listeners.js'
// Load todos from local storage, or set to empty array
const todos = JSON.parse(localStorage.getItem('todos')) || []
// Initialize filters
const filters = {
filter: 'All',
searchQuery: '',
sortBy: 'Asc'
}
/... | true |
b4d3fb9e5210df00a2188f702ba6af0d83961268 | JavaScript | michalzelewski/NODEwpg | /JAVASCRIPT/index2.js | UTF-8 | 180 | 2.5625 | 3 | [
"MIT"
] | permissive | var firstName;
var lastName;
var age;
var dateOfBirth;
var address;
firstName = 'Michal';
lastName = 'Zelewski';
age = 29;
dateOfBirth = '04/20/1988';
address = '2510 Portage Ave'; | true |
2006afac11843cad1d882d74a02440196eb293fd | JavaScript | adamdawkins/rule-first | /logic.js | UTF-8 | 7,760 | 2.984375 | 3 | [] | no_license | const { curry, pipe } = require("ramda");
// contains :: [a] -> a -> Boolean
const contains = curry((list, item) => list.indexOf(item) > -1);
// selectOption :: String -> State -> State
const selectOption = curry((optionId, state) => {
console.log(`\nSelecting option: ${optionId}\n`);
return {
...state,... | true |
8d6c7ac430346efa1f10cf6b99315e4eb379902a | JavaScript | bibenji/randomovies | /public/js/admin/collection_holder.js | UTF-8 | 1,468 | 2.875 | 3 | [
"MIT"
] | permissive | $(function(){
$collectionHolder = $('ul.form-collection');
$collectionHolder.data('index', $collectionHolder.find('li').length); // divisé par 3 car compte le nombre de champs
$collectionHolder.on('click', '.delete-button', function(event) {
$(event.target).closest('li').remove();
});
fun... | true |
f6e618c83b9d60a1ae083b96d3ffa835666a0d8b | JavaScript | HeywoodKing/Flink | /examples/js/flink-1.0.0.js | UTF-8 | 15,175 | 2.734375 | 3 | [] | no_license | /*
author: flack
date: 2019-03-08
desc: 前端强大的纯JS导出组件Flink.js
*/
(function(){
//
}());
;
var fk = {
// 基础选项
options: {
type: 'excel', //默认excel,(excel word csv pdf image)
dataSource: 'json', //默认json,(json table html)
workSheet: 'sheet1', //Worksheet名称
sheetHeader: [], //要导出文件的表头,eg:['姓名','年龄','住址']... | true |
28911b154850924d561125d214e264a0079c1289 | JavaScript | codelibs/elasticsearch-kopf | /src/kopf/models/node_filter.js | UTF-8 | 1,256 | 2.6875 | 3 | [
"MIT"
] | permissive | function NodeFilter(name, data, master, client, timestamp) {
this.name = name;
this.data = data;
this.master = master;
this.client = client;
this.timestamp = timestamp;
this.clone = function() {
return new NodeFilter(this.name, this.data, this.master, this.client);
};
this.getSorting = function() ... | true |
78a99cd624283f2e10de6a0a7c76a9882e5248d4 | JavaScript | crazyvalse/algorithms | /src/08-stack/m-739-dailyTemperatures/or/02.js | UTF-8 | 801 | 3.765625 | 4 | [
"MIT"
] | permissive | /**
* 用单调栈
* T: [73, 74, 75, 71, 69, 72, 76, 73]
*
* stack: [75, 71, 69, 72]
*
* 1. 栈
* - 当 array[i] <= stack[stack.length - 1] 说明不是,stack.push(i)
* - 相反 新值大于栈中的,说明是
* while(stack.length !== 0 && array[i] > stack[stack.length - 1]) {
* result[index] = i - index
* index = stack.pop()
* ... | true |
666a9fafb1b4153629ce5389c9b85609c4dd6a9a | JavaScript | KrystianZagdanski/GenJS_NN | /JS/Unit.js | UTF-8 | 5,250 | 2.875 | 3 | [] | no_license | class Unit
{
constructor(x, y, r, dna)
{
//test
this.drawBrain = false;
//end test
this.x = x;
this.y = y;
this.r = r;
this.rotation = 0;
this.eyeLen = this.r*10;
this.eyes = [];
for(let i = 0; i < 5; i++)
{
let angle = -90;
angle += 45*i;
this.eyes.push({
angle: a... | true |
190fbbc27ac88c923a07cb331683933bb5d10212 | JavaScript | ryanbgraham/callbackPractice | /callbackPractice.js | UTF-8 | 3,478 | 4.125 | 4 | [] | no_license | /* In this repo your job is to write functions to make each function call work properly.
Below is a sample problem
//code here for sayHi
sayHi('Hi Katie', function(thingToSay){
alert(thingToSay);
});
and what you should write is the favNum function that makes the code above work,
var... | true |
dd3fbb5d6cff0ce3c3d382632e38be4af64ba449 | JavaScript | esensei/OnlineCheck | /src/reducers/checkReducer.js | UTF-8 | 751 | 2.578125 | 3 | [] | no_license | const initialState = {
uploaded: false,
fetched: null,
startListenBLE: false
}
const checkReducer = (state = initialState, action) => {
if (action.type === 'RUN_FIND_BLE') {
return {
uploaded: false,
fetched: action.payload,
startListenBLE: true
}
}
if (action.type === 'CHECK_FETC... | true |
dd133b0178c2b24597ae538667a229798a1c1836 | JavaScript | xurxe/Integrify-05-geometry-library | /geometry-library.js | UTF-8 | 10,632 | 3.234375 | 3 | [
"MIT"
] | permissive | console.log(calcCircleArea(1));
console.log(calcCirclePeri(1));
console.log(calcAnnulusArea(2, 1));
console.log(calcSphereVolume(1));
console.log(calcSphereSurfAr(1));
console.log(calcRightTriangleArea(1, 2));
console.log(calcRightTrianglePeri(1, 2));
console.log(calcEquilateralTriangleArea(1));
console.log(calcEquilat... | true |
8fc86e660b68c873a0c52a521d3a8da4fca8f36c | JavaScript | rocape/BlocklyMasterTraining | /SimpleBlockly/generaters/repeatG.js | UTF-8 | 527 | 2.65625 | 3 | [] | no_license | 'use strict';
goog.provide('Blockly.JavaScript.repeat_times');
goog.require('Blockly.JavaScript');
Blockly.JavaScript['repeat_times'] = function(block) {
var value_times = Blockly.JavaScript.valueToCode(block, 'times', Blockly.JavaScript.ORDER_ATOMIC);
var statements_dowhat = Blockly.JavaScript.statementToCode(b... | true |
d76105769c9ca9bf93368f11dbf2b09633bec70d | JavaScript | GUMEIK/gumeik-netcloud | /src/components/livechat/cookie.js | UTF-8 | 673 | 2.953125 | 3 | [] | no_license | function setCookie(cookieObj){
if(!cookieObj) return;
for(let prop in cookieObj){
document.cookie = `${prop}=${cookieObj[prop]}`
}
}
function getCookie(key){
let cookie = document.cookie;
let obj = {};
if(cookie.indexOf(";") > -1){
let cookieArray = cookie.split("; ");
... | true |
5e5dbf6f90fcb90401380ed7e5e5d10e67880b6e | JavaScript | yugmani/hooksDemo | /hook/src/components/ClassHookMore.js | UTF-8 | 551 | 2.671875 | 3 | [] | no_license | import React, { Component } from "react";
class ClassHookMore extends Component {
constructor(props) {
super(props);
this.state = {
count: 0,
};
}
incrementCount = () => {
this.setState((prevState) => {
return {
count: prevState.count + 1,
};
});
};
render() {... | true |
8e1dc099b97e7b36154fe3868fc98dd1af394a15 | JavaScript | tatasutiadi/bambootajur | /assets/js/floating.js | UTF-8 | 486 | 2.671875 | 3 | [] | no_license | // BUGS
// adding css scrolls to header in initial opening break window scrolling
// if closed when scrolled to bottom, remains at bottom on next opening
const msgrScrollWindow = document.querySelector('.scrollable');
const msgrHeader = document.querySelector('.header');
msgrScrollWindow.addEventListener('scroll', f... | true |
0699ce5dcb0bcaede7beb21aead39900a14fef90 | JavaScript | Harrylever/JavascrpitNotes | /Learnrx Functional Programming/Exercise 4 Implement map().js | UTF-8 | 519 | 4.3125 | 4 | [] | no_license | // To make projections easier, let's add a map() function to the Array type.
// Map accepts the projection function to be applied to each item in the
// source array, and returns the projected array.
Array.prototype.Map = function(projectionFunction) {
var results = [];
this.forEach(function(itemInArray) {
resul... | true |
11286c40371b8b3e3f9b51ad90bb428f60e4a0cc | JavaScript | sleepydev7/Project3-frontend | /src/Pages/LoginPage.js | UTF-8 | 2,460 | 2.765625 | 3 | [] | no_license | import { useState } from "react";
import { Link } from "react-router-dom";
import { login } from "../services/userService";
import "./HomePage.css";
export default function LoginPage(props) {
// component state
const [formState, setFormState] = useState({
email: "",
password: "",
});
//handler functi... | true |
34137a1fbd275ed2be23ba5e10b58391effcb822 | JavaScript | projet-se-web/CorpLeap | /validation/register.js | UTF-8 | 1,488 | 2.625 | 3 | [] | no_license | const Validator = require("validator");
const isEmpty = require("is-empty");
module.exports = function validateRegisterInput(data) {
let errors = {};
data.enterpriseId = !isEmpty(data.enterpriseId) ? data.enterpriseId : "";
data.employeeId = !isEmpty(data.employeeId) ? data.employeeId : "";
data.CUI = !... | true |
34f532cb0e2a818e9527a4a0933e663f8bbfe62f | JavaScript | manneocampo/Hangman-CLI | /word.js | UTF-8 | 917 | 3.5 | 4 | [] | no_license |
var Letter = require("./letter.js");
function Word(answer) {
this.answer = answer;
this.letters = [];
this.found = false;
this.getLetters = function(){
for (var i=0; i<this.answer.length; i++){
this.letters.push (new Letter(this.answer[i]));
}
};
this.findWord = function() {
this.foun... | true |
eaaaf55e26fc450f67334503c238113c02ce9737 | JavaScript | DFLovingWM/leetcode-solving | /problems/712-minimum-ascii-delete-sum-for-two-strings/bottom-up-DP.js | UTF-8 | 1,025 | 3.625 | 4 | [] | no_license | /**
* LCS解法:dp[i][j]表示A[:i]与B[:j]的最小删除
*
* 时间:O(NM), 296ms
*/
var minimumDeleteSum = function (A, B) {
const dp = Array.from({ length: A.length + 1 }, () => Array.from({ length: B.length + 1 }, () => Infinity))
dp[0][0] = 0
for (let i = 1; i <= A.length; ++i) dp[i][0] = dp[i - 1][0] + getCode(A[i - 1])
fo... | true |
c104ea3fbdf3eff15b8213a81604cb9b3432b6c4 | JavaScript | ValentinaChaconBuitrago/Interactive-Resume | /scripts/script.js | UTF-8 | 879 | 3.609375 | 4 | [
"MIT"
] | permissive | //Whole-script stric mode
'use strict';
//Create a time interval for the changes in quotes
function time(){
setInterval(changeQuote,3000);
}
//Modify the quote included in the about me section
function changeQuote(){
console.log("entro a funcion");
let alternative = new Array();
alternative[0] = "Perseverance, th... | true |
c3d203a4e8495dc37fc7b7dae5e5f12379d188e8 | JavaScript | pjnovas/tutejs | /Game/round.js | UTF-8 | 4,139 | 2.65625 | 3 | [] | no_license | /**
* @author pjnovas
*/
var deckClass = require('./deck');
var common = require('./common');
function Round(options){
//publics
this.trumpIdx = options.trumpIdx;
this.roundtimes = options.times;
this.plPriorCard = options.startIndex;
//events
this.onRoundMoved = options.onRoundMoved;
this.onRoundEnd = o... | true |
5afb18f860caf551f6b251f698630364f67691f8 | JavaScript | anudeep654/Data-Structures-Algorithms-in-Javascript | /Recursion/HelperMethodRecursion.js | UTF-8 | 333 | 3.421875 | 3 | [] | no_license | function collectOddValues(num) {
//outer function
let result = [];
function innerHelper(val) {
//inner function
if (val.length === 0) return;
if (val[0] % 2 !== 0) {
result.push(val[0]);
}
innerHelper(val.slice(1));
}
innerHelper(num);
return result;
}
collectOddValues([0, 1... | true |
88660a1382d52334098731a9ba0bbf56e0bfbfb1 | JavaScript | nmuldavin/js-vector | /test/jsvector.js | UTF-8 | 4,359 | 3.34375 | 3 | [] | no_license | require('chai').should();
const Vector = require('../dist/jsvector.js').Vector;
describe('jsvector', () => {
let v;
describe('Vector() Constructor', () => {
beforeEach(() => {
v = new Vector();
});
it('Vector() should return an empty array', () => {
v.length.should.equal(0);
});
... | true |
620127d66f48363315b9352bc6ea3d73f4d42307 | JavaScript | Fed03/mixin-test-failing | /addon/utils/object-values.js | UTF-8 | 405 | 2.75 | 3 | [
"MIT"
] | permissive | import Ember from "ember";
var objectValues = function (object) {
var values = Ember.A([]);
var keys = Ember.keys(object);
keys.forEach((key) => {
if(typeof object[key] === 'object') {
let results = objectValues(object[key]);
Array.prototype.push.apply(values, results);
} else {
valu... | true |
e743dbdc8e6deae9bf91c64289f439e7b76f6e68 | JavaScript | itsh01/ScrumDashboard | /src/js/flux/stores/planningStore.js | UTF-8 | 2,161 | 2.640625 | 3 | [] | no_license | define([
'../../constants'
],
function (constants) {
'use strict';
function Planning(planningPars) {
var IsAddingOrEditingCard = false;
var currentCard = null;
this.emitChange = function () {
planningPars.eventEmitter.emit(constants.... | true |
e2be43575469fad66ecbdaa7e3d22c0bcacd2569 | JavaScript | ruslanandreevpro/omnisale-test | /src/js/index.js | UTF-8 | 2,368 | 2.84375 | 3 | [
"MIT"
] | permissive | import "./import/modules.js";
import "./import/components.js";
let isValid = false;
let isFormValid = false;
const formControls = {
phone: {
value: "",
type: "phone",
error: true,
touched: false,
validation: {
required: true,
phone: true
}
},
password: {
value: "",
type: "password",
error: ... | true |
151cc701fcacb2882c73bb7fc38bf15e74e7c90a | JavaScript | zdergatchev/JavaScriptCore | /01.JS_Fundamentals/10JavaScriptStringsAndRegExpExercises/06.CaptureTheNumbers.js | UTF-8 | 739 | 3.53125 | 4 | [] | no_license | function CaptureTheNumbers(input) {
let numbers =[];
let regex = /\d+/g;
let text ="";
for(let i=0; i < input.length; i++){
let currentSentence = input[i];
text += currentSentence;
}
let match = regex.exec(text);
while(match){
numbers.push(match[0]);
match =... | true |
96de5a479073ddc40cfc94f8bfc92137e41564e0 | JavaScript | henry-luo/mark | /test/parse-error-handling.js | UTF-8 | 3,117 | 2.875 | 3 | [
"MIT"
] | permissive | const test = require('tape') ;
const Mark = require('./../mark.js');
test('Mark parse error handling ', function(assert) {
assert.throws(function () { Mark(); }, /Type name should be a string/, "Mark construction needs type name");
assert.throws(function () { Mark.parse(null); }, /Unexpected end of input/, "... | true |
29c12bcbc603a6a9fa8e6fdb0f1d016a37a33984 | JavaScript | jamesonmccowan/prettyprinter | /js/tests/map.js | UTF-8 | 1,821 | 3.25 | 3 | [] | no_license | describe("The \"map\" function", function() {
it("Can iterate over an Array", function() {
var size = Math.floor((Math.random()*15)+5);
var a = [];
for (var i=0;i<size;i++) {
a.push(Math.floor((Math.random()*200)-100));
}
var b = [];
var c = GP.map... | true |
f4af25d190b608aa1256ece8c0be051cdfc36adf | JavaScript | wxyhly/4dViewer | /minecraft4d/mcloader.js | UTF-8 | 4,994 | 2.59375 | 3 | [] | no_license | var MCLoader = function(){
}
MCLoader.version = 1;
MCLoader.msg = function(msg){
console.log(msg);
}
MCLoader.load = function(input){
MCLoader.buffer = null;
var file = input.files[0];
if(!file) return 0;
filename = file.name.split(".")[0];
var reader = new FileReader();
reader.onload = function() {
MCLoader.... | true |
7c89acac34d6958c722a0e8ed037aeca80cdd6d9 | JavaScript | tracemcgraw/bollyclient | /src/auth/Signup.js | UTF-8 | 6,271 | 2.921875 | 3 | [] | no_license | import React, { Component } from 'react';
import { Form, FormGroup, Label, Input, Button } from 'reactstrap';
class Signup extends Component {
constructor(props){ //T2
super(props);
this.state = {
username: "",
userLastName: "", //T1
password: "",
ema... | true |
44857db5b918b14f210ffe59966c805a9b54b45f | JavaScript | wurishi/note | /tensorflowjs/4/client/client.js | UTF-8 | 1,981 | 3 | 3 | [] | no_license | import io from "socket.io-client";
const predictContainer = document.getElementById("predictContainer");
const predictButton = document.getElementById("predict-button");
const socket = io("http://localhost:18001", {
reconnectionDelay: 300,
reconnectionDelayMax: 300,
});
let testSample = [2.668, -114.333, -1.908,... | true |
2b565cfab35f121f178550ccd698ba387f379219 | JavaScript | Rishav-Agarwal/Pixel-Art-Maker | /scripts/designs.js | UTF-8 | 14,081 | 2.84375 | 3 | [] | no_license | $(function() {
/* THE SKELETON */
//Pixel art maker logo + text
const header = $('#header');
//Container of whole art maker (whole webpage except header and footer)
const container = $('#container');
//Footer of the webpage
const footer = $('#footer');
//Options column
const options... | true |
343cd8345a3dfb38b804053f77bcc53d94694acc | JavaScript | nostneji/keeleliin-server | /src/util/server.js | UTF-8 | 946 | 2.515625 | 3 | [] | no_license | var logger = require('log4js').getLogger('server_util');
var Server = {
normalizePort: function(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
return val;
}
if (port >= 0) {
return port;
}
return false;
},
onError: function(... | true |
1e65540c4c487cf53532108c5bac5b3618814828 | JavaScript | joaquin-gl/4.032-sketches | /09 motion_intro/io-examples/load_table/load_table.js | UTF-8 | 1,460 | 3.21875 | 3 | [] | no_license | var data = [];
var dataCount;
var dataMin = 0;
var dataMax = 100;
var dataTable;
var countryCode = "USA";
var bounds = { };
// load data in this function so that we can use it immediately inside setup()
function preload() {
// load women's labor force participation rate data
dataTable = loadTable("data/LFSFFE15... | true |
4b3222b1047a47ffbbb4557b1c252f6a6621ab99 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /GIT-USERS/ashishdotme/programming-problems/javascript/freecodecamp/basic/10-mutations.js | UTF-8 | 833 | 3.9375 | 4 | [
"MIT"
] | permissive | /**
* Created by Ashish Patel
* Copyright © 2017 ashish.me
* ashishsushilpatel@gmail.com
*/
/**
* Program:
* Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
* For example, ["hello", "Hello"], should return true because all... | true |
027ec0e30bc1eb11fbc0fb2295da7c985e432406 | JavaScript | maheshramaiah/Battleship-app | /server/model/Room.js | UTF-8 | 812 | 3.171875 | 3 | [] | no_license | class Player {
constructor(name, socket) {
this.name = name;
this.socket = socket;
this.ready = false;
}
setReady() {
this.ready = true;
}
}
class Room {
constructor() {
this.players = {};
this.length = 0;
this.currentPlayer = null;
}
addPlayer(id, { name, socket }) {
th... | true |
075e4f6a7d8fec066aaddddeab06a31245d46846 | JavaScript | Jazk-Z/mini-project-server | /middleware/logger/logger.js | UTF-8 | 2,157 | 2.53125 | 3 | [
"MIT"
] | permissive | const log4js = require('log4js')
const methods = ['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'mark']
// 提取默认公用参数对象
const baseInfo = {
appLogLevel: 'debug', // 指定记录的日志级别
dir: 'logs', // 指定日志存放的目录名
env: 'dev', // 指定当前环境,当为开发环境时,在控制台也输出,方便调试
projectName: '', // 项目名,记录在日志中的项目信息
serverIp: '0.0.0.0' // 默认... | true |
74c1327e1cf14f9fabd0e99dafa52ef3fe11c5bf | JavaScript | ddivyansh18/ImageStream | /src/components/editMeme.js | UTF-8 | 2,305 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react'
import { Form } from 'semantic-ui-react'
let body = {};
let postUrl;
async function PostMeme(body, url) {
if(Object.keys(body).length === 2 &&
body.url !== undefined &&
body.caption !== undefined) {
const response = await fetch(url, {
m... | true |
d14486944b575150ae75d799ed199c69bdc3dbef | JavaScript | jgamann/vendenet | /src/main/webapp/js/h345h_3j34ui34u_3uy5u33uy_4uy35.js | UTF-8 | 6,012 | 2.5625 | 3 | [] | no_license | var ajax;
function seleccionarAnuncio(fila, idAnuncio){
/*if($('#ultimoSeleccionado').val()!=""){
if($('#ultimoSeleccionado').val() % 2 == 0){
document.getElementById('fila_'+$('#ultimoSeleccionado').val()).style.backgroundColor="#555";
}else{
document.getElementById('fila_'+$('#ultimoSelecciona... | true |
54d14e1eadef4e09a68337a7b7159353d7c8c014 | JavaScript | FreddyOkito/CTK302 | /Unit1/snowman/sketch.js | UTF-8 | 213 | 2.546875 | 3 | [] | no_license | function setup() {
createCanvas(500, 500);
}
function draw() {
//background
ellipse(width/2, height/2 +25, 50,50);
ellipse(width/2, height/2 +50, 100,100);
ellipse(width/2, height/2 +75, 150,150);
}
| true |
05cb5c895a3ab463c3ccabf2ab0146707cfa0ebf | JavaScript | jotamontecino/JSONSchema | /lib/null.js | UTF-8 | 756 | 2.875 | 3 | [] | no_license | const JSONType = require("./jsonType");
class JSONNull extends JSONType {
constructor({
type,
description,
defaultValue,
}) {
super();
if (
type === "null"
) {
this.description = description || "";
this.defaultValue = null;
this.validate = this.createValidationFuncti... | true |
924bd1877f392f70224ba4aed557868ee95ae42f | JavaScript | dqmmpb/gifts | /src/common/dateUtil.js | UTF-8 | 1,913 | 2.796875 | 3 | [] | no_license | /**
* Created by alphabeta on 17-3-30.
*/
import fecha from 'fecha'
/**
* 日期辅助类
* @type {{format: (function(*=, *=): *)}}
*/
const dateUtil = {
/**
* 格式化日期时间,使用fecha插件
* @param dateObj
* @param format
* @param pattern
* @returns {*}
*/
format (dateObj, format, pattern) {
if (Object.pro... | true |
436c318a6aa3ff0ec6f07dea7420308a6a0e70d3 | JavaScript | Tanmay53/cohort_3 | /submissions/sm_036_prabhat/week_03/day_5/session_2/newUser.js | UTF-8 | 209 | 2.671875 | 3 | [] | no_license | function newUser(name, email, password){
var obj = {
Name : name,
Email : email,
Password : password,
}
return obj
}
console.log(newUser("prabhat","prabhat@gmail.com","abc@123")) | true |
4acf47f8828f54cdc158a7a4151bfe2dea46b47b | JavaScript | zhangst23/tutorial | /AngularJS/introToAngular/AngularJS-性能问题及调优.js | UTF-8 | 5,280 | 3.4375 | 3 | [] | no_license | AngularJS 性能问题及调优.html
七大调优法则
<!-- 1. 渲染没有数据绑定的列表 -->
这是最明显的解决方案,因为数据绑定是性能问题最可能的根源。如果你只想显示一次列表,并不需要更新、改变数据,放弃数据绑定是绝佳的办法。不过可惜的是,你会失去对数据的控制权,但除了该法,我们别无选择。
<!-- 2.不要使用内联方法计算数据 -->
为了在控制器中直接过滤列表,不要使用可获得过滤链接的方法。“ng-repeat”会评估每个表达式。在我们的案例中,“filteredItems()”返回过滤链接。如果评估过程很慢,它将迅速降低整个应用的速度。
l <li ng-repeat="item in ... | true |
59762e8d30d2d350048df47860966cd7265674a9 | JavaScript | tggithub619/Codewars-Javascript | /Plus - minus - plus - plus - ... - Count.js | UTF-8 | 287 | 2.734375 | 3 | [] | no_license | //https://www.codewars.com/kata/5bbb8887484fcd36fb0020ca/train/javascript
const catchSignChange = arr => {
let countM = 0
for (let i =0; i<arr.length; i++){
if(arr[i]<0 && arr[i+1]>=0 || arr[i]>=0 && arr[i+1]<0){
countM++;
}
}
return countM
} | true |
c408c2d008de8e0682d9d72fdbfcde6d57e71bea | JavaScript | brandon121j/color-calculator | /main.js | UTF-8 | 1,399 | 3.78125 | 4 | [] | no_license | const prompt = require('prompt-sync')();
const option = prompt('Combine or deconstruct colors? ');
r = "red";
b = "blue";
y = "yellow";
o = "orange";
g = "green";
p = "purple";
e = "error";
if (option == "combine") {
const color1 = prompt('Enter first color ')
const color2 = prompt('Enter second color ')
... | true |
debaa19daa1e9b0b714a2584b1df61ecad64e718 | JavaScript | nicklimmm/tictactoe-ai | /src/components/Grid/GridHooks.js | UTF-8 | 1,192 | 2.875 | 3 | [] | no_license | import { useState, useEffect, useContext } from "react"
import { randomChoice, getWinner, isFull } from "./GridHelper"
import { botMove } from "./Bot"
import { ModeContext } from "../../App"
export const useTurn = () => {
// X is for Human, O is for Human or Bot
const [currentTurn, setCurrentTurn] = useState(rando... | true |