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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2bf4b32a18968203ebaddb1b0297ae3ebcf894b1 | JavaScript | osulyanov/apelsintm_extension | /options.js | UTF-8 | 1,656 | 3.265625 | 3 | [
"MIT"
] | permissive | // Saves options to chrome.storage
function save_options() {
var is_on = document.getElementById('is_on').checked;
var interval = document.getElementById('interval').value;
var step = document.getElementById('step').value;
var storage_options = {
is_on: is_on,
interval: interval,
... | true |
a7d5aed555d899b9091166e9a53bfc1fcb70ab0d | JavaScript | scirelli/adventofcode.com | /2016/day/19/solution_part2b.js | UTF-8 | 262 | 3.0625 | 3 | [] | no_license | (function(){
'use strict';
var input = 3014387,
exampleInput = 5,
counter = 1;
while(exampleInput > 2){
exampleInput = Math.floor(exampleInput/2);
counter++;
}
console.log(counter);
})();
| true |
a5a8e11f308abe50d8f1b485f3e1113ef656c230 | JavaScript | Jeff-Moraes/m1-w1-assessment | /starter-code/src/assessment1.js | UTF-8 | 1,940 | 4.53125 | 5 | [] | no_license | // Write a function that returns the product of 2 numbers
function product(x, y) {
//
if (typeof x !== "number" || typeof y !== "number") return false;
return x * y;
}
// Write a function that returns whether a given number is even
function isEven(num) {
//
if (num % 2 === 0) {
return true;
}
return... | true |
abb3397608546a2cf9a51c43a8cda7141603a2f3 | JavaScript | brunormferreira/ilegra | /trilha-frontend-2019/bruno-ramires/works/helpjs-exercises/exercise-38/script.js | UTF-8 | 310 | 3.390625 | 3 | [] | no_license | var deuses = ['Aegir', 'Aud', 'Balder', 'Bragi', 'Búri', 'Dag', 'Dellingr']
const lista = document.getElementById('nomes');
for (let i = 0; i < 6; i++) {
lista.innerHTML += `<li>${i + 1} ${deuses[i]}</li>`;
}
// ${i + 1} = acessa o index do array; (key)
// o ${deuses[i]} acessa o valor do array; (value) | true |
d639af72df143abcca1ac1b0218651368be93318 | JavaScript | kyohei8/NoC-pixijs | /app/scripts/chapter10/percepron.js | UTF-8 | 779 | 3.09375 | 3 | [] | no_license | import _ from 'lodash';
/**
* Percepron
*/
class Percepron{
constructor(n){
// 重みをランダムに作成
this.weights = _.range(n).map((r) => _.random(-1, 1, true));
// 学習定数
this.c = 0.00001;
}
feedforward(inputs){
const sum = inputs.map((input, i) => {
return input * this.weights[i];
}).reduce(... | true |
d70eb5ba1932bb9eb2c06ee00bb917e7d4d03a16 | JavaScript | Bornholm/sidekick | /examples/createjs/grid/states/load.js | UTF-8 | 1,872 | 2.515625 | 3 | [] | no_license | (function() {
var ASSETS = [
{ src: 'assets/fonts/abstract.ttf' },
{
src: 'assets/sprites/red_bike.png',
id: 'red_bike',
data: {
frames: {width: 16, height:32, regX: 8, regY: 32},
animations: {
idle: [0,15]
}
}
}
];
var LoadState = Sidekick.entity({
initialize: function() ... | true |
7dcd411b1c822402b0689d57801a7677c2725ea6 | JavaScript | din982/css3-flashes | /demo/js/demo.js | UTF-8 | 1,674 | 2.953125 | 3 | [] | no_license | //---------------------------------------------------
// Javascript for Demo Page only. See application.js.
//---------------------------------------------------
var slideDown = function(pos){
$('.flash_message').animate({ marginTop: 0 });
};
var slideUp = function(closePos, btnID){
$('.flash_message').animate({ m... | true |
829c52d9f763546682e872e44fe1484734a2e3ef | JavaScript | onpaik/umi-lib-paik | /packages/paik-utils/es/change/strToNumber.js | UTF-8 | 598 | 2.640625 | 3 | [
"ICU"
] | permissive | define(["exports"], function (_exports) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.default = _exports.strToNumber = void 0;
/**
* 转换对象中属性值中的字符串为数字
* @param {*} obj 对象
*/
var strToNumber = function strToNumber(obj) {
var newObj = obj;
Objec... | true |
4d63ddb6a4463a61af51c99ffdc86f8bf4419b16 | JavaScript | mrbontor/detector_arp | /public/timer.js | UTF-8 | 492 | 3.078125 | 3 | [] | no_license | 'use strict';
var heading = document.querySelector('h1');
function pollDashServer(){
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (req.readyState == 4) {
heading.textContent = req.responseText;
if(req.responseText === 'true'){
document.body.classList.add('truthy');
}
els... | true |
ee3b09bed25cb918a29ad956ccb72a6fe3def939 | JavaScript | rebeccaruva/rebeccaruva.github.io | /portfolioScript.js | UTF-8 | 8,858 | 2.6875 | 3 | [] | no_license | //copy email address when click (in case mailto: does not work)
let emailLink = document.getElementById("email");
emailLink.addEventListener('click', function(event) {
let mail = "bexbuildsfun@gmail.com";
navigator.clipboard.writeText(mail);
alert(mail + " copied to clipboard.");
});
//mobile display
func... | true |
fc862963b09a7dd9c372893347a927f7b8add4d4 | JavaScript | gao351306708/FourteenWeb | /src/config/methods.js | UTF-8 | 2,092 | 2.8125 | 3 | [] | no_license | /**
* Created by gaoju on 2018/10/25.
*/
//var base = new Base64();
/*
* 对象值解码
* */
export function decodeData(data){
if(typeof data == 'object'){
for (let key in data){
data[key] = Base64.decode(data[key])
}
}
console.log(data)
}
export function toJson(str){
if(!str || typeof(str)!='string')... | true |
459eba9a7bb44fedaef4c1a59e4251bd234c4b8d | JavaScript | paychilo/java | /js_l4/script.js | UTF-8 | 4,628 | 3.40625 | 3 | [] | no_license | // let options = {
// width: 1024,
// height: 1024,
// name: 'test'
// };
// options.bool = false;
// options.colors = {
// border: 'black',
// bg: 'red'
// };
// delete options.bool;
// for (let key in options) {
// console.log('Свойство ' + key + " Имеет значение " + options[key])
// ;}
// console.... | true |
93fd7f4554fd7cac1e80c507d861c2477aa64b36 | JavaScript | BlackCubes/Film-Ticket-Website | /public/js/login.js | UTF-8 | 5,210 | 2.515625 | 3 | [
"MIT"
] | permissive | /* eslint-disable */
import axios from 'axios';
import { showAlert } from './alerts';
export const login = async (email, password) => {
try {
const res = await axios({
method: 'POST',
url: '/api/v1/users/login',
data: {
email,
password
}
});
if (res.data.status ==... | true |
0ad32f3fbca1050429deb34bbeb410b530c2aeda | JavaScript | PeteJBB/spider-web | /SpiderWeb/scripts/src/utility.js | UTF-8 | 355 | 2.65625 | 3 | [] | no_license | (function (Utility) {
Utility.getForwardVector = function (radians) {
return {
x: -Math.sin(radians),
y: Math.cos(radians)
}
},
Utility.getRandomColor = function () {
var c = [Math.random(), Math.random(), Math.random(), 1];
return c;
}
}(window.... | true |
53664a99f16ac3f4160430881d8805b8414e8330 | JavaScript | ThiagoMustafa/js-studies | /code-samples/array/resize-or-empty-an-array.js | UTF-8 | 354 | 3.359375 | 3 | [] | no_license | let entries = [1, 2, 3, 4, 5, 6, 7]
console.log(entries.length, "Length original")
console.log(entries, "Array before resize")
entries.length = 4
console.log(entries.length, "Length after resize")
console.log(entries, "Array after resize")
entries.length = 0
console.log(entries.length, "Length after empty")
console.... | true |
e57f7d30a0522713742ea1dea32abfd3545a2bc1 | JavaScript | michaelcoitim/CursoEmVideoJS | /exe16/script.js | UTF-8 | 976 | 3.53125 | 4 | [] | no_license | function Contar(){
var n1 = window.document.getElementById('txtnum1')
var n2 = window.document.getElementById('txtnun2')
var passo = window.document.getElementById('txtpasso')
var res = window.document.getElementById('res')
res.innerHTML='Contando:'
if(n1.value.length==0){
alert('inicio... | true |
713bbbca3606c4e0be8ecc18cdfb8aaa54f46071 | JavaScript | chenjenny/mmp210 | /week3/sketch.js | UTF-8 | 7,031 | 2.671875 | 3 | [] | no_license | function setup() {
createCanvas(640, 480);}
function draw() {
background("Azure")
var name = "JENNY'S"
var box1 = "P";
var box2 = "O";
var box3 = "H";
var box4 = "S";
var box5 = "T";
var box6 = "E";
var box7 = "P";
var round = 60;
var round1 = 55;
var round2 = 20... | true |
904f413a30322a60a7b1cb8adade8c37053d9144 | JavaScript | maddenp/euler | /p/js/039.js | UTF-8 | 598 | 3 | 3 | [] | no_license | /* jshint node: true */
/* jshint esversion: 6 */
"use strict";
const pm = require('./pm');
var solutions = [];
var limit = 1000;
for (var i = 0; i <= limit; i++) solutions[i] = 0;
for (var a = 1; a <= limit - 2; a++) {
for (var b = a; b <= limit - a; b++) {
var c = pm.hypotenuse(a, b);
var perimeter = a... | true |
eab1b35c1a64f389318db1dea24ec2a8a0e20a8a | JavaScript | imki123/hello-react | /src/component/Counter.js | UTF-8 | 1,120 | 2.921875 | 3 | [] | no_license | import React, { useState} from 'react';
function Counter() {
const [number, setNumber] = useState(0)
const [form, setForm] = useState({
name: 'your name',
gender: 'your gender'
})
const {name, gender} = form
const handleKeyPress = e => {
if(e.key ==='Enter'){
... | true |
7931f4bdaacca5ccc26aee58d3724304c1cf3791 | JavaScript | ltlt4/Cashier | /Theme/script/common.js | UTF-8 | 24,121 | 2.71875 | 3 | [] | no_license | var cashier = {
open: function (element, animation1, animation2, mask) {
$(element).removeClass(`animated ${animation2}`);
$(element).addClass(`animated ${animation1}`);
$(element).show()
$(mask).show()
},
close: function (element, animation1, animation2, mask, mask2) {
if (!mask2) {
mask2 = nul... | true |
7616b3ee4d16fee23334b280de3eaaaf8b009a66 | JavaScript | merl-in/shoppingBasket | /app.js | UTF-8 | 4,250 | 2.78125 | 3 | [] | no_license | var showProd = document.getElementById('showProd');
var productList = document.getElementById('productList');
var shoppingBasket = document.querySelectorAll('.fa');
var row = document.querySelectorAll('.row')[0];
var totalCost = document.getElementById('totalCost');
var basketText = document.getElementById('basketText'... | true |
cd6c6b7e89e2f2b71dfdbd7166cbd389686008fa | JavaScript | wajahatabbas27/React-netlify-function-serverless | /src/App.js | UTF-8 | 383 | 2.734375 | 3 | [] | no_license | import { useEffect, useState } from 'react';
import './App.css';
function App() {
const [data, setData] = useState("");
useEffect(() => {
fetch(`/.netlify/functions/hello`)
.then(response => response.json())
.then(data => setData(data));
}, [])
console.log(data)
return (
<div >
He... | true |
5fba51f21f1b2d745c1964432bd702e8710dda43 | JavaScript | kat3samsin/connect4 | /src/reducers/GameReducer.js | UTF-8 | 924 | 3.28125 | 3 | [] | no_license | const initialState = {
board: [],
rows: 6,
cols: 7,
player: 1,
winner: 0,
cellsToWin: 4
};
const GameReducer = (state = initialState, action) => {
switch (action.type) {
case 'INIT':
let board = initBoard(action.rows, action.cols);
return Object.assign({}, state, {
board: board,
... | true |
23a9779184a94b4cfbe7f7a6236421d6e536347c | JavaScript | clhurlbut/team_profile_generator | /__tests__/Employee.test.js | UTF-8 | 1,428 | 3.453125 | 3 | [
"MIT"
] | permissive | const { test, expect } = require("@jest/globals");
const Employee = require("../lib/Employee");
test("Creates a new Employee object", () => {
const employee = new Employee();
expect(typeof (employee)).toBe("object");
});
test("Sets Employee name", () => {
const name = "Bill";
const employee = new Empl... | true |
b9c0cc55ab93ade5fa1f0a54a4fc171dd901dc90 | JavaScript | ganeshjangid/data_structure_algoritham_in_javascript_udemy | /big_o_notation/addUpTo.js | UTF-8 | 376 | 3.46875 | 3 | [] | no_license |
const chai = require('chai');
const expect = chai.expect;
function addUpTo(n){
const otherSolution = n * (n + 1) / 2;
//console.log(otherSolution);
return otherSolution;
}
describe('Data Structure', () => {
describe('Add To Up', () => {
it('5 should be equals to 15', () => {
... | true |
2331480cac4e3759b94901111707e3e85fe39a13 | JavaScript | wnas/wnas.github.io | /articles/test.js | UTF-8 | 658 | 2.765625 | 3 | [] | no_license | // test
var fs = require("fs");
var content = fs.readFileSync("_data.json");
var x = JSON.parse(content);
for ( var i in x){
var date = new Date(x[i].pubdate*1000),
day = '<span class="day">'+date.getDate()+'</span>',
month = '<span class="month">'+(date.getMonth()+1)+'</span>',
year = '<span class="... | true |
7b4b2d1f0c1953e49444888cb39944ceb673f233 | JavaScript | ponypharmacist/dnd-charsheet-vue | /src/store/index.js | UTF-8 | 2,312 | 2.65625 | 3 | [] | no_license | import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export const store = new Vuex.Store({
state: {
count: 9000,
character: {},
localCharactersList: [],
rollQueue: [],
// Level up stuff
levelUpOne: false,
levelUpTwo: false,
// Utility and Interface
armorSelectModal: false,... | true |
d5fa818da2b5b6714b0c7a511bc62ae644df142a | JavaScript | anissa1908/Do-You-Have-Mamba-Mentality- | /index.js | UTF-8 | 1,943 | 3.609375 | 4 | [
"MIT"
] | permissive | var startBtn = document.getElementById("start");
var timer = document.getElementById("timer");
var time = 24;
var currentQuestion = 1;
var counter;
var correct = 0;
var highscores = JSON.parse(localStorage.getItem("highscore")) || [];
startBtn.addEventListener("click", startQuiz);
function startQuiz(){
counter = s... | true |
a2e2e04191f839cd2a668b848fa3c1de2ab8686f | JavaScript | LTochtcheva/Cracking-theCI | /solutions/chapter2_LinkedLists/2.7_Intersection.js | UTF-8 | 1,271 | 4 | 4 | [] | no_license | //determine if two singly linked lists intersect
//O(A+B) time, O(A) space
// export default (a, b) => {
// let current = a
// let set = new Set()
// while (current) {
// set.add(current)
// current = current.next
// }
// current = b
// while (current) {
// if (set.has(current)) return current
/... | true |
b16472a4974ec7811510d8682b9bfa8ebf0c3b76 | JavaScript | michellehn/EducateTheChildren | /etc/js/formcheck.js | UTF-8 | 283 | 2.71875 | 3 | [] | no_license | function fail() {
}
function checkForm(form){
if(this.username.value == ''){
alert("Please enter a full name!");
#this.username.focus();
return false;
}
else if (this.email.value == '' || fail(this.email)){
alert("Please enter an email!");
this.username.focus();
}
} | true |
66019b544a1239fc28349cee43f0fd3b11585a3a | JavaScript | timoparv65/Elokuvakirjasto | /test/movie_list_test.js | UTF-8 | 5,524 | 2.78125 | 3 | [] | no_license | //describe('Movie list', function(){ // alkuperäinen
describe('ListMovieController', function(){
var controller, scope;
var FirebaseServiceMock;
beforeEach(function(){
// Lisää moduulisi nimi tähän
//module('MyAwesomeModule'); // alkuperäinen
module('MovieLibraryApp'); // omaa... | true |
ad06941c5555fd7a60b5047a4692a9125a00332b | JavaScript | szubal311/MySQL-Team-Tracker | /index.js | UTF-8 | 5,986 | 2.828125 | 3 | [] | no_license | const mysql = require("mysql");
const inquirer = require("inquirer");
require('dotenv').config()
const connection = mysql.createConnection({
host: 'localhost',
port: 3306,
user: 'root',
password: process.env.PASSWORD,
database: 'employees_db',
insecureAuth : true
});
connection.... | true |
68c877221fbd5d9d105cc5d32172e437ddd28f72 | JavaScript | d74g0n/d74g0n.github.io | /games/Grid_Engine/canvas_lib.js | UTF-8 | 489 | 2.765625 | 3 | [] | no_license | const _verbose = true;
const canvas = document.querySelector('canvas');
// commonly known as ctx.
const ctx = (function initCanvas() {
canvas.width = CanvasDefault.cdx();
canvas.height = CanvasDefault.cdy();
canvas.style.border = '2px solid green';
if (_verbose) {
console.log('[LOAD][canvas.j... | true |
a7c69855a689045d744bb15384c91cdd996ec3be | JavaScript | kingdayx/OTRpizza | /src/functions.js | UTF-8 | 2,145 | 2.90625 | 3 | [] | no_license | import CryptoPizzaArtifact from "./contracts/CryptoPizza.json";
import config from "./config";
class Pizza {
constructor(web3) {
this.abi = CryptoPizzaArtifact.abi;
this.address = CryptoPizzaArtifact.networks[config.networkId].address;
this.instance = new web3.eth.Contract(this.abi, this.address);
}
// Loads... | true |
77aaed04db4aa5ce49bd8c376451d208474e3bbc | JavaScript | RakuCorp/Artichoke | /public/js/chat.js | UTF-8 | 2,769 | 3.015625 | 3 | [
"MIT"
] | permissive | // eslint-disable-next-line no-undef
const socket = io.connect('http://localhost:3000');
const message = document.getElementById('message-input');
const sendMsg = document.getElementById('send-message');
const msgSound = document.getElementById('notification-sound');
const user = document.getElementById('username-inpu... | true |
4109a5fce40e4782622d622f5ed4976e2aab2e04 | JavaScript | buckley93/mern-assignemnts | /jokes-api/server/controllers/jokes.controller.js | UTF-8 | 1,341 | 2.734375 | 3 | [] | no_license | const Joke = require("../models/jokes.model");
module.exports.findAllJokes = (req, res) => {
Joke.find()
.then(allTheJokes => res.json({ jokes: allTheJokes }))
.catch(err => res.json({ message: "Something went wrong when getting all of the jokes", error: err }))
};
module.exports.findOneJoke = (re... | true |
6f540f34cdc7b0a61dc86e65fd65b498a5877a94 | JavaScript | spawner999/Ping-Pong-Epicodus | /spec/specs.js | UTF-8 | 1,211 | 3.546875 | 4 | [
"MIT"
] | permissive | 'use strict';
describe('pingPong', function(){
it('returns numbers up to the given number', function(){
expect(pingPong(2)).to.eql([1, 2]);
});
it('returns numbers up to the given number, replacing multiples of 3 with ping', function(){
expect(pingPong(3)).to.eql([1, 2, "ping"]);
});
it(... | true |
0289868b44c3a0ad4c30b6c79aceae96c1b88c9f | JavaScript | marlondantas/yashu-alexa-skill | /alexaApp/model/intent/amazonIntentRequests.js | UTF-8 | 1,580 | 2.953125 | 3 | [] | no_license | //TODO busca a class do usuário e set na session.
const jogador = require('./../../../webApp/model/User');
function launch(request, response) {
try {
//TODO log de inicio da função.
console.log('userID' + request.userId);
request.getSession().set("Jogador", new jogador(''));
request.getSession().se... | true |
e04d5f63f29ded4490761238d37fccbbeefa099c | JavaScript | rpivo/leetcode-answers | /robot-return-to-origin.js | UTF-8 | 570 | 3.03125 | 3 | [] | no_license | var judgeCircle = function(moves, left = up = right = down = 0) {
moves.split('').forEach(move => {
switch(move) {
case 'L':
right > 0 ? right -= 1 : left += 1;
break;
case 'U':
down > 0 ? down -= 1 : up += 1;
break;
case 'R':
left > 0 ... | true |
0d8dc77743690fba7be1e4dcdd1150e964bde831 | JavaScript | omar11taha/AboutMe | /js/copy.js | UTF-8 | 2,567 | 3.453125 | 3 | [
"MIT"
] | permissive | // 'use strict';
// let username = prompt('what is your name');
// alert('helle ' + username + ' lit us play a game');
// let score=0
// let contry = prompt('do you think i am from jordan?(yes(y) or no(n))');
// contry = contry.toLowerCase();
// if (contry === 'yes' || contry === 'y') {
// alert('you are true, i am f... | true |
5b677a71415b90085ec8b17f67be18c836dab65e | JavaScript | gnotnay/LCHell | /week1/lc1526_minNumberOperations.js | UTF-8 | 272 | 3.171875 | 3 | [] | no_license | /**
* @param {number[]} target
* @return {number}
*/
var minNumberOperations = function(target) {
let res = 0, pre = 0;
for (let i = 0; i < target.length; i++) {
res += Math.max(target[i] - pre, 0);
pre = target[i];
}
return res;
}; | true |
3d229fa482994509902afbc4508d6286ebf876a0 | JavaScript | CaptainMich/CaptainMich.github.io | /js/whoami.js | UTF-8 | 3,362 | 3.03125 | 3 | [
"MIT"
] | permissive | const BLACKLISTED_KEY_CODES = [38];
const SECRET_COMMANDS = ["hidden.py", "basc", "flag", "echo"];
const COMMANDS = {
help:
'<div class="terminal-line command"> Supported commands: <span class="code">about</span>, <span class="code">experience</span>, <span class="code">education</span>, <span class="code">skills... | true |
9c1d0f72d01e77db154c941367452bda1fe69bed | JavaScript | Crodaycat/tiendaOnline | /scripts/validar_edad.js | UTF-8 | 893 | 3.0625 | 3 | [] | no_license | TxtEdad = document.getElementById("Edad");
InfoEdad = document.getElementById("InfoEdad");
ValidoEdad = false;
function ValidarEdad() {
if(TxtEdad.value == ""){
InfoEdad.innerHTML = "Debe ingresar su edad.";
TxtEdad.style.borderColor = "rgba(255,0,0,0.5)";
ValidoEdad = false;
}
else if(isNaN(TxtEdad.value)... | true |
33181e7035737202397031468b3c1b5510c761f3 | JavaScript | pmp-p/miedit | /library/query-parameters/query-parameters.js | UTF-8 | 590 | 3.1875 | 3 | [] | no_license | "use strict"
/**
* Return a specific parameter value from the current URL
* @param {string} varName Name of the parameter from which value will be read
* @return {?string} The value or undefined if not available
*/
function queryParameters(varName) {
function decode(str) {
return decodeURIComponent(str.... | true |
fa640505d523aa85628ccf838aa5d46f305ec92d | JavaScript | arielwainer4/leetcodePractice | /October Challenge/10-15.js | UTF-8 | 1,038 | 4.0625 | 4 | [] | no_license | // Given an array, rotate the array to the right by k steps, where k is non-negative.
// Follow up:
// Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
// Could you do it in-place with O(1) extra space?
// time: O(n*k) where n is length of the arr
// space: o(1)... | true |
b355f7e3b68763a45533c693f77c490abed66cb8 | JavaScript | TristinHarvell/Fitbit | /WorkFlow-master/app/index.js | UTF-8 | 11,677 | 3.078125 | 3 | [] | no_license | /*
* Terminology:
* 1 Session is made up for 4 Sets
* 1 Set is made up of 2 Sprints
* Each Sprint is either a Flow Sprint of a Break Sprint
*/
import document from "document";
import * as messaging from "messaging";
import { display } from "display";
import { me } from "appbit";
import * as fs from "fs";
import cl... | true |
a77759fab105d04e80ab670b3d60635cd8673a5b | JavaScript | FaberVitale/less-plugin-util | /test/string/startsWith.js | UTF-8 | 3,106 | 2.53125 | 3 | [
"MIT"
] | permissive | //startsWith.js
const assert = require("assert");
const less = require("less");
const plugin = require("../../");
const startsWithTest = describe("str-starts-with()", function () {
it("should be registered", function (done) {
less.render("p{exist: isfunction('str-starts-with');}", { plugins: [plugin] })
... | true |
f6ef7f93a72d2e4623d02bd4adc71635a3eacf74 | JavaScript | tectronics/xpence | /xpence-web/src/main/webapp/js/app/view/ErrorView.js | UTF-8 | 399 | 2.546875 | 3 | [] | no_license | function ErrorView(div) {
this.render = function(title, message) {
var errorHtml = '<table width="60%" class="content-panel table-layout"><tr class="error-title"><td>' + title + '</td></tr>' +
'<tr class="error-message"><td>' + message + '</td></tr></table>';
el(div).html(errorHtml);
el(div).css('display', '... | true |
95e28177f564c33b5eeb101a89ebb072204f3751 | JavaScript | CFGIndia20/team-15 | /public/assets/js/up.js | UTF-8 | 514 | 2.96875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | function myFunction() {
var str1 = document.getElementById("passOne").value;
var str2 = document.getElementById("passTwo").value;
var n = str1.localeCompare(str2);
if(str1=="" || str2==""){
document.getElementById("footerText").innerHTML = "Fill out all the fields!";
}
else if(n... | true |
1e1d22a6e4004582fb62baeb7333a465b071c18d | JavaScript | jwhy89/Canvas-Logo | /server/public/scripts/client.js | UTF-8 | 5,407 | 3 | 3 | [
"MIT"
] | permissive | $(document).ready(onReady);
var canvas = document.querySelector('canvas');
canvas.width = 300;
canvas.height= 300;
let bounced = false;
let newPic = `id="taco" width="300" height="300" src="prime.png"`
function onReady(){
$('#submit').on('click', updateImage)
$('#hide').empty()
$('#hide').append(`<img ... | true |
6c45e0d298988acacae71194388943ef659160b2 | JavaScript | marcusjohnsson/algomix | /algomix.js | UTF-8 | 2,789 | 3.875 | 4 | [] | no_license | // Convert Celcius Temperature to Farenheit
// @param int, return int
function convertCelciusToFarenheitF(celsius) {
let farenheit = (celsius * 9) / 5 + 32;
return farenheit;
}
// Reverses order of string
// @param str, return str
function reverseString(str) {
let l = str.length - 1;
let reversedString = "";
... | true |
5df422e75df23d481d3f59fc316340d2a07273fc | JavaScript | eldinho2/sd-011-project-trivia-react-redux | /src/reducers/playerReducer.js | UTF-8 | 450 | 2.59375 | 3 | [] | no_license | import { LOGIN, GET_SCORE } from '../actions';
const INITIAL_STATE = {
name: '',
email: '',
score: 0,
assertions: 0,
};
function playerReducer(state = INITIAL_STATE, action) {
switch (action.type) {
case LOGIN:
return { ...state, name: action.name, email: action.email };
case GET_SCORE:
return {... | true |
be94784eaf3667706753a70298f6caf78c8c2b51 | JavaScript | SashvatCoder/Project-34 | /sketch.js | UTF-8 | 813 | 3.140625 | 3 | [] | no_license | var dog;
var database;
var happyDog;
var foodStock;
var dogIMG;
var foodS;
function preload()
{
dogIMG=loadImage("images/dogImg.png");
happyDog=loadImage("images/dogImg1.png");
}
function setup() {
database=firebase.database();
createCanvas(800, 700);
dog=createSprite(250,300,150,150)
dog.addImage(dogIMG);
d... | true |
001d8a873f16b2b0671b9a33871fb140f14462a4 | JavaScript | rqveler/tt-fun | /src/models/Competition.js | UTF-8 | 503 | 2.515625 | 3 | [] | no_license | import { observable, action, computed } from "mobx";
import competitionTypes from "../helpers/competitionTypes"
export default class Competition {
@observable matches;
name;
type;
payment;
constructor({name, type=competitionTypes.knockout, matches = []}) {
this.title = title;
this.date = date;
... | true |
79ebcd4304f6c2545ed5eb0b5229809ef2bc7727 | JavaScript | humza1997/Frontend | /src/reducers/listsReducer.js | UTF-8 | 1,638 | 2.703125 | 3 | [] | no_license | const initState = {
loading: false,
result: [
{
name: "Italy Trip",
id: 1,
thumb: "fas fa-hiking fa-3x",
colour: "#FF0000",
list_pins: [1, 2, 7, 3, 4],
user_id: 1,
},
{
name: "Restaurants",
id: 2,
thumb: "fas fa-utensils fa-3x",
colour: "#FF000... | true |
6fff1be728a03b4c0e43308a4fc984edda6e3cd7 | JavaScript | mocamanda/Theory-Of-Computation | /projects/state-mach-regex/extractlinks/extractlinks.js | UTF-8 | 520 | 3.078125 | 3 | [] | no_license | const fs = require('fs');
const args = process.argv.slice(2);
if (args.length != 1) {
console.error("usage: extractlinks inputfile");
process.exit(1);
}
const filename = args[0];
// !!!! IMPLEMENT ME
// Read file
const text = fs.readFileSync(filename, 'utf8');
// Set up regex
const urlRegex = /(http|https... | true |
6346b2945eabceb3e997daa26594ca9d16c908b3 | JavaScript | jayvee0911/Projects | /js/register.js | UTF-8 | 4,544 | 2.828125 | 3 | [] | no_license |
let inputuser = document.getElementById("username");
let erroruser = document.getElementById("errorusername");
let inputpass = document.getElementById("password");
let errorpass = document.getElementById("errorpassword");
inputuser.addEventListener('change', (event) => {
event.preventDefault()
if(event.targ... | true |
b4dda47b4101d67316090bcfd7bd7d949df63720 | JavaScript | ThanhTV12/PracticeJavaScript | /40-callback-hell/index.js | UTF-8 | 388 | 2.5625 | 3 | [] | no_license | var fs = require('fs');
console.log('Start');
fs.readFile('data/song1.txt', {encoding: 'utf8'}, (err, data) => {
console.log(data);
fs.readFile('data/song2.txt', {encoding: 'utf8'}, (err, data) => {
console.log(data);
fs.readFile('data/song3.txt', {encoding: 'utf8'}, (err, data) => {
... | true |
661373f3321107b0c5db177c5ffe088a728e93c7 | JavaScript | Lidemy/mentor-program-3rd-weryk153 | /homeworks/week4/hw4.js | UTF-8 | 699 | 2.734375 | 3 | [] | no_license | const request = require('request');
request.get('https://api.twitch.tv/kraken/games/top/?client_id=mag8li1ax663tdtc786sy16rj2qisa',
(error, response, body) => {
const json = JSON.parse(body);
json.top.forEach((element) => {
// eslint-disable-next-line no-underscore-dangle
console.log(`${element.g... | true |
082aa18d6c244f7fc946d1626432421aca36340a | JavaScript | kevingalvan86/homework_7 | /js/weather.js | UTF-8 | 2,110 | 3.53125 | 4 | [] | no_license | function gettingJSON(){
//Display the forecast
// Your code here.
//http://api.openweathermap.org/data/2.5/forecast?id=524901&appid=ff50bde9df369a377f0b0ff4e5987cd4
//Set default location if one isn't provided
let location;
location = "Ann%Arbor";
// Your code here.
console.log("Loc... | true |
961e39bc67acbe1c7dbb3146100c13b6699f1279 | JavaScript | eleazarMar/lazer | /src/canvas/graphics/Shadow.js | UTF-8 | 1,081 | 3.078125 | 3 | [
"MIT"
] | permissive | /**
* Sets the shadow properties of this BitmapDatas context which will affect all draw operations made to it.
* You can cancel an existing shadow by calling this method and passing no parameters.
* Note: At the time of writing (October 2014) Chrome still doesn't support shadowBlur used with drawImage.
*
* @method Phas... | true |
bf6a21668573fcc3d98be2ba9eea7d8133247aa8 | JavaScript | Ayguid/miniProyectsDH | /capacitaciones/clase 1/INTRO/app.js | UTF-8 | 2,768 | 3.203125 | 3 | [] | no_license | console.log('Hola');
function openNav() {
console.log('Abrio');
document.getElementById("mySidenav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
}
function closeNav() {
console.log('Cerro');
document.getElementById("mySidenav").style.width = "0";
docum... | true |
a68e2fd1cd343354eb43aa4bb944706fa114c0a5 | JavaScript | nehapatel328/adopt-a-dog-spring2019 | /scripts/checkout.js | UTF-8 | 1,043 | 3.609375 | 4 | [] | no_license | //Contact Forms
function show_alert() {
alert("Your information has been submitted."); }//Alert for form & Console log the values inside the form, you can build a string or build an object.
let formInput = [];
let data = document.getElementsByTagName ('input');
formInput.push(data.value);
console.log(formI... | true |
30f23a09aa8d407557b7b8f5e3305f1d77ab938f | JavaScript | pete-otaqui/pongy | /public/javascripts/main.js | UTF-8 | 3,315 | 2.6875 | 3 | [] | no_license | (function(global) {
var socket = io.connect('/pongy'),
status = $('.status'),
game = $('#game'),
paper, p1, p2, ball,
gameOffset,
animationRequestId, lastFrameTime,
MAX_SPEED = 5,
mouseX, mouseY,
player, opponent,
name;
socket.on('enter',... | true |
fbdb437717c6e97d74091e81f8d8b40fde1d8c6c | JavaScript | nikrb/fcc-stocks | /client/src/components/charts/util.test.js | UTF-8 | 4,749 | 2.84375 | 3 | [] | no_license | import moment from 'moment';
import {genLastWeekdays, normaliseDates} from './util';
it('gets five days', () => {
const expected = ["2017-09-05", "2017-09-04", "2017-09-01", "2017-08-31", "2017-08-30"];
const dt = moment( "2017-09-05", 'YYYY-MM-DD');
const res = genLastWeekdays( dt, 5);
const fres = res.map( d... | true |
7f37c202ca50878a5a853368f0ed2047669768d7 | JavaScript | MariaFdezJ/learning_js | /courses/basic-algorithm-scripting/title-case-sentence.js | UTF-8 | 419 | 4.4375 | 4 | [] | no_license | /**
* Makes a sentence where first letter of each word is capitalized.
*
* @param {string} str - Sentence to be transformed.
*
* @return {string} Sentence transformed to Title Case.
*/
function titleCase(str) {
let strArray = str.toLowerCase().split(' ');
str = strArray.map( word =>
word[0].toUp... | true |
da68cc4e03c085e35c473d92615e2fcc108ababb | JavaScript | ferlycreator/archive-mt.js | /test/geometry/RectangleSpec.js | UTF-8 | 3,611 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | describe('RectangleSpec', function() {
var container;
var map;
var tile;
var center = new Z.Coordinate(118.846825, 32.046534);
var layer;
var canvasContainer;
beforeEach(function() {
var setups = commonSetupMap(center);
container = setups.container;
map = setups.map... | true |
bc4a5fd400cd8f0725dc995d747cea744a20a50e | JavaScript | DanielCavalcante/js-for-noobs | /aula-06/correcaoDesafioAula5.js | UTF-8 | 276 | 3.390625 | 3 | [] | no_license | let nota1 = 10;
let nota2 = 5;
let nota3 = 0;
function calcularMedia() {
var totalNotas = nota1 + nota2 + nota3;
var media = totalNotas / 3;
if (media >= 7) {
return console.log('Aprovado!')
}
return console.log('Reprovado');
}
calcularMedia(); | true |
85f82615dd6e46840c58bab780c467fac706c250 | JavaScript | zalman29096/solinor-salary-calculator | /src/groupResult.js | UTF-8 | 1,403 | 3.03125 | 3 | [] | no_license | /**
* Created by aleksey on 01/03/18.
*/
let formatWage = (result) => {
return result.map((r) => {
if(!r || typeof r.wage !== "number") return null
r.wage = `$${Number(r.wage).toFixed(2)}`
return r
}).filter(v => !!v)
}
let jsonToCsv = (jsonData, separator) => {
return jsonData.map((r) => {
... | true |
525df03df363c29c08f4a876015b01058195af61 | JavaScript | js-lib-com/js-lib | /src/js/dom/EList.js | UTF-8 | 11,709 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | $package("js.dom");
/**
* List of elements. This class wraps a native {@link NodeList} instance and is returned by {@link js.dom.Document} and
* {@link js.dom.Element} methods that need to return collection of elements. Be aware that native NodeList is a
* <em>live
* </em> object, that is, updated by JavaScr... | true |
c360d3fd12c7b14e8c3379bf90b8cd771d7d6a01 | JavaScript | HeMan22/FSD-Exercises | /Everyday_Practice/React/myfirstapp/src/components/first.js | UTF-8 | 947 | 3.125 | 3 | [] | no_license | import React, { useState } from "react";
import "./first.css";
export default function First(props) {
const name = "Himanshu Tripathi";
// collecting props in the object and then later on can just use the object property variable to get the props
let properties = {
ame: props.game,
desc: props.desc,
}... | true |
5a0b0ca8af3fc7091c5c2ec3a7bcbd30d8644399 | JavaScript | MasReed/full-stack-open-2021 | /part7/blog-list-app/blog-list-frontend/src/components/NewBlogForm.js | UTF-8 | 2,780 | 2.546875 | 3 | [] | no_license | import React, { useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import Button from 'react-bootstrap/Button'
import Form from 'react-bootstrap/Form'
import { blogCreator } from '../reducers/blogReducer'
import { toastNotificationCreator } from '../reducers/notificationReducer'
const NewB... | true |
05fd59e7eca69b60aa418224e51731c4a82e170c | JavaScript | tedberg/constraint-modeler | /tests/unit/constraint-modeler/enum/QueryFunctionEnum.spec.js | UTF-8 | 8,779 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import { Enum, EnumValue } from '@/components/constraint-modeler/enum/Enum';
import { QueryFunctionEnum } from '@/components/constraint-modeler/enum/QueryFunctionEnum';
import { DataTypeEnum } from '@/components/constraint-modeler/enum/DataTypeEnum';
describe('QueryFunction Enum', () => {
it('inherits correctly', (... | true |
f84a677122292c616bba0e9492da1ec0663b1af9 | JavaScript | igreen1/Graphics | /src/objects/Detroit.js | UTF-8 | 2,836 | 2.890625 | 3 | [] | no_license | // A collection of factories (hence detroit!)
// group work (does not include our individual shapes)
import { Geometries, OurMesh, Our3DGroup, Our3DObject, MatrixLibrary } from '../VIBAH/VIBAH'
// Placed into factories to make ExampleUniverse easier to read
// moderate loss of load efficiency is worth readability!!
... | true |
d93bbc3d77587fe519a025364efdf7e7136ae540 | JavaScript | thomasm1/jsFunctions | /_TypeScript/dist/factory-abstract.js | UTF-8 | 1,357 | 2.78125 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
var factory_abstract_aleph_1 = require("./factory-abstract-aleph");
var factory_abstract_beth_1 = require("./factory-abstract-beth");
var AbstractFactory = /** @class */ (function () {
function AbstractFactory() {
}
// MAke Concrete Class using conditional logic >>>... | true |
7d70fc89e2b258021e162168e06f3df91f4fa893 | JavaScript | Rapid1898-code/LeonNoel-WebDesign-Bootcamp | /class10/simple-functions/js/main.js | UTF-8 | 395 | 4.3125 | 4 | [] | no_license | //create a function that adds two numbers and alerts the sum
function add(x,y) {
let erg = x+y;
alert(erg);
}
//create a function that multiplys three numbers and console logs the product
function threenum(x,y,z) {
let erg = x*y*z;
console.log(erg);
}
//create a function that divides two numbers and retu... | true |
1921d96e8878bb8a23c8c5c930f7d0c2a144cba4 | JavaScript | diyewu/qlvip | /src/main/webapp/weixin/js/park_list.js | UTF-8 | 13,662 | 2.609375 | 3 | [] | no_license | var contextPath;
var currentCity = "全国";
var parkList;
var currentLng;
var currentLat;
$(function() {
contextPath = $("#contextPath").val();
currentCitySearch();
getMyLocation();
})
function showInMap(longitude,latitude,name){
window.location.href = "http://uri.amap.com/navigation?from=" + cur... | true |
0b2a561452aae0a0377cda24ada6d9719edcf510 | JavaScript | arangodb/arangodb | /3rdParty/V8/v7.9.317/test/mjsunit/harmony/array-flat.js | UTF-8 | 2,148 | 2.9375 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode... | permissive | // Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertEquals(Array.prototype.flat.length, 0);
assertEquals(Array.prototype.flat.name, 'flat');
{
const input = [1, [2], [[3]]];
assertEquals(input... | true |
3daf41ecdcd9e5b320311db5d934a63c7540a97a | JavaScript | parimalroy/Book-List-vanilajs | /js/script.js | UTF-8 | 1,790 | 3.375 | 3 | [] | no_license | /**Dom Selection */
const title = document.querySelector('#title');
const author = document.querySelector('#author');
const publisher = document.querySelector('#publisher');
const year = document.querySelector('#year');
const btn = document.querySelector('#btn');
const bookList = document.querySelector("#book-list");
... | true |
77fec54bb5a6b25d4f2eb935d9e9f512b7bc8260 | JavaScript | Lin-Kyle/js-redux | /demo5/createStore.js | UTF-8 | 680 | 2.90625 | 3 | [] | no_license | function createStore (initStore = {}, reducer) {
// 唯一数据源
let state = initStore
// 监听队列
const listenList = []
// 唯一获取数据函数
const getState = () => state
// 纯函数来执行修改,只返回最新数据
const dispatch = (action) => {
state = reducer(state, action)
listenList.forEach((listener) => {
listener(state)
... | true |
23897c23871565cbd242da792cfa8a494216ba9f | JavaScript | byronhulcher/clay-kiln | /lib/validators/built-in/required.js | UTF-8 | 1,810 | 2.5625 | 3 | [
"MIT"
] | permissive | import _ from 'lodash';
import { getComponentName, fieldProp } from '../../utils/references';
import labelUtil from '../../utils/label';
import { isEmpty } from '../../utils/comparators';
import { hasBehavior, getListProps } from '../helpers';
export const label = 'Required',
description = 'Some fields are required ... | true |
99db51e5763f580b9d6a4b9970d5a851ccc32e8d | JavaScript | Risto-Stevcev/github-markdown-live | /index.js | UTF-8 | 3,406 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
'use strict'
const express = require('express')
, https = require('https')
, http = require('http')
, path = require('path')
, fs = require('fs')
const app = express()
, server = http.Server(app)
, io = require('socket.io')(server)
const argv = require('... | true |
26451115dc5f8bcc7c54fe0be6099b8852eea537 | JavaScript | snehapavuluri/hospital-managemnt | /Js/Common.js | UTF-8 | 2,148 | 2.546875 | 3 | [] | no_license | /**
* Vertically center Bootstrap 3 modals so they aren't always stuck at the top
*/
$(function () {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
modal.css('display', 'block');
// Dividing by two centers the modal exactly, but divi... | true |
fa423951b7ebe134b7978df68138758f8638b47b | JavaScript | Haris-Taraholic/bit_web | /PROJECTS/4. JS Web - Project/Football Team - Project/js/football.js | UTF-8 | 2,865 | 3.109375 | 3 | [] | no_license |
/////////////////////// PLAYERS ////////////////////////
var players = [
{ name: 'Milan ', lastName: 'Borjan ', number: 82, playerImg: 'img/players/Milan_Borjan_82.png' },
{ name: 'Zoran ', lastName: 'Popovic ', number: 1, playerImg: 'img/players/Zoran_Popovic_1.png' },
{ name: 'Branko ', lastName: 'Jovici... | true |
3631027d795a49fee0ad9f84b6045d7ddc05e462 | JavaScript | yarixxx/Toolbox | /test/testObjectValidator.js | UTF-8 | 838 | 3.046875 | 3 | [] | no_license | var ObjectValidatorTest = TestCase("ObjectValidatorTest");
ObjectValidatorTest.prototype.OBJECT_MODEL = {
name: 'string',
age: 'number',
hello: 'function'
};
ObjectValidatorTest.prototype.VALID_OBJECT = {
name: 'Robot',
age: 1000,
hello: function () {}
};
ObjectValidatorTest.prototype.INVALID... | true |
707690258cfc9c918401ad44bb7f2fd4f7afc1e3 | JavaScript | Emerdinger/imagenesFree | /src/componentes/Fotos.js | UTF-8 | 3,180 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import Imagen from './Imagen'
import Video from './Video'
import Paginacion from './Paginacion';
class Fotos extends Component {
mostrarImagenes = () => {
const imagenes = this.props.imagenes;
if (this.props.termino.length === 0) return null;
if... | true |
368d36c1e59c89d206ac4a845a23c5dc510afd81 | JavaScript | jaeyoo0609/wi21-cse110-lab4 | /part1/part1-question18.js | UTF-8 | 148 | 3.015625 | 3 | [] | no_license | for (cars in statistics){
if(`${cars}`.startsWith("r") || `${statistics[cars]}`%2 == 1 )
console.log(`${cars}: ${statistics[cars]}`)
} | true |
72e8aaadaa55d9256273eb6cb93700ba723a0331 | JavaScript | getuliom/SEII-GetulioMartinsResende | /Semana06/calculadora/calculadora.js | UTF-8 | 632 | 3.984375 | 4 | [
"MIT"
] | permissive | var valor; //define variável valor e resultado
var resultado;
function botao(num){ //cria uma função botão que recebe num
valor= document.calc.visor.value += num; // valor, em JavaScript recebe value do html
} //também concatena os valores apertados nos botões
function reseta(){ //cria uma função que reseta a calc... | true |
d65036569f08e293537eca175d82320800c4efde | JavaScript | trubitsyn/node-is-factorial | /test.js | UTF-8 | 1,285 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2018 Nikola Trubitsyn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | true |
702713cbf53015e311d66967c1e1814077fd9094 | JavaScript | hzjhzj123456/myTypescript | /2.js | UTF-8 | 1,434 | 2.96875 | 3 | [] | no_license | // 将一个div变为一个可拖拽的块
var dropClass = /** @class */ (function () {
function dropClass(id) {
this.id = id;
this.dropBox = document.getElementById(this.id);
this.dropflag = false;
this.init();
}
//初始化
dropClass.prototype.init = function () {
var _this = this;
d... | true |
cda37db2f52be6155df5a45acfa5aef144b93237 | JavaScript | laszland/tresorit | /client/service.js | UTF-8 | 922 | 2.90625 | 3 | [] | no_license | var CryptoJS = require('crypto-js');
const getSecretKey = (length) => {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() *... | true |
059a104270553145aed05b7770b5e5bae2cac6e7 | JavaScript | antonburger/ZombieCowFarmer | /dist/js/index.js | UTF-8 | 926 | 2.625 | 3 | [] | no_license | import { Map, Tile } from "./map.js";
import { GameState } from "./gamestate.js";
import * as Game from "./gameloop.js";
import { MilkingShed, Cow } from "./gameobject.js";
import { GameRender } from "./gamerender.js";
const sampleMap = new Map(10, 10);
for (const y of d3.range(sampleMap.height)) {
for (const x of ... | true |
e142f5c17e793f2ab383d67f646e8b120b9b07cb | JavaScript | weblgd/weblgd.github.io | /轮播图面向对象/lbt.js | UTF-8 | 1,339 | 2.890625 | 3 | [] | no_license | function Swh (el , option = {}){
this.el = document.querySelector(el)
this.num = 1
this.t = null
this.init()
this.option = option
}
Swh.prototype.init = function (){
this.tpd()
this.tptb()
this.yryc()
}
Swh.prototype.tpd = function () {
this.t = setInterv... | true |
af5ee54e28c24b2c0a763406d4925eca58a5f063 | JavaScript | dahmad1/NumberSystemsProg | /js/part1.js | UTF-8 | 1,901 | 3.125 | 3 | [] | no_license | function ConversionPart1() {
var UnsignedInt = "" +document.getElementById("1_UnsignedInt").value;
var UnsignedIntBaseFrom = parseInt(document.getElementById("1_UnsignedIntBaseToConvertFrom").value);
var UnsignedIntBaseTo = parseInt(document.getElementById("1_UnsignedIntBaseToConvertTo").value);
var UnsignedI... | true |
62aa06a7c23ef09257a0c2afd257851213abed6f | JavaScript | imgen/riotjs | /lib/render.js | UTF-8 | 1,046 | 2.578125 | 3 | [
"MIT"
] | permissive | // Precompiled templates (JavaScript functions)
var FN = {},
escape_fn = function(data) {
return (data || data === 0) ? (data+'').replace(
/[&\"<>]/g,
function(e){ return render_escape[e];}
): '';
},
no_escape_fn = function(data) {
return (data || data === 0) ? (data+'') : '';
},
templ... | true |
ab7ced1a18c34a39f67c217823c054a1eb85e5b6 | JavaScript | narasimhareddyprostack/FSWD-2021-9PM | /extra/one.js | UTF-8 | 671 | 3.296875 | 3 | [] | no_license | const array = [
{
username: "john",
team: "red",
score: 5,
items: ["ball", "book", "pen"],
},
{
username: "becky",
team: "blue",
score: 10,
items: ["tape", "backpack", "pen"],
},
{
username: "susy",
team: "red",
score: 55,
items: ["ball", "eraser", "pen"],
},
... | true |
fb1d0653702c1282f7f0f6d7a355436c53ba53a3 | JavaScript | easton-gorishek/classwork | /week01_javascript-node-fundementals/class01_node-tdd/greeting-app/test/greet.test.js | UTF-8 | 735 | 2.828125 | 3 | [] | no_license | const assert = require('assert');
const greet = require('../lib/greet');
describe('greet', () => {
it('says hello to provided name', () => {
const greeting = greet('world');
assert.equal(greeting, 'hello world');
});
it('says hello stranger when no name provided', () => {
cons... | true |
2876285680e0d155b35dc7f79433979ed823b22c | JavaScript | landho-app/landho-phonegap | /www/js/components/Update.js | UTF-8 | 2,859 | 2.6875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import React from "react";
class Update extends React.Component {
// CONSTRUCTOR
constructor(props) {
super(props);
this.state = {
"body": null,
"updateVersion": null
};
}
// VERSION STRING TO NUMBER
versionStringToNumber(v) {
var v = parseInt(v.replace(/\./g, ""));
if(v < 100) {
v = parseInt... | true |
ea8fc13d4776fc730c889dc5f9468f329315043d | JavaScript | xiao555/Two-way-Data-Bindings | /Utils.js | UTF-8 | 720 | 2.671875 | 3 | [] | no_license | exports.getValue = function getValue(route, obj) {
let keys = route.match(/(\w+\.?)+/g)[0].split('.')
let value = obj
for (var i = 0;i < keys.length;i++) {
value = value[keys[i]]
}
return value
}
exports.setValue = function setValue(val, route, obj) {
let keys = route.match(/(\w+\.?)+/g)[0].split('.')
... | true |
9f64de925ac4feac1462d33ffb54022faac57d6c | JavaScript | tac-ody/ECsite | /js/genre_edit_delete.js | UTF-8 | 1,474 | 2.75 | 3 | [] | no_license | $('#delete_genre').click(function() {
if(!confirm('本当に削除しますか?')) {
return false;
}
});
$('#edit_genre').click(function() {
if($('#select_genre').val() == "") {
alert('修正するジャンル名を選択してください');
return false;
}
});
$('#delete_genre').click(function() {
if($('#select_genre').val() == ... | true |