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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b748016ce5d8ab10a78f5a3b6d52f6fa440b32c1 | JavaScript | bridge-school/bridge-slides-spectacle | /src/slides/immutability/immutability-array-code-2.example.js | UTF-8 | 439 | 3.59375 | 4 | [
"CC-BY-4.0"
] | permissive | const myFriendsLastYear = ['Elliot', 'Mustafa', 'Rehana', 'Sarah'];
const myFriendsThisYear = myFriendsLastYear.concat('Yihua');
// the below works exactly the same!
// const myFriendsThisYear = [...myFriendsLastYear, 'Yihua'];
console.log(myFriendsThisYear); // correctly shows all 5 of my current friends, including... | true |
558088212b6f7a768beeb2dd1d1d759f1c69d038 | JavaScript | AlexErdei73/todolist | /src/sampletodos.js | UTF-8 | 3,273 | 2.9375 | 3 | [] | no_license | import { ToDo } from './todo.js';
const todoObject = new ToDo('Todo object');
todoObject.description = 'First thing to make the Todo object, which stores the data for the todo item.';
todoObject.priority = 'low';
const todoDisplay = new ToDo('Todo display');
todoDisplay.description = 'When the todo is ready, we make ... | true |
7f7d5fd4fab53f4fff459a98bbef8ba4f7f5e039 | JavaScript | HughHashes/p5-arrays | /sketch.js | UTF-8 | 964 | 3.3125 | 3 | [] | no_license | //This is a joke Mr. Budi is actually a great teacher who we are lucky to have work here.
var words = ["bad CHOICE", "Annoying VOICE", "No HUSTLE", "Can't Be OPTIMISTIC about him", "Wouldn't CONSIDER hiring him", "JK JK JK", "SIKE I Lied", "Less GRIT then the lakers", "This is a joke Mr. Budi is actually a great teach... | true |
91da476bd4924fba702461e62d273109dd799823 | JavaScript | Bhaukali/Web_Technology_Training | /work.js | UTF-8 | 2,640 | 3.515625 | 4 | [] | no_license |
// Onlcik Event of ADD
var entry = document.getElementById("entry");
entry.addEventListener("click", dd);
var row = 1;
var t;
var T = 0;
// Calling of dd() function for backend funtioning
function dd(){
// Getting the values of Dropdown Menu ID'd
var c = document.getElementById("itemlist").value;
var q = doc... | true |
d26652d9214afe33a983f01dc8ddcb709f44f169 | JavaScript | twosnakes/intro-to-react- | /src/App.js | UTF-8 | 1,539 | 2.828125 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
constructor() {
super()
this.state = {
introText: 'I came from the state!',
clickCount: 0,
textTwo: 'Im a second button!',
clickCountTwo: 0,
}
}
render... | true |
e41c5bff4dd7ea3981d91289c06754ca59f07039 | JavaScript | lucasperj/treinamentoHTML | /igao_estudos/udemy/testejs/aula19/index.js | UTF-8 | 1,011 | 4.40625 | 4 | [] | no_license | /*
Primitivos (imutaveis) - string, number, boolean, undefined.
null (bigint, symbol) - Valor
Referencia (mutavel) - array, object, function
*/
// 0123
// let nome = 'Luiz';
// nome[0] = 'Otavio';
// console.log(nome[0], nome); // Exemplo mostrando que string e imutavel
// let a = 'A';
// le... | true |
b228c1098dd63e99ccaf2e250d693cca99a674c5 | JavaScript | IvanMykhalchenko/Snake_Game_JavaScript | /snake.js | UTF-8 | 14,513 | 3.0625 | 3 | [] | no_license | class Snake {
// DOM элементы
constructor(options) {
this.wrapper = document.querySelector(options.wrapperSelector);
this.field = document.querySelector(options.fieldSelector);
this.blueTheme = document.querySelector(options.blueThemeSelector);
this.redTheme = document.querySelector(options.redThemeSelector);
th... | true |
a7c6152354404ed237bee9e4b401c79750de950b | JavaScript | dustinpfister/test_lodash | /forpost/lodash_filter/s2-av-vjs/1-array-filter.js | UTF-8 | 124 | 2.9375 | 3 | [] | no_license | let a = [4, -1, 7, 7, -3, -5, 1];
let b = a.filter(function(val){
return val > 0;
});
console.log( b ); // [4, 7, 7, 1] | true |
568a724d10d52fa02133fa59dea7c132dbfee0d4 | JavaScript | XuYuFei/react-learn | /AdvancedGuides/learn/src/views/3-Context/Demo4.js | UTF-8 | 521 | 2.671875 | 3 | [] | no_license | // Context API
import React from 'react'
const MyContext = React.createContext('React')
function App() {
return (
<MyContext.Provider value="Vue">
<FrontFramework />
</MyContext.Provider>
)
}
function FrontFramework() {
return <Hello />
}
class Hello extends React.Component {
// static contex... | true |
b8846404e04bda108552233c101daf1a88e25836 | JavaScript | farahatco/Word-Guess-Game | /assets/javascript/game.js | UTF-8 | 3,822 | 2.859375 | 3 | [] | no_license | var myWord = [{ W: "MAN", H: "name" },
{ W: "ALI", H: "AL" },
{ W: "TAS", H: "TA" }];
var word_test = [];
var lose = 1;
var cntr = 1;
var tries = 1;
var no = 0;
$(document).ready(function () {
var letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V"... | true |
e4c6dfb893ac81d0d7653ca7d68a9d93b6b3f004 | JavaScript | DFmoon/H5_game | /fish/js/main.js | UTF-8 | 3,332 | 2.9375 | 3 | [] | no_license | var canvas1;
var canvas2;
var context1;
var context2;
var canvas_width; //获取画布的尺寸
var canvas_height;
var lastTime; //上一帧被执行的时间
var deltaTime; //两帧的时间差
var bgpic=new Image(); //定义背景图片
var ane; //海葵
var fruit; //海葵的果实
var mom; //大鱼
var baby; //小鱼
var mx; //鼠标的位置
var my;
var babyTail=[];//小鱼尾巴的数组
var babyEy... | true |
02a84276eab5e8728174a07d75968832f16498bc | JavaScript | dgrafov/dgrafov.github.io | /derivative.js | UTF-8 | 9,240 | 3.46875 | 3 | [] | no_license | function derivative(node) {
if(node === null) {
return null;
}
var left = null;
var right = null;
console.log("Token " + node.token);
if(node.left !== null) {
left = derivative(node.left);
}
if(node.right !== null) {
right = derivative(node.right);
}
swit... | true |
3ec6e3305cf6c9f94b74f0ecba3de50bed09baa6 | JavaScript | farabbi/comp1720-2017-assignment-4 | /sketch.js | UTF-8 | 32,699 | 3.046875 | 3 | [] | no_license | var data;
function preload() {
data = loadJSON("assets/student-learning.json");
}
var questions = [];
function setup() {
createCanvas(windowWidth, windowHeight);
// this line is required due to a bug in the current version of p5
// https://github.com/processing/p5.js/issues/2154
data = Object.val... | true |
26efc7eea716db310984e32bf2d582d39bcb260d | JavaScript | jrasm91/pi-projects | /api/cooker-manager.js | UTF-8 | 2,589 | 2.75 | 3 | [] | no_license |
const config = require('./config')
const websockets = require('./websockets')
const { Cooker } = require('./cooker')
class CookerManager {
constructor () {
this.cookers = []
this.cookerId = 0
}
nextId () {
return `cooker${++this.cookerId}`
}
getById (cookerId) {
return this.cookers.find(co... | true |
6856ac69a5d149428fd0aae0f9f7119a7c0c19dd | JavaScript | EliTu/React-The-Complete-Guide-Couse-Repo | /Section 16/redux--01-start/src/store/reducers/resultReducer.js | UTF-8 | 610 | 2.5625 | 3 | [] | no_license | import { resultActions } from '../actions/actionTypes';
const initialState = {
results: [],
};
const resultReducer = (state = initialState, action) => {
const { STORE_RESULT, DEL_RESULT } = resultActions;
switch (action.type) {
case STORE_RESULT:
return {
...state,
results: state.results.concat({
... | true |
36b6cefe28435918ee6f4c2281537b743b4263e9 | JavaScript | lsoriac/base_nodejs_multiplicar | /app.js | UTF-8 | 1,578 | 2.96875 | 3 | [] | no_license | //npm install colors --save
//--save agrega este modulo como un paquete de dependencia, consultar en package.json
//forma correcta modulos del sistema y despues mis modulos
var colors = require('colors/safe');
//aumentar el .argv para acortar la instancia al llamar el atributo
const argv = require("./config/yargs").arg... | true |
a1275917d5691ca2b19c213370b8c08c641cd94e | JavaScript | nummyrice/data-structures-hash-tables-starter | /practice/practice.js | UTF-8 | 851 | 3.3125 | 3 | [] | no_license | const HashTable = require('../hash-table/hash-table');
function anagrams(str1, str2) {
let letters = {};
for (let letter of str1){
if (letters[letter]){
letters[letter]++;
}
else {
letters[letter] = 1;
}
}
for (let letter of str2){
if (letters[letter]){
letters[letter]--;
... | true |
65f836b2e85948498b9a39e4a14593f83060423e | JavaScript | Opeezy/Soup-Bot | /bot_modules/messages/index.js | UTF-8 | 840 | 2.78125 | 3 | [
"MIT"
] | permissive | 'use strict';
const fetch = require('node-fetch');
const sendReplyApi = (url, message) => {
message.channel.startTyping();
fetch(url)
.then(res => res.json())
.then((json) => {
console.log(json.message);
message.reply(json.message);
message.channel.stopTyping();
})
.catch(err => {
console.log(err);
me... | true |
a57b1eeec0392c6359dd0ec9aa29490ab0c625bc | JavaScript | Eechon/EatBao | /shopper/assets/js/uncheckgoods.js | UTF-8 | 1,492 | 2.625 | 3 | [] | no_license |
$(function() {
var shopId = localStorage.getItem("userId");
console.log("shopId", shopId);
if(shopId == null || shopId == '') {
window.location.href = 'http://localhost:8080/login.html'
}
$("#shopId").val(shopId)
//获得所有商家信息
$.get(baseUrl + "/goods/shop/" + shopId, function(result... | true |
2abde205bf74173210ab1e23dbcd730e972d3d1a | JavaScript | gliluaume/reminder | /test2.js | UTF-8 | 1,521 | 2.71875 | 3 | [] | no_license | 'use strict'
// const child = require('child_process')
const fs = require('fs')
const path = require('path')
const Promise = require('bluebird')
const readDir = Promise.promisify(fs.readdir)
const fsStat = Promise.promisify(fs.lstat)
// getAllRepos('.').then(stdout => console.log(stdout))
// function getAllRepos (p... | true |
dd384d9feb3a814d48b4611410f739ae54fa3298 | JavaScript | DanieleIsoni/DataAnalysisBot | /React/js/Component/Control/Suggest.js | UTF-8 | 1,584 | 2.546875 | 3 | [] | no_license | import React from "react";
class Suggest extends React.Component{
constructor(props){
super(props);
this.clearHistory = this.clearHistory.bind(this);
}
showValue(text, search){
if(search != ""){
let index = text.indexOf(search);
if(index >= 0){
... | true |
c05467f4c04d570fb7cfd782dcdf96e0e60479a1 | JavaScript | sparrow007/challenge-forum-processor | /src/modules/create_challenge/helpers.js | UTF-8 | 4,457 | 2.6875 | 3 | [] | no_license | const config = require('config')
const moment = require('moment')
const _ = require('lodash')
const { rocketChatClient } = require('../../utils/rocket-client.util')
const logger = require('../../utils/logger.util')
/**
* Processes a payload from the topic, to be consumed by the handler
* @param {Object} payload
*/
... | true |
2d15d3dd770bda910fc942b536c9e2642718c6cb | JavaScript | 797182/Computer-Science | /827 ball 3/sketch.js | UTF-8 | 941 | 3.359375 | 3 | [] | no_license | // Global variables
var balls=[];
//var b2;
//var b3;
// put setup code here
function setup() {
var cnv = createCanvas(800, 800);
cnv.position((windowWidth-width)/2, 30);
background(20,20,20);
loadBalls(120);
//b1 = new Ball(random(width), random(height),random(15, 35), color(255, 0, 0));
//b2 =... | true |
7c62e45db453f3c8af11ec6b2e589428fb2c5e1e | JavaScript | ghorbanihamid/react17.0.2_router_redux_webpack_fakeDB_materialUI_example | /src/reducers/usersListReducer.js | UTF-8 | 1,352 | 2.71875 | 3 | [] | no_license | import { actionTypes } from '../constants/actionTypes';
const initialSate = {
loading: false,
data: {},
errorMessage:""
}
const usersListReducer = (state = initialSate, action) => {
console.log('UsersList user Reducer called, current state : '+ JSON.stringify(state) +'new action : '+ JSON.stringify(action)... | true |
30b9f63a2a12a16c44db2d574303410e77e2275d | JavaScript | stephanepericat/vcv-js-scripts | /src/config.js | UTF-8 | 218 | 2.796875 | 3 | [
"MIT"
] | permissive | /**
* A simple demo displaying the options of the config object
*/
const process = () => {
const options = [];
for (let key in config) {
options.push(key);
}
display(`Options:${options.join(",")}`);
};
| true |
9d122c571df2cc104a7fbee316429421f5444af3 | JavaScript | wanadev/collision-gjk-epa | /demo/demo3d.js | UTF-8 | 3,213 | 2.734375 | 3 | [
"MIT"
] | permissive | 'use strict';
// get the canvas DOM element
var canvas3D = document.getElementById('canvas3d');
// load the 3D engine
var engine = new BABYLON.Engine(canvas3D, true);
// Set the basics
var scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color3(1, 1, 1);
var camera = new BABYLON.ArcRotateCamera("Arc... | true |
acb0d49dc6433c73a46eb22136c69064ffdfb81b | JavaScript | kingswisdom/dcomix | /assets/js/client.js | UTF-8 | 966 | 2.765625 | 3 | [
"MIT"
] | permissive | const steem = require("steem");
const io = require('socket.io-client');
var socket = io.connect();
var element = function(id){
return document.getElementById(id);
}
var tool1_text = element('text');
var tool1_proceed = element('proceed-talkToServer');
var tool2_username = element('username');
var tool2_proceed = el... | true |
c409ad6a744117f5370811fb70d535bf3d82d7f8 | JavaScript | topbass/nebula | /js/Nebula/Util/Messaging.js | UTF-8 | 7,645 | 2.546875 | 3 | [
"MIT"
] | permissive | /*!
* Nebula JavaScript Framework
* https://github.com/waltzofpearls/nebula
*
* Copyright (c) 2014 Topbass Labs (topbasslabs.com)
* Author Waltz.of.Pearls <rollie@topbasslabs.com, rollie.ma@gmail.com>
*/
Nebula.Register("Nebula.Util");
Nebula.Util.Messaging = (function($, Util) {
// Private static propertie... | true |
14ad47f4d2b8947d744e24ab658fb8aaa0b526c4 | JavaScript | commenthol/configg | /src/utils.js | UTF-8 | 6,890 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* @module src/utils
* @copyright 2015- commenthol
* @license MIT
*/
'use strict'
// module dependencies
const fs = require('fs')
const log = require('debug')('configg')
const path = require('path')
const hjson = require('hjson')
const atLine = require('at-line')
const findRoot = require('find-root')
const ut... | true |
6b1e7f97629d0f59bc1d15c08cb8662bb98cae8a | JavaScript | prathap1041220272/underscor-js-to-nromal-js | /ARRAYS/difference/index.js | UTF-8 | 429 | 2.96875 | 3 | [
"MIT"
] | permissive | (function() {
const a= document.querySelector("#demo");
const b= document.querySelector("#n");
const c= document.querySelector("#u");
let numbers =[1,2,3,0,4];
let n = [0,10,4];
a.innerText = JSON.stringify(numbers);
const no = _.difference(numbers,n);
c.innerText = JSON.stringify(no);
function find(argument) {
... | true |
85d2021109ba87c199b6516497187f2573445ef2 | JavaScript | DanielChristine/musicbackend | /index.js | UTF-8 | 518 | 2.65625 | 3 | [] | no_license | const express = require('express');
const app = express();
appp.use(express.json());
const app = express();
app.get('/', (req, res) => {
res.send()
});
app.post('/api/guitars',[validateGuitars] (req, res) => {
console.log(req.body.newGuitarBrand);
res.send(req.body);
});
app.listen(5000, () => conso... | true |
86f9623e0d722eefe4003b646da715ce95fc20e9 | JavaScript | hayleybucket1/hayleybucket1.github.io | /lesson09/js/windchill.js | UTF-8 | 692 | 4.03125 | 4 | [] | no_license | /* Input: pull values from document for speed and temp
*Processing: calculate wind chill
*Output: display wind chill*/
const tempNum = parseFloat(document.getElementById("temp").textContent);
console.log(tempNum);
const speedNum = parseFloat(document.getElementById("speed").textContent);
console.log(speedNum);
var... | true |
0f0a2dfefe4d3c730127cee03d7d0b94fd5cf20b | JavaScript | Ruslana35/js | /dom/sliders.js | UTF-8 | 1,035 | 3.234375 | 3 | [] | no_license | const left= document.querySelector("#left");
const right = document.querySelector("#right");
const itemsList = document.querySelector("#items");
const loop = (direction, e) =>{
e.preventDefault();
if(direction == "right") {
itemsList.appendChild(itemsList.firstElementChild)
}else{
itemsList.in... | true |
834e131de1b87078ebc881edd9eec297c404a8f4 | JavaScript | mnutze/bsc.log | /ccm.log.js | UTF-8 | 8,068 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* @overview ccm component for learning analytics data logging
* @forked from https://github.com/ccmjs/akless-components v.4.0.2 from André Kless <andre.kless@web.de>
* @author Michael Nutzenberger <michael.nutzenberger@inf.h-brs.de> 2019
* @license The MIT License (MIT)
* @version latest (1.0.0)
*/
( functio... | true |
ca14a955a1dfd0d6ae1538e6b114777c8cced746 | JavaScript | jwmullins92/budget-simple | /public/scripts/alternateTableRows.js | UTF-8 | 535 | 3.515625 | 4 | [] | no_license | // Alternates the table colors by selecting the last cell in the second row
const alternate = (lastColSecondRow) => {
let cells = [...document.querySelectorAll('.alt')]
altRows = []
for (let i = 0; i < cells.length; i++) {
if (cells.indexOf(cells[i]) % lastColSecondRow === 0) {
row = ce... | true |
881c3e68d166935a1d73cee82a4a75336b9e092c | JavaScript | purlantov/Team-Porto.Flip-TA-2017 | /Tetris_v2/js/audio.js | UTF-8 | 842 | 2.75 | 3 | [] | no_license | const audio = {
song: new Audio("./sounds/song.mp3"),
move: new Audio("./sounds/move.mp3"),
pause: new Audio("./sounds/pause.mp3"),
start: new Audio("./sounds/start.mp3"),
gameEnd: new Audio("./sounds/gameover.mp3"),
lineDrop: new Audio("./sounds/line-drop.mp3"),
lineRemove: new Audio("./sou... | true |
d7f52968e618b3710181be5750b35e1d447266b0 | JavaScript | Sanchez2502/Lab2 | /code.js | UTF-8 | 954 | 3.34375 | 3 | [] | no_license | document.getElementById("createResult").addEventListener("click",result);
var k = 1;
function result(){
var firstKatet = document.getElementById("firstKatet").value;
var secondKatet = document.getElementById("secondKatet").value;
if (firstKatet==0 || secondKatet==0) {
alert("Довжина не може бути 0");
re... | true |
60d7e87015634113615e0d226735ef5f8e644461 | JavaScript | tnorlund/aws-analytics-js | /entities/__tests__/session.test.js | UTF-8 | 3,482 | 2.71875 | 3 | [
"MIT"
] | permissive | const { Session, sessionFromItem } = require( `../` )
/** The unique ID for each visitor */
const id = `171a0329-f8b2-499c-867d-1942384ddd5f`
/** The average time spent on each page */
const avgTime = 10.0
/** The total time spent on pages */
const totalTime = 100.0
/** The date-time the session starts */
const sessio... | true |
73a0e3c1501f22e968ecfacd2930dc90099051f1 | JavaScript | Bwarhness/TrollerJS | /client/client.js | UTF-8 | 2,874 | 2.90625 | 3 | [] | no_license | var socket = require('socket.io-client')('http://87.56.217.210/');
socket.on('connect', function () {
console.log("connected")
});
socket.on('url', function (url) {
openUrl(url)
});
socket.on('say', function (speach) {
console.log(speach)
talk(speach);
});
socket.on('powerOff', function () {
... | true |
64be09c66c3dfd3a1eab7fed827e1311c9e06271 | JavaScript | LouisGaravaglia/iTranslate | /Backend/models/translation_model.js | UTF-8 | 963 | 2.65625 | 3 | [] | no_license | const db = require("../db");
class Translation {
static async add(data) {
const duplicateCheck = await db.query (
`SELECT track_id, language FROM translation
WHERE ( track_id, language ) = ($1, $2)`,
[data.track_id, data.language]
);
if (duplicateCheck.rows.length) {
return "tra... | true |
bebf0df9314425ab4bdf3f1bf0029ac7d28ef683 | JavaScript | ibzieg/m4ldev | /midi/markov-chain/lom_map.js | UTF-8 | 2,617 | 2.828125 | 3 | [] | no_license | /**
* Created by ian on 7/31/16.
*/
/*
song = {
liveObject: live.object ("live_set")
tracks: [
track {
liveObject: live.object
name: string
id: int
clips: [
clip {
liveObject: live.object
name: str... | true |
36db1625844327598649ad1ce067d1a6957c1e76 | JavaScript | septianrazi/triangleBackground.p5 | /sketch.js | UTF-8 | 1,840 | 3.25 | 3 | [] | no_license | var coords = [];
var xLength = 70;
var yLength = 45;
//variables used to show squares size based on previous variables.
var squareWidth;
var squareHeight;
function setup() {
// create the canvas
var canvas = createCanvas(windowWidth, windowHeight);
background(255,255,255);
// Move the canvas so it’s inside ... | true |
4dd8ece53d9a7ae1595a9797628dc2c7888ced8f | JavaScript | jlshaw117/leetcode | /medium/swap_node_pairs.js | UTF-8 | 910 | 3.5625 | 4 | [] | no_license | var swapPairs = function (head) {
let dummy = new ListNode(null);
if (head) {
dummy.next = head;
let preNode = dummy;
let currNode = head;
let nextNode = head.next;
while (currNode && currNode.next) {
currNode.next = nextNode.next;
ne... | true |
987a418dbe6f9857108dfd17769be01afcd6b7e4 | JavaScript | catherine-lim/js-prototypes | /js_oop/exercises/bankaccount.js | UTF-8 | 1,170 | 3.671875 | 4 | [] | no_license |
class Account{
constructor(){
this.moneyInAccount = 0;
//store the amount of money in the account
}
add(amount){
//add money to the amount stored in the account
//takes in an amount
//checks if it is actually a number greater than 0
//if not, return false
//adds it to the existing amount
//returns ... | true |
3d98e0857f0a9801fd341e1fb74ac3f607bc3725 | JavaScript | coderdiaz/forum-web | /middlewares/sessionPersisted.js | UTF-8 | 814 | 2.625 | 3 | [] | no_license | /**
* Middleware for persist session between pages.
* @param {Request} req
* @param {Response} res
* @param {NextFunction} next
*/
const sessionPersisted = (req, res, next) => {
const err = req.session.error;
const msg = req.session.notice;
const success = req.session.success;
const info = req.session.info... | true |
1cc166ceabbfd649deafe167d800f92028852ea0 | JavaScript | Qinzijian/Web | /jQuery/js/example.js | UTF-8 | 1,606 | 2.875 | 3 | [] | no_license | //注意:此案例运行在服务器端,不适用与浏览器静态运行
$(function(){
var times; //申明全局变量times
$.ajax({
beforeSend:function(xhr){
if(xhr.overrideMimeType){
xhr.overrideMimeType("application/json"); //设置MIME,防止错误
}
}
});
//从JSON文件中读取JSON数据
function loadTimetable() {
$.getJSON('../data/example.json') //调用e... | true |
4e35dfa82dd160adfade26f694d07aa9451f57d2 | JavaScript | yurybolbas/fc | /src/js/modules/errorHandler.js | UTF-8 | 1,115 | 2.8125 | 3 | [] | no_license | 'use strict';
export const Modal = (() => {
let instance,
divError;
let getModal = (errText) => {
let errItem = `<li>${errText}</li>`;
if (document.getElementById('error-popup')) {
divError = document.getElementById('error-popup');
let errList = document.getElementById('errors-list');
errList.innerHT... | true |
a914d8f4d06c379501bc0d3b177a9377b4137e95 | JavaScript | carolinezhao/Vue.js-learning | /vue-filter.js | UTF-8 | 1,596 | 3.875 | 4 | [
"Apache-2.0"
] | permissive | // Vue.js 允许自定义过滤器,可被用于一些常见的文本格式化。
// 过滤器可以用在两个地方:双花括号插值和 v-bind 表达式。过滤器应该被添加在 JavaScript 表达式的尾部,由“管道”符号指示。
// 可以在一个组件的选项中定义本地的过滤器:
// filters: {
// capitalize: function (value) {
// if (!value) return ''
// value = value.toString()
// return value.charAt(0).toUpperCase() + value.slice(1)
// }
// }
//... | true |
1b8a7e929a4d8bee7b3150bce112068fdaa70cad | JavaScript | marryabobora/SeguroDesemprego | /JS/calculadora_desemprego.js | UTF-8 | 9,799 | 3.984375 | 4 | [] | no_license | /* Calcular seguro desemprego
Salário:
solicitar : ultimo, penultimo e antepenultimo salario
fazer a media da soma de todos salarios (somar e dividir por 3)
se a média é abaixo de R$1599,61 > multiplicar por 0,8
se a média é entre R$1599,62 e R$2.666,29 > o que excede à R$1599,62 deve ser multiplica... | true |
365bdbabfec6fba580f3b2cddb2fbc7f2387e06c | JavaScript | Gumevil/Adavicity | /js/script.js | UTF-8 | 2,559 | 2.9375 | 3 | [] | no_license | var matrixopen = true;
var i = 0;
var matrixStringOut = "";
var matrixString = [];
for (i=0; i < 17; i++){
matrixString[i] = "";
}
var bitstring = "";
var eight = 0;
var bit;
var z = 0;
var i = 0;
window.onload = function(){
genMatrix();
makeMatrix();
slideIn();
//rainMatrix();
}
window.onmouseout = function(){
... | true |
c9803eaaec0de10377459407f8bc7e1934860bea | JavaScript | LudoBermejo/willikins | /src/utils/detection.js | UTF-8 | 1,307 | 2.53125 | 3 | [] | no_license | const WordPOS = require('wordpos');
const Q = require('q');
const wordpos = new WordPOS();
module.exports = function (skill, info, bot, message, action) {
const defer = Q.defer();
message.text = message.text.split('-').join('joiningbyhand');
wordpos.getPOS(message.text, (result) => {
let client;
let ba... | true |
64af49b29deaf4c9fbabe610b6b642d56fa560cb | JavaScript | ixan29/LOG4420 | /client/src/ProductComponent/ProductComponent.js | UTF-8 | 4,208 | 2.53125 | 3 | [] | no_license |
import '../css/App.css';
import {Header} from "../_Common/Header.js"
import {Footer} from "../_Common/Footer.js"
import {useParams} from "react-router-dom";
import {imageMap} from "../ProductsComponent/ProductImageLoader";
import { useEffect, useState } from 'react';
import { addShoppingCartItem } from "../ShoppingCar... | true |
55b8c6ebcd735c8f873f96de0b67dcdcc44b6ef2 | JavaScript | andrei-coman/2d-graph-visualiser | /javascript/index.js | UTF-8 | 1,217 | 2.6875 | 3 | [
"MIT"
] | permissive | function ElemId(id){
return document.getElementById(id);
}
function CropPX(str){
return str.substring(0, str.length - 2);
}
var ctx = ElemId("canvas").getContext("2d");
var sWidth, sHeight;
var cWidth, cHeight;
function resize(){
sHeight = window.screen.height;
sWidth = window.screen.width;
cWidth ... | true |
b9ec7ccbd58da6449cdd398726fda498db52f44d | JavaScript | Stompke/deep-weather-app | /src/components/FavoriteCityCard/FavoriteCityCard.js | UTF-8 | 2,441 | 2.546875 | 3 | [] | no_license | import React, {useState, useEffect, useContext} from 'react';
import UserContext from '../../utils/MyContext'
import axios from 'axios';
import { Link } from 'react-router-dom';
import {Title, Temp, CardContainer, RemoveButton} from '../FavoriteCityCard/FavoriteCityCardStyles';
import { FaBan } from "react-icons/fa";
... | true |
68a553e6bd98edf93843596a75c5ae94c50cb87c | JavaScript | winixt/algorithm | /interesting/chapter2/minSpanningTree/kruskal.js | UTF-8 | 1,925 | 3.46875 | 3 | [] | no_license | // 最小生成树之 kruskal 算法
const quickSort = require('./quickSort');
const data = [
{u: 1, v: 2, w: 23},
{u: 1, v: 6, w: 28},
{u: 1, v: 7, w: 36},
{u: 2, v: 3, w: 20},
{u: 2, v: 7, w: 1},
{u: 3, v: 4, w: 15},
{u: 3, v: 7, w: 4},
{u: 4, v: 5, w: 3},
{u: 4, v: 7, w: 9},
{u: 5, v: 6, w: ... | true |
217f444e4428f256ad09834876adbb70071fb1de | JavaScript | fe-room/gulp-project | /src/index.js | UTF-8 | 107 | 2.671875 | 3 | [] | no_license | const a = 5;
const b = 6;
function add(a, b) {
return a + b
}
function reduces(a, b) {
return a - b
}
| true |
9e06d9559facab87ed0648b8f9ca808bedecbce4 | JavaScript | jmlweb/ramdu | /src/propIsTruthy.js | UTF-8 | 475 | 3.015625 | 3 | [
"MIT"
] | permissive | import { propSatisfies } from 'ramda';
import isTruthy from './isTruthy';
/**
* Check if one property is truthy in the object provided as argument
*
* @function
* @param {String} propName - The name of the prop
* @param {Object} obj - The object provided
* @returns {Boolean}
*
* @example
* propIsTruthy('a', ... | true |
98067145824045ef49a3b6869292468928ae00a7 | JavaScript | ngryman/phoenix-config | /actions/resize-in-grid.js | UTF-8 | 614 | 2.71875 | 3 | [] | no_license | export default function resizeInGrid(direction) {
const window = Window.focused()
const frame = window.safeGridFrame()
const gframe = window.grid().frame()
const nextFrame = {
x: frame.x,
y: frame.y,
columns: direction === 'narrower'
? Math.max(1, frame.columns - 1)
: direction === 'wid... | true |
49ab4f23cd60a71bb86da2b97d67f446056962b3 | JavaScript | niklasschjoldager/12c_03_01_advanced_animation_project | /js/configurator/components/colors.js | UTF-8 | 4,056 | 2.890625 | 3 | [] | no_license | export function colors() {
colorButtons();
paintElements();
console.log("Colors component is loaded...");
}
const settings = {
pickedColor: "#FF0000",
colors: [
"#FF0000", //
"#FF8000",
"#FFFF00",
"#00FF00",
"#00FF80",
"#00FFFF",
"#0080FF",
... | true |
27dd07ab6b7acd657400ee785664de06c2c7eb74 | JavaScript | michalalafi/TimelineVisulation | /src/js/auxiliary/QuestionTool.js | UTF-8 | 12,538 | 2.65625 | 3 | [] | no_license | /**
* @author Michal Fiala
* Tool for track user activities while searching for answer
* @version 1.0
*/
define([
'cz/kajda/common/Observable',
'../../data/questions',
],
function(Observable, __questionsData) {
var QuestionTool = new Class("QuestionTool", {
_extends : Observable,
_... | true |
14a43ec247709a8f6a3be350b738a5fec63537ba | JavaScript | LWu93/Leslies-Algo-Practice | /Leetcode/June2020MonthyChallenge/#17-surroundedRegions.js | UTF-8 | 868 | 3.421875 | 3 | [] | no_license | var solve = function(board) {
if(!board.length) return;
for(let i = 0; i < board.length; i++){
dfs(board, i, 0)
dfs(board, i, board[0].length-1)
}
for(let i = 0; i < board[0].length-1; i++){
dfs(board, 0 , i);
dfs(board, board.length-1, i)
}
for(let i = 0; i < board.length; i++){
... | true |
6bc5204b7acb1c35aa2ea9a0a9ab71bceb082722 | JavaScript | lbarnes86/employee-directory | /src/App.js | UTF-8 | 2,304 | 2.703125 | 3 | [
"MIT"
] | permissive | import React from "react";
import Container from "./components/Container";
import Footer from "./components/Footer";
import Header from "./components/Header";
import SearchBox from "./components/SearchBox";
import SearchResults from "./components/SearchResults";
import API from "./utils/API";
import "./App.css";
class... | true |
2349fd755f20c99699a63c5d725750d37cece2f1 | JavaScript | theBoySamm/todos | /app.js | UTF-8 | 881 | 2.5625 | 3 | [] | no_license | //jshint esversion6
const express = require('express');
const ejs = require('ejs')
const app = express();
app.set('view engine', 'ejs')
app.use(express.urlencoded({extended: false}))
app.use(express.static('public'))
app.get('/', function(req, res){
res.render('home', {title: "Homepage"})
})
app.p... | true |
9236e905ee1c639acb89f73443feaef7ece5012e | JavaScript | kennja05/recursion-lab-nyc-web-120919 | /index.js | UTF-8 | 1,061 | 3.953125 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution here!
function printString(myString) {
console.log(myString[0]);
if (myString.length > 1) {
let mySubString = myString.substring(1, myString.length);
printString(mySubString);
} else {
return true;
}
}
function reverseString(string){
return string === '' ? '... | true |
ab0b1faa7cc37c96fdbadf12a2619bbaccb05c54 | JavaScript | hrigu/checkboxes | /spec/spec.js | UTF-8 | 9,864 | 2.640625 | 3 | [] | no_license | (function() {
describe("class CheckboxGroup", function() {
var artischokken, checkboxGroup, knoblauch, peperoni;
checkboxGroup = null;
artischokken = null;
peperoni = null;
knoblauch = null;
beforeEach(function() {
var desc, parser;
desc = [
{
name: "Artischokken... | true |
707e8f3eb018bed2ccbe024248a531ea78734e64 | JavaScript | shruti-agrawal-000/Fe-doloscenes_A-_Health_Care_App | /controllers/product.controller.js | UTF-8 | 3,175 | 2.578125 | 3 | [] | no_license | const Products = require("../models/products.model");
// const jwt = require("jsonwebtoken");
const bcrypt = require("bcryptjs");
const addProduct = async (request, response) => {
console.log("wwwwww");
const { name, details,image,usage,companyAvailable,pros,cons } = request.body;
console.log("body", req... | true |
912873230690d92b7c8fb2992dbf1fe08a9c95c2 | JavaScript | deltamaze/ProductivitySite | /react/codeScratchPad/test.js | UTF-8 | 293 | 3.65625 | 4 | [] | no_license | /* eslint-disable no-console */
const input = '156 178 165 171 187';
const splitInput = input.split(' ');
let count = 0;
let sum = 0;
splitInput.forEach((number) => {
count += 1;
sum += parseInt(number, 10);
});
const result = sum / count;
console.log(parseInt(result, 10));
// 171
| true |
e02ff3aee185fe280425b81f6bab5286882b86b5 | JavaScript | josebeneitezperez/JavaScriptEj2 | /scripts.js | UTF-8 | 3,743 | 2.921875 | 3 | [] | no_license | function comprobarDni(){
var numero = document.getElementById("dni").value;
text="El DNI es inválido"
if (/^\d{8}$/.test(numero)) {
var letra = document.getElementById("dniLetra").value;
if (letra.toUpperCase() == 'TRWAGMYFPDXBNJZSQVHLCKET'.charAt(numero%23)) {
//text = "El DNI es válido"
text = ""
... | true |
b5fda60108bbd8a0f4b13cd5d7a48a927303e2ff | JavaScript | berheg/hyf-homework | /javascript/javascript2/week3/funnyJoke/main.js | UTF-8 | 340 | 2.9375 | 3 | [] | no_license | function jokeCreator(shouldTellFunnyJoke,logFunnyJoke,logBadJoke){
if(shouldTellFunnyJoke){
logFunnyJoke();
}else{
logBadJoke();
}
}
function logFunnyJoke(){
console.log('My boss told me to have a good day.. so I went home.')
}
function logBadJoke(){
console.log('No bad joke for toda... | true |
7f0c023a2384a7544f370272188de1757f3ef35f | JavaScript | sanika-nikam/nikam-sanika-webdev-project | /public/project/views/hotel/restaurant.controller.client.js | UTF-8 | 6,571 | 2.5625 | 3 | [] | no_license | (function() {
angular
.module("Foodster")
.controller("RestaurantController", RestaurantController);
function RestaurantController($location,$routeParams,UserService,RestaurantService){
console.log("Reached rest controller");
var vm = this;
var restaurantId = $... | true |
9c21ef41c25d1f6730c1740f9fb04a18ca28a789 | JavaScript | eddielok/WheelChair | /wwwroot/js/shared/handlePicture.js | UTF-8 | 710 | 2.703125 | 3 | [
"MIT"
] | permissive | export default async function handlePicture(picLink, defaultPicture, stateName, callBack) {
loadImage(picLink)
.then(img => callBack(stateName, picLink))
.catch(error => callBack(stateName, handleReply2Caller(defaultPicture)));
}
function handleReply2Caller(defaultPicture) {
switch (defaultPict... | true |
f09a075752cd1040d04ab27ba9de9853370709d5 | JavaScript | egrotzke/tic-tac-torus | /app.js | UTF-8 | 5,294 | 2.921875 | 3 | [] | no_license | const http = require('http');
const fs = require('fs');
const path = require('path');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
console.log('Requesting', req.url);
var filepath = (req.url == '/' ? 'index.html' : req.url);
fs.readFile('./public/' + filepa... | true |
dade63969eebaea7796bb47f258ddc6cd0e172a9 | JavaScript | katiuskamartinez/mini-sitio-practicas | /seccion_dos.js | UTF-8 | 1,447 | 3.078125 | 3 | [] | no_license | export default function personaje(){
let producto={
name:'Nutella',
lasName:'Ferrero',
bio:'Nutella es una marca de crema de chocolate y avellana endulzada elaborada por la empresa Ferrero que fue introducida por primera vez en 1965.',
avatar:'./assets/nutella.jpg',
coun... | true |
4dbb17c40540bc6f0d8def53d65c9b42f6bdea5e | JavaScript | technologyreview/technologyreview.github.io | /Fairness/graph1.js | UTF-8 | 970 | 3.109375 | 3 | [] | no_license | // max-width: 878 px
function drawGraph1() {
// create svg
var svgHeight = 220 // height of svg
var svg = createSVG(svgHeight)
// variables
var ncols = 40
var bucketMargin = bucketWidth/12
var spacing = bucketMargin/2.5
var d = (bucketWidth - 2*bucketMargin - 4*spacing)/5 // compute diameter dynamically
d =... | true |
c07f1099c0e085833b24af375de4a234d5c61d86 | JavaScript | g00dman5/freemouthmedia | /app/containers/DashboardContainer/index.js | UTF-8 | 1,803 | 2.640625 | 3 | [
"MIT"
] | permissive | /*
*
* DashboardContainer
*
*/
import React from 'react';
import Helmet from 'react-helmet';
export default class DashboardContainer extends React.PureComponent {
constructor(props){
super(props);
this.state = {
title:"",
body:"",
image:"",
preview:"",
}
}
handleTitle =... | true |
d263ab9567ce18339211ad695fd0cbd94b977258 | JavaScript | Ang-YC/scatter-plot-vr | /components/custom-button.js | UTF-8 | 1,387 | 2.828125 | 3 | [] | no_license | /* global AFRAME, THREE */
/**
* Handles events coming from the hand-controls.
* Determines if the entity is grabbed or released.
* Updates its position to move along the controller.
*/
AFRAME.registerComponent('custom-button', {
init: function () {
this.SPIN_STATE = 'SPIN';
this.onButtondown =... | true |
e168281e864f95e9627fa12d18f0c43422a3b457 | JavaScript | MGN00150905/Multiplayer-Canvas-App-using-Node.js-and-p5- | /public/sketch.js | UTF-8 | 713 | 3.5625 | 4 | [] | no_license | // Declar variable to keep track of our socket connection
var socket;
function setup() {
createCanvas(600, 400);
background(0);
function draw() {
textSize(21);
fill(0, 102, 153);
text("Multiplayer Canvas App",0,20);
}
function mouseDragged() {
// Draw some white circles
fill(255,0,0);
noStroke();
e... | true |
7d7e828ca232dc7b767efacfb1b5f383b1cd8d92 | JavaScript | NextChampion/BarrageDemo | /BarrageExample/src/components/BarrageView.js | UTF-8 | 3,617 | 2.6875 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import { StyleSheet, View, DeviceEventEmitter } from 'react-native';
import PropTypes from 'prop-types';
import BarrageMovableItem from './BarrageMovableItem';
export default class Barrage... | true |
a72e9f34f572f112d8913efec853e2e801230b21 | JavaScript | csherpa/csherpa.github.io | /studies/string-manipulation.js | UTF-8 | 2,548 | 4.9375 | 5 | [] | no_license | /*
* STRING MANIPULATON
*
* 0. Comparison operators can be used on string values but string also work with concatenation (+).
* There are two operators which can be used for string manipulation.
* 1. With Operators
* - Concatenation operator (+) Combines two or more strings into one new result string.
* - The sh... | true |
f94b5d81a91b3912a69880279c46c49dc4b2e49c | JavaScript | Jozefw/weeklyCoderByte | /wordCount.js | UTF-8 | 118 | 2.921875 | 3 | [] | no_license | function wordCount(str) {
var solution = [];
solution = str.split(" ").length;
}
wordCount("this is a sentence"); | true |
f365943ce6731b152ccf25cec8085de8ce31b691 | JavaScript | moolen/bent | /build/envoy-authz/app.js | UTF-8 | 631 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | const express = require('express')
const auth = require('basic-auth')
const app = express()
const port = 8080
app.use((req, res, next) => {
console.log(req.path)
console.log(req.headers)
if (req.path == "/healthz"){
res.status(200)
res.end('OK')
return
}
const creds = auth(req)
if (!creds) {
... | true |
a0b74a370c82c52a98f68b8d664b7b86b10f4ad4 | JavaScript | imagineLife/nodeWork | /in-depth/child-process/with-docs/2/f3.js | UTF-8 | 207 | 2.75 | 3 | [] | no_license | const { spawnSync } = require('child_process');
const RUN_STR = `setTimeout(() => { console.log('done?')}, 1200)`
const res = spawnSync(process.execPath, ['-e', RUN_STR]);
console.log(res.stdout.toString()) | true |
71da79c1a64aa0598f19bdabeafc5a1f42160f54 | JavaScript | gileduardo/apps-native | /megasena/App.js | UTF-8 | 4,043 | 2.90625 | 3 | [] | no_license |
import React from 'react';
import { StyleSheet, View, Button, ScrollView, Alert } from 'react-native';
import Header from './src/components/Header';
import ButMatrix from './src/components/ButMatrix';
import NumberPanel from './src/components/NumberPanel';
export default class App extends React.Component {
cons... | true |
c17130b17a739c70f074c89809d6203607a1e072 | JavaScript | eharley19/bamazon | /bamazonCustomer.js | UTF-8 | 3,251 | 2.6875 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var db = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "myPassword1234*",
database: "bamazon_db"
});
db.connect(err => {
if (err) throw err;
console.log("Welcome to Bamazon!");
queryProducts();
});
func... | true |
e7194e178c38fd928a67c6d401a0f2322e7d69cc | JavaScript | nss-day-cohort-44/hello-world-the-teal-archipelago | /scripts/index/landmarks/IsraelLandmarksDataProvider.js | UTF-8 | 1,238 | 2.515625 | 3 | [] | no_license | const israelLandmarkCollection = [
{
name: "The Dead Sea",
image: "https://images.unsplash.com/photo-1529066516367-36973222c957?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80",
description: "The Dead Sea is the lowest point on Earth. Filled with salt, it is impossi... | true |
cdeaba0629384bb0fb1d1eb90a0cf67f75e58647 | JavaScript | holidaycheck/car_pooling_bot | /test/getTimeOfDate.test.js | UTF-8 | 399 | 2.65625 | 3 | [] | no_license | const {getTimeOfDate} = require('../includes/functions');
describe('tests of getTimeOfDate function', () => {
it('Should return true', () => {
const currentDate = '2020-05-19';
const currentTime = getTimeOfDate(currentDate);
let expected = new Date(Date.now());
expected.setHours(0, 0, 0, 0);
exp... | true |
f96896bfd782935ccb003aa587f70e3ecbf82eb7 | JavaScript | NitishPuri/ProcessingExperiments | /source/NOC/08/tree_stochastic/sketch.js | UTF-8 | 1,004 | 2.96875 | 3 | [
"MIT"
] | permissive |
var theta = 0;
var yOff = 0;
var seed = 42;
function setup() {
createCanvasCustom();
smooth();
// newTree();
}
function draw() {
background(255);
fill(0);
stroke(0);
translate(width / 2, height);
yOff += 0.005;
randomSeed(seed);
branch(200, 0);
// noLoop();
}
function mousePressed() {
yOff ... | true |
764deb7dd16e43383610b60680968fd44f715fef | JavaScript | f3c0/GOC2016 | /src/public/js/communication/datamanager.js | UTF-8 | 1,046 | 2.59375 | 3 | [] | no_license | define(['communication/socket'], function(SocketHandler) {
function dataManager() {
this.master = false;
this.socketHandler = new SocketHandler();
this.init();
}
dataManager.prototype.init = function() {
var connectionPromise = this.socketHandler.connect();
connectionPromise.then(function() {
this.soc... | true |
fed7212a57a1c41141a9904ea655f02a3392bcad | JavaScript | vidalab/isender | /isender.js | UTF-8 | 1,734 | 2.875 | 3 | [] | no_license | // Iframe data post - client (external sites)
// Usage:
// var sender = new Vida.ISender('targetIframeId')
// sender.postRender(newJSONDataObj)
DEFAULT_ORIGIN = 'https://vida.io'
RENDER_CALLBACK_NAME = 'renderData'
POST_DATA_MESSAGE_TYPE = 'postData'
CALLBACK_MESSAGE_TYPE = 'runCallback'
// Vida iframe sende... | true |
f5aa18ae3132f40254083f8aa1e48e4fbaceb256 | JavaScript | sm1987/javascript | /song.js | UTF-8 | 593 | 2.984375 | 3 | [] | no_license | "use strict";
var favouriteSong = "Love the way you lie";
var released = "June 25, 2010";
var studio = {
1 : "Effigy",
2 : "Fernade",
3 : "Michigan Sun",
4 : "Dublin",
5 : "Ireland"
}
var genre = "Hip Hop";
var length = 4.23;
var label = {
1 : "Aftermath",
2 : "Shady",
3 : "Interscope"
... | true |
045c3ba64a0e68e8baec52aa309f7847aecade53 | JavaScript | n4vdeep/PHP-reCaptcha-Mail-Script | /main.js | UTF-8 | 889 | 2.625 | 3 | [
"MIT"
] | permissive | //This script adds the array messages to the front end
//IF YOU CHANGE <FORM #ID> THEN PLEASE UPDATE THE #ID ON THIS SCRIPT
jQuery(function ($) {
'use strict';
//Update this ID if you change the form ID
$('#contactForm').on('submit',function(e){
e.preventDefault();
var $action = $(this).p... | true |
1b099412e0ed1078e41b298145ce45e735d6750a | JavaScript | ushockit/js-spv | /Lesson 09/js/script-fetch.js | UTF-8 | 595 | 3.0625 | 3 | [] | no_license | (async function(){
// try {
// const response = await fetch('https://jsonplaceholder1.typicode.com/posts?userId=1');
// } catch(err) {
// console.log('Error', err);
// }
// fetch('https://jsonplaceholder.typicode.com/todos/1')
// .then(async (resp) => {
// if (resp.st... | true |
d0c5fae322047705e5064aff3426b682be3239f0 | JavaScript | NathanNhan/Todo-App | /src/App.js | UTF-8 | 1,673 | 2.546875 | 3 | [] | no_license | import {useReducer,useState} from 'react'
import Todolist from './components/Todolist';
import Todoinput from './components/Todoinput';
import "bootstrap/dist/css/bootstrap.min.css";
import { v4 as uuidv4 } from 'uuid';
import React from 'react'
export default function App() {
const [name, setName] = useState('');... | true |
3e0c6a7e15f814eb571db3e7f9e115b0e4f83a71 | JavaScript | MatthewTroke/react-task-list | /src/components/Input.js | UTF-8 | 1,079 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
class App extends Component {
state = {
title: '',
description: ''
}
onTitleChange = (e) => {
this.setState({title: e.target.value})
}
onDescriptionChange = (e) => {
this.setState({description: e.target.value})
}
render() {
return (
<... | true |
746b55715ae2a01c76df3419ca03f90b13e4987f | JavaScript | lexhaynes/catdish | /src/components/SelectedFiltersDisplay.js | UTF-8 | 2,550 | 2.734375 | 3 | [] | no_license | import Btn from '@components/Btn'
import {capitalize} from '@utils/misc'
import {
useSelectedFiltersState,
useSelectedFiltersUpdate
} from '@context/selectedFilters'
//format the language on the filter button label
const FormatBtnLabel = ({category, filter}) => {
let subject = '';
let verb = '';
let obje... | true |
9441f011bc43a903e7caff86abdcfa0b7607e694 | JavaScript | qd-hacker/Function-encapsulation | /贪吃蛇/drag.js | UTF-8 | 988 | 3.09375 | 3 | [] | no_license | (function(window){
function Drag(id){
this.ele = document.getElementById(id);
this.disX = 0;
this.disY = 0;
this.fnDown();
}
Drag.prototype.fnDown = function(){
var that = this;
this.ele.onmousedown = function(e){
//当鼠标按下
e = e || event;
... | true |
111cf1157c97037c893d27dbe9a7d059f3110ca8 | JavaScript | vcz-fr/apps | /app/feedback/script.js | UTF-8 | 1,258 | 2.8125 | 3 | [] | no_license | const _q = id => (v = new URLSearchParams(window.location.search).get(id), v === "" ? null : v);
const _id = id => document.getElementById(id);
const _r = msg => _id("response").value = msg;
const _notif = msg => _r(`[INFO] Error: ${msg}`);
const _block = disable => _id("action-send").disabled = disable;
const send = ... | true |
94e90aef548ae5272a7eaf916209695134befcf9 | JavaScript | haronSilva/CursoWebModerno2019Udemy | /exercicios-web/funcao/funcaoConstrutora.js | UTF-8 | 897 | 4.09375 | 4 | [] | no_license | /**
* Como criar uma função construtora
*/
function Carro(velocidadeMaxima = 200, delta = 5){
//variáveis privadas no javascript - Forma de não conseguir acessa-las de fora.
let velocidadeAtual = 0
//Método público que poderá ser acessado de fora!
this.acelerar = function (){
if(velocida... | true |
d8cc0b8122e3b046b153801dc589f4d43d5b6e1f | JavaScript | MarlonFerreira/electron | /renderer.js | UTF-8 | 2,104 | 2.78125 | 3 | [] | no_license | const { remote } = require('electron')
const Mousetrap = require('mousetrap')
const path = require('path')
const mainWindow = remote.BrowserWindow.getFocusedWindow()
let minimizar = document.getElementById('minimizar')
let maximizar = document.getElementById('maximizar')
let fullscreen = document.getElementById('fulls... | true |
8bd05bec1b0bad7f97e5d644cdb04201b130106d | JavaScript | Glints-Academy/remdial-batch11 | /level-1/duplicateTheArray/index.js | UTF-8 | 712 | 3.328125 | 3 | [] | no_license | function duplicate(array) {
// code here
}
// do not change this code below
const test = (testCase, result) => {
if (testCase && testCase.length) {
testCase.sort();
result.sort();
for (let i = 0; i < testCase.length; i++) {
if (testCase[i] !== result[i]) {
return consol... | true |