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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
85106dc79099436733fa8ceb1c4a7b2570c3f617 | JavaScript | MarcosParengo/CoderHouse | /Curso react js/zClase 1 pre/Funcion Flecha/main.js | UTF-8 | 335 | 3.953125 | 4 | [] | no_license |
var num1= prompt("numero1")
while (isNaN(num1)) {
num1= prompt(num1+ " no es un numero")
}
var num2= prompt("numero2")
while (isNaN(num2)) {
num2= prompt(num2+ " no es un numero")
}
num1=parseInt(num1)
num2=parseInt(num2)
var miFuncion = (numero1,numero2) => numero1+numero2;
alert(miFuncion(num1,num2)+" es ... | true |
e8294fc1254307440d4e3c7dc1eb5264ea70e316 | JavaScript | nikolas-virionis/Javascript | /small-projects-js/Ex13 - cpf-express/modules/geraCPF.js | UTF-8 | 401 | 3.0625 | 3 | [] | no_license | import { CPF } from "./CPF.js";
export class GeraCPF {
rand(min = 100000000, max = 999999999) {
return String(Math.floor(Math.random() * (max - min) + min));
}
geraNovoCpf() {
let algo;
const semDigito = this.rand();
algo = new CPF(semDigito).CPFCompleto();
return al... | true |
f8d71f73894701c2ba671742c6de7d4aade6ba02 | JavaScript | ikabir21/Frontend-Mentor-Challanges | /FAQ Accordion Card/script.js | UTF-8 | 303 | 3.109375 | 3 | [] | no_license | const inputs = document.querySelectorAll("input");
inputs.forEach(input => {
input.addEventListener("click", (e) => {
inputs.forEach(input => {
if (input.checked){
input.checked = false;
e.target.checked = true;
}
})
})
}) | true |
003d4e5e2ce7e9a84f47d1ed04eecac54af864d1 | JavaScript | mralexsatur/thermostat_js | /spec/ThermostatSpec.js | UTF-8 | 1,802 | 3.21875 | 3 | [
"MIT"
] | permissive | describe('Thermostat', function(){
var thermostat;
beforeEach(function(){
thermostat = new Thermostat();
});
it('is initialized at 20 degrees', function() {
expect(thermostat.getCurrentTemperatur()).toEqual(20);
});
it('allows the temperature to be increased by 1 degree', function(){
thermos... | true |
c721306bb0a10a4ee705c0d56a956818bac250b4 | JavaScript | zkbswgs/RealTimeLogs | /public/js/graphing.js | UTF-8 | 1,255 | 2.578125 | 3 | [] | no_license | "use strict";
jQuery(function($) {
var lastLineNum = 0;
function graphData(name) {
var value = 0,
values = [],
i = 0,
last;
return context.metric(function(start, stop, step, callback) {
start = +start, stop = +stop;
if (isNaN(last)) last = start;
while (last < stop) {
last += step;
... | true |
97a7976beb18227da8a546bc48db25b07f29762c | JavaScript | alejandrochang/Algorithms | /InterviewPrep/CTCI/2.2-kthToLast.js | UTF-8 | 981 | 4.5 | 4 | [] | no_license | // Implement an algorithm to find the kth last element
// of a singly linked list
class Node {
constructor(data, next = null) {
this.data = data;
this.next = next;
}
}
class LinkedList {
constructor() {
this.head = null;
// this.size
}
insertFirst(data) {
this.head = new Node(data, this... | true |
601ea594913e7c16782b8e490a28d06fd6962c82 | JavaScript | jayyei/prueba-skydropx | /components/Card/components/button/button.js | UTF-8 | 496 | 2.515625 | 3 | [
"MIT"
] | permissive | import styles from './button.module.css';
// button for generic card
const Button = ({
name = 'add',
label = 'Hello',
isFavorite = false,
handleClick = ()=>{}
}) => {
return(
<button
className={`${styles.button} ${isFavorite ? styles.active : ''}`}
onClick={handleClick}
... | true |
f8e29e15b37b0776ce7f6797e76165c88fe402b6 | JavaScript | gheredia90/reAuctions | /app/assets/javascripts/auction.js | UTF-8 | 4,107 | 2.53125 | 3 | [] | no_license |
var lastSegment = window.location.pathname.split('/').pop();
var matches = lastSegment.match(/\d+/g);
var supplier, lowest_bid = "";
window.setInterval(getAuctionData, 1000);
window.setInterval(checkAuctionTime, 500);
window.setInterval(updateBuyerColors, 1000);
function checkAuctionTime(){
if (window.location.pat... | true |
21c78206c4ebc2aa2fa8fec9e5b852af828398dc | JavaScript | andela/codepirates-ah-backend | /src/middlewares/tag.middleware.js | UTF-8 | 1,947 | 2.6875 | 3 | [] | no_license | /* eslint-disable require-jsdoc */
// import isEmpty from 'utils';
import TagService from '../services/tag.service';
import Util from '../helpers/util';
const util = new Util();
const notFound = (msg) => {
util.setError(404, `${msg} not found`);
return util;
};
const {
checkItem, checkTagName, checkArticleTags... | true |
94feda59c9205f49c43b245e9ff56fe2c162ab9d | JavaScript | flasco/problem-shoot | /AC自动机/167.两数之和-ii-输入有序数组.js | UTF-8 | 514 | 3.609375 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=167 lang=javascript
*
* [167] 两数之和 II - 输入有序数组
*/
/**
* @param {number[]} numbers
* @param {number} target
* @return {number[]}
*/
var twoSum = function(numbers, target) {
let p1 = 0;
let p2 = numbers.length - 1;
// 主要利用升序对称的思维,减少无用的遍历
while (p1 < p2) {
const sux = target... | true |
09064c11bd59159bc20a871ce5942d983cd82b8e | JavaScript | tomdionysus/moondial | /game/commands/exit.js | UTF-8 | 732 | 2.59375 | 3 | [] | no_license | const Command = require('../../lib/Command')
module.exports = class ExitCommand extends Command {
constructor(gameEngine, actor) {
super('exit',gameEngine,actor)
}
execute() {
switch(this.gameEngine.getRandomInt(10)) {
case 0:
this.gameEngine.writeLine('Come back soon, Gallagher will miss you!')
break
... | true |
7645cf85e1ffbc842303fe23ed48af27ee8410f0 | JavaScript | Ronin-max/Digital-search | /src/unit/createDom.js | UTF-8 | 1,239 | 3.15625 | 3 | [] | no_license | import { getRandom } from "./getColor.js";
const container = document.getElementById("container");
//创建dom元素
export default function createDom(n, color) {
const span = document.createElement("span");
span.innerText = n;
num.innerText = n;
//判断是否是素数
if (isPrime(n)) {
const div = docu... | true |
a9c36431be81b2ad1db7fd4302c1af067e9ee3ae | JavaScript | RobinTournier/formation_front_wf3 | /javascript/assets/js/12.js | UTF-8 | 2,040 | 3.125 | 3 | [] | no_license | /*---------------------------------------------------------\
/ LE DOM \
/ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \
| Le dom est une interface de developpement |
| en JS pour HTML, |
| ... | true |
ab103450211a8fe928923a6ff23129e1d9042b5f | JavaScript | radomely/node-practice | /06_DB/Mongo/001_Connection/main.js | UTF-8 | 1,150 | 2.765625 | 3 | [
"MIT"
] | permissive | // для работы с mongodb необходимо подключить модуль. Для этого используйте комманду - npm i mongodb
// MongoClient основной клас для работы с БД, через него происходят все взаимодействия с БД
var MongoClient = require("mongodb").MongoClient;
var format = require("util").format;
// Путь, по которому устанавливается со... | true |
ecb4ed0c70ba7ea75f7857a44e201b1266802889 | JavaScript | huyle93/javascript-bible-huyle | /src/array/methods.js | UTF-8 | 2,786 | 4.875 | 5 | [
"MIT"
] | permissive | /* Let’s clear up the confusion around the slice( ), splice( ), & split( ) methods in JavaScript */
let arrayDefinition = []; // Array declaration in JS
let arrayMess = [1, 2, 3, "hello world", 4.12, true];
/**
* Slice()
* The slice( ) method copies a given part of an array and returns that copied part as a new arr... | true |
56a36098f0a7ac08a9a89688d870a09b52b2cbf8 | JavaScript | liuchaosun/leetcode-training | /code/58.最后一个单词的长度.js | UTF-8 | 545 | 3.390625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=58 lang=javascript
*
* [58] 最后一个单词的长度
*/
// @lc code=start
/**
* @param {string} s
* @return {number}
*/
var lengthOfLastWord = function (s) {
s = s.trim();
if (!s) {
return 0;
}
// 从右往左
s = s.split('');
let right = s.length - 1;
let start = 0;
while (right) {
... | true |
c25244526c88d36e187b9ca50efdd7b1dddbc678 | JavaScript | oshkbello/haus-party-be | /src/middlewares/checkIfNumberIsAlreadyVerified.js | UTF-8 | 727 | 2.546875 | 3 | [] | no_license | import user from '../models/User';
const checkThatNumberIsNotVerified = async (req, res, next) => {
try {
const { username } = req.decoded;
const foundUser = await user.findByUsername(username);
if (!foundUser) {
return res.status(404).json({
// eslint-disable-next-line max-len
mes... | true |
25efe01a42401ba84c22fff10a00ee116f352a1c | JavaScript | whdlrghks/Moaa | /test/upload/app_upload.js | UTF-8 | 3,028 | 2.78125 | 3 | [] | no_license | var express = require('express');
var app = express();
var java = require('java');
var path = require('path');
java.classpath.push(path.resolve(__dirname,'zip4j-1.3.2.jar'));
console.log(__dirname);
java.classpath.push("./");
var multer = require('multer'); // express에 multer모듈 적용 (for 파일업로드)
// var upload = multer(... | true |
a304c2bd871f441314c16886427c53dece99f22c | JavaScript | carlleon/-widget | /assets/js/script.js | UTF-8 | 503 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | $(document).ready(function() {
$('.form-control').change(function() {
var hey = $('.val-check-1').val();
console.log(hey);
var empty = false;
$('.form-control').each(function() {
if ($(this).val().length == 0) {
empty = true;
}
});
... | true |
be484e13e6eeffb4f8b29951db3a975142254234 | JavaScript | qubard/plot-my-location | /public/src/map.js | UTF-8 | 2,597 | 2.6875 | 3 | [
"MIT"
] | permissive | mapboxgl.accessToken = 'pk.eyJ1IjoidGFyYXNncml0c2Vua28iLCJhIjoiY2pueG84OWR3MTMydDNwcndkc2Nla3JzcyJ9.o08Y0fXney9VoeqmdAI-bg';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/dark-v9',
center: [-122.43, 37.76], // San Franciso :sobbing:
zoom: 2
});
var GEOJSON_URL = "/geojso... | true |
14526970fd89c8ad0ace4c7cfd0e1952676638a7 | JavaScript | amirreza888/movie-rater-web-reactjs | /src/components/movie-list.js | UTF-8 | 1,517 | 2.53125 | 3 | [] | no_license | import React from "react";
import FontAwesome from 'react-fontawesome'
function MovieList(props) {
const movieClicked = movie => evt =>{
props.movieClicked(movie);
};
const editClicked = movie => {
props.editClicked(movie);
}
const removeClicked = movie => {
fetch(`${pro... | true |
f885bb1b63d5431e55dcf45bd507811974680108 | JavaScript | ErenCelik96/weather-website-JS | /script.js | UTF-8 | 1,252 | 3.484375 | 3 | [] | no_license | async function data() {
let input = document.getElementById("myText").value;
let newInput = input.toString().toLowerCase().replaceAll(" ", "-");
let temperature = document.querySelector(".span1");
let city = document.querySelector(".span2");
let wind = document.querySelector(".span3");
let card... | true |
13a0f9309555c6e85de5917d8c6cb6c5207d22e4 | JavaScript | phpmastermind/notes | /app.js | UTF-8 | 993 | 2.578125 | 3 | [] | no_license | var express = require('express')
var speech = require('./recognize')
var app = express()
var filename = './resources/audio.raw';
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.get('/sync', function (req, res){
// res.send("Transcripting... Please wait.");
speech.syncRecognize(filename, funct... | true |
df262542088dcea79fde96a3fbb88646a63ebf9e | JavaScript | drmatt13/portfoliobackend | /data/apps/collection1/Interactive_Pricing/script.js | UTF-8 | 536 | 2.984375 | 3 | [] | no_license | const pageviews = document.querySelector(".pageviews");
const price = document.querySelector(".price");
// range slider
const slider = document.getElementsByName("price-range")[0];
slider.oninput = e => {
pageviews.innerHTML = `${(e.target.value * 6.25).toFixed(0)}K PAGEVIEWS`;
price.innerHTML = `$${e.target.value... | true |
7a95bef63da1a0c020fcfb86f81157a5d0e411b3 | JavaScript | sbimochan/js-immutable | /test/index.test.js | UTF-8 | 9,370 | 3.03125 | 3 | [
"MIT",
"CC-BY-SA-4.0",
"CC-BY-4.0"
] | permissive | import { expect } from 'chai';
import reduce from '../src/index';
describe('React State Reducer', () => {
context('#React State Reducer Function', () => {
it('should be a function', () => {
expect(reduce)
.to.be.a('function');
});
it('should throw an error with undefined selector', () => ... | true |
8fbd1d8ad1d973bbb03699ecef1c98587eb47bed | JavaScript | Jonhks/Ejercicios-eventos-ada | /js/app.js | UTF-8 | 6,563 | 3.859375 | 4 | [] | no_license | // playlist
// Crear un documento html con un título que diga Mis canciones favoritas y una lista desordenada. Pedir mediante prompts por cinco canciones (una a la vez), y agregar esas canciones como ítems de la lista desordenada
// 1.- Poner un titulo con mis canciones favoritas x
// 2.- Crear una lista desordenada x... | true |
080f240b61a6303477d8b5c8f10b08372df0650d | JavaScript | amir-the6th/WEB222-Seneca-College | /Assignment 1/src/problem-3.test.js | UTF-8 | 2,227 | 3.265625 | 3 | [] | no_license | const { extractFSA } = require('./solutions');
describe('Problem 3 - extractFSA() function', function() {
test('valid FSA from valid postal codes', function() {
// King Campus
expect(extractFSA('L7B 1B3')).toBe('L7B');
// Markham Campus
expect(extractFSA('L3R 5Y1')).toBe('L3R');
// Newnham Campus... | true |
65b1ef550254e4f5188cef98914d3aa43612da1c | JavaScript | vboluda/DirectDebit | /test/DirectDebitFactory-test.js | UTF-8 | 3,755 | 2.640625 | 3 | [] | no_license | const { expect, assert } = require("chai");
//THIS TESTS ARE NOT ENOUGHT. SHOULD BE MUCH MORE DETAILED
describe("DirectDebitFactory", function() {
it("test owner", async function() {
const DirectDebitFactory = await ethers.getContractFactory("DirectDebitFactory");
const instance = await DirectDebitFactory.... | true |
b2f585286d7319d7e239ac8fb66b0fd86d394d29 | JavaScript | cristinarojas/checkOutReactProject | /src/app/weather/actions/weatherActions.js | UTF-8 | 2,258 | 3.171875 | 3 | [] | no_license | // Action Types.
import {
SEARCH_WEATHER_REQUEST,
SEARCH_WEATHER_SUCCESS,
SEARCH_WEATHER_ERROR,
SHOW_INFO
} from './actionTypes';
// Consuming a service.
import axios from 'axios';
// Base Actions - invented by carlos functions
// where you can pass type of action or a payload
// and will be return object for... | true |
151b2fe90b59cf239c18d241c5706e84250b9156 | JavaScript | mbeamen2014/quiz | /app.js | UTF-8 | 4,219 | 3.25 | 3 | [] | no_license | $(document).ready(function() {
//var questionList = getQuestions();
// init vars
var currentQuestion = 0,
score = 0,
askingQuestion = true;
var linebreak = document.createElement("br");
var content = document.getElementById('space'),
questionContainer = document.getElementById('questionText'),
... | true |
7340b403d59409e9496839652a07fe086ea4b366 | JavaScript | lalbricenov/finanzasVolta | /src/cotizar.js | UTF-8 | 3,810 | 3.15625 | 3 | [] | no_license | const axios = require('axios');
const apiKey = require('./config/keys').API_KEY;
const Company = require('./models/Company');
const cotizarFull = async function(symbol){
let response;
try{
response = await axios.get(`https://cloud.iexapis.com/stable/stock/${symbol}/quote?token=${apiKey}`);
} catch... | true |
b0f2156fb87dc45a3b774b7c6d961770cc4f0bc7 | JavaScript | aashirwad01/custom-translator | /server.js | UTF-8 | 619 | 2.546875 | 3 | [] | no_license | const express = require('express');
var cors = require('cors')
var app = express()
app.use(cors())
function translate(text){
return text +" | " + text.split("").reverse().join("");
}
app.get("/", (req, res) => {
res.send(" Go to translate")
})
app.get('/translate/mirror.json', (req, res) => {
console.log(req... | true |
e64dc908c9781527ee6f739f08417d336c0c7444 | JavaScript | andyruwruw/enhanced-spotify-api | /src/lib/models/Show.js | UTF-8 | 13,747 | 2.859375 | 3 | [
"MIT"
] | permissive | const Models = require('../../index');
/**
* Creates a new Show Instance for a given show
*
* @param {object | string} data Data to be preloaded,
* Must either be a string of the show ID or contain an `id` property
*/
function Show(data) {
if (typeof (data) === 'string') {
this.id = data;
this._episodes... | true |
4f376e8b35c1b7900c8390cb9bc52ac848fad2dc | JavaScript | Ulysses31/react-reduxtoolkit-hooks | /src/state/actions/post-actions.js | UTF-8 | 202 | 2.625 | 3 | [
"MIT"
] | permissive | const apiurl = 'https://jsonplaceholder.typicode.com/posts';
export const fetchApi = () => {
return fetch(apiurl)
.then((data) => data.json())
.then((resp) => {
return resp;
});
};
| true |
a054e559554de0fdd7354b15099d29dba2ef1ae3 | JavaScript | AndreiMoiceanu29/expensify-app | /src/playground/counter.js | UTF-8 | 1,898 | 3.171875 | 3 | [] | no_license | /*let count=0;
const addOne =()=>{
count++;
renderCouterApp();
}
const minusOne =()=>{
count--;
renderCouterApp();
}
const reset =()=>{
count=0;
renderCouterApp();
}
const renderCouterApp =()=>{
const templateTwo=(
<div>
<h1>Count :{count}</h1>
<button onClick... | true |
032a32678ba10dfa618e9fb68440c52d943f6624 | JavaScript | harshalitalele/DataStructure | /linkedlist.js | UTF-8 | 984 | 3.796875 | 4 | [
"MIT"
] | permissive | function node(val) {
this.val = val;
this.next = null;
}
function linkedList() {
this.head = null;
}
linkedList.prototype.addNode = function(node) {
node.next = this.head;
this.head = node;
}
linkedList.prototype.get = function(i) {
var curNode = this.head,
index = 0;
while(curNod... | true |
1fe271fbae6211b3d0a18ccd16c83f955bb0ef97 | JavaScript | urmastalimaa/interactive_frontend_development_2018 | /lecture_5/src/async_process_basics/actions/CommentServerActions.js | UTF-8 | 2,260 | 2.890625 | 3 | [
"MIT"
] | permissive | // Note that the Fetch API is not supported in every browser and may need to be
// polyfilled in production code:
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
import {
getCommentsRequested,
getCommentsFailed,
getCommentsSucceeded,
postCommentRequested,
postCommentFailed,
postCommentSucceed... | true |
f1d24f427708a3af8db5c8b91f951b774a9e4dcd | JavaScript | whitingba/mongo-news-scrape | /server.js | UTF-8 | 4,757 | 2.703125 | 3 | [] | no_license | //Require node packages
const express = require('express');
const logger = require('morgan');
const mongoose = require('mongoose');
const axios = require('axios');
const cheerio = require('cheerio');
//Require the models from my models folder
const db = require('./models');
//connection to port
var PORT = process.e... | true |
2972859d91cb256c7473d68f42701f6e12ce3b9d | JavaScript | mihar-22/preact-hooks-event | /src/__tests__/index.test.js | UTF-8 | 1,389 | 2.515625 | 3 | [
"MIT"
] | permissive | /** @jsx h */
import { h } from 'preact'
import { render } from '@testing-library/preact'
import useEventListener from '..'
describe('useEventListener', () => {
const mouseMoveEvent = { clientX: 100, clientY: 200 }
let mockHandler = null
const mockElement = {
addEventListener: (eventName, handler) => {
... | true |
cf1b518c3d5f7e756885d508d53f23e0149b1442 | JavaScript | leomos/hyp | /public/assets/js/CartModel.js | UTF-8 | 3,115 | 2.796875 | 3 | [] | no_license | var CartModel = function() {
this.bookQuantities = [];
this.books = [];
this.error = null;
this.fetchCartEvent = new Event(this);
};
CartModel.prototype = {
getBookQuantities: function() {
return this.bookQuantities;
},
getBooks: function() {
return this.books;
},
putBook: function (book... | true |
f626fc94619c09a9d75f6d26fdcc983ae176ee60 | JavaScript | faizkhan12/LeetCode | /2. Add Two Numbers.js | UTF-8 | 1,338 | 3.875 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
*/
/**
* @param {ListNode} l1
* @param {ListNode} l2
* @return {ListNode}
*/
var addTwoNumbers = function (l1, l2) {
let tail, head ... | true |
8b0b94da2328a9e61099d6da0eb6465d16bd5035 | JavaScript | heyork/D-Dsim | /Player Creator/js/scripts.js | UTF-8 | 41,170 | 2.609375 | 3 | [] | no_license | var PlayerName;
var PlayerRace;
var PlayerClass;
var PlayerGender;
var PlayerLevel;
var PlayerStrength;
var PlayerConstitution;
var PlayerDexterity;
var PlayerIntelligence;
var PlayerWisdom;
var PlayerCharisma;
var PlayerAlignment;
var PlayerBackground;
var PlayerGold;
var PlayerExperience;
var availablePowers;
var cho... | true |
395629663a2375f67de71301b6b0e6a775861cfc | JavaScript | devendraprasad1984/PHP_APIs | /codes/StateMemo.js | UTF-8 | 2,538 | 2.515625 | 3 | [] | no_license | import React, {useState} from 'react';
import {Accordion} from 'semantic-ui-react';
import ReduxTodo from "./ReduxTodo";
import BackNext from "./BackNext";
import ReduxMailExample from "./ReduxMailExample";
import QRApp from "./QR";
export const StateMemo = () => {
const [activeIndex, setActiveIndex] = useState(0)... | true |
32f1d4601aaabf683861526b3b2ea0f26ea05701 | JavaScript | CodingCarlos/modelate | /lib/validators/required.js | UTF-8 | 259 | 2.546875 | 3 | [
"MIT"
] | permissive | /**
* Required validator
*
* {
* required: Boolean
* }
*/
function isValid(data, model) {
if (!model.required) {
return true;
}
if(model.required && typeof data !== 'undefined') {
return true;
}
return false;
}
module.exports = isValid;
| true |
6b9c556ec7881c63aecdda4768d482d336535733 | JavaScript | tblane88/unit-4-game | /assets/javascript/hiddenGame.js | UTF-8 | 8,659 | 2.765625 | 3 | [] | no_license | $(document).ready(function() {
// global variables
var opponentPicked = false;
var heroPicked = false;
var hero = "";
var defender = "";
var heroScore = 0;
var defenderScore = 0;
var heroAttack = 0;
var defenderAttack = 0;
var defenderID = "";
var defenderAmt = 0;
var add... | true |
d1a265762f35cfc41c013d498af61c4382ba6681 | JavaScript | devinupreti/web-dev-exercises | /learnyounode/fileExt.js | UTF-8 | 1,068 | 3.265625 | 3 | [] | no_license | /*
Program Number : 5
Problem Description : Get files in path with extension
Date : May 28, 2019
Author : Devin Upreti
*/
const fs = require("fs");
const path = require("path");
const filePath = process.argv[2];
const extension = "." + process.argv[3];
function withoutModular() {
fs.readdir(filePath, (err, files) =... | true |
54c5bfd2927fbce54eeb0cdc2b36f38d17e2680b | JavaScript | simonswain/ratsofthemaze | /server/app/js/actors/king.js | UTF-8 | 9,969 | 2.71875 | 3 | [] | no_license | /* global Actors, Actor, Vec3, VecR */
Actors.King = function (env, refs, attrs) {
this.env = env;
this.refs = refs;
this.opts = this.genOpts();
this.attrs = this.genAttrs(attrs);
this.init(attrs);
};
Actors.King.prototype = Object.create(Actor.prototype);
Actors.King.prototype.title = 'King';
Actors.King... | true |
f0b7014e68a175ad5bf002c833c31bc27d486f9b | JavaScript | zhetian9527/mysys | /js/users.js | UTF-8 | 2,728 | 2.75 | 3 | [] | no_license | $(function() {
getList();
$("#search").click(function() {
var Search_box = $("#Search_box").val();
$.post(
"http://127.0.0.1:3000/api/user/Search",
{
Search_box: Search_box
},
function(res) {
if (res.code == 0) {
var list = res.data[0];
var str ... | true |
fca8839ee663465b0fa1ead5b29e86d5dfa30a24 | JavaScript | LeonardoRios/react-google-charts | /src/docs/Animations/generate-data.js | UTF-8 | 1,512 | 2.9375 | 3 | [
"MIT"
] | permissive | const rand = n => {
return Math.random() * 8 * n;
};
export const generateData = () => {
return [
["Age", "Weight"],
[rand(8), rand(12)],
[rand(4), rand(5.5)],
[rand(1), rand(14)],
[rand(4), rand(5)],
[rand(3), rand(3.5)],
[rand(6), rand(7)],
[rand(8), rand(12)],
[rand(4), rand(5... | true |
babd9f741d2fec5968f34c994bb37552aa007945 | JavaScript | MizuBishi/p2p | /test/unit/middleware/calculateProgress.test.js | UTF-8 | 3,083 | 2.625 | 3 | [] | no_license | /* eslint-env mocha */
import { assert } from 'chai';
import calculateProgress from '../../../src/middleware/utils/calculateProgress.js';
describe('middleware/utils/calculateProgress', () => {
it('empty', () => {
assert.equal(calculateProgress({
name: 'Test Person',
categories: [],
}), 0);
... | true |
0cea8cf57ba2b54862de1c811547a6f1ef115771 | JavaScript | dgan11/gm-app | /scripts/run.js | UTF-8 | 2,035 | 2.984375 | 3 | [] | no_license | const main = async () => {
const [owner, randomPerson] = await hre.ethers.getSigners();
// Compile our contract
// hre (hardhat runtime environment) -- built on the fly when you run `npx hardhat` in terminal
const GmContractFactory = await hre.ethers.getContractFactory("GmPortal");
// Deploy our contract to... | true |
3a4b7a00f8542df567165a45a0cf564ee1c0ff1a | JavaScript | Sonnax-Transmission-Company/project_management_react | /src/App.js | UTF-8 | 3,405 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios'
import './App.css';
import ProjectsContainer from './components/ProjectsContainer'
import InProgressContainer from './components/InProgressContainer'
import CompleteContainer from './components/CompleteContainer'
class App extends Component {
cons... | true |
18e5f071256825c23ef25ef2cdaca38293a4ed46 | JavaScript | rafikis23/PlayStoreSinAngular | /js/controlador.js | UTF-8 | 11,989 | 2.796875 | 3 | [] | no_license | var aplicaciones = [];
//
var localStorage = window.localStorage;
var indiceAppSeleccionada = null;
if(localStorage.getItem('aplicaciones') == '') {
localStorage.setItem('aplicaciones', JSON.stringify(aplicaciones)); //de JSON a cadena;
} else {
aplicaciones = JSON.parse(localStorage.getItem('aplicaciones'));... | true |
e9887e665c0fce6780dcb6983800c1bd3485615c | JavaScript | leey56522/SPR_Project | /index.js | UTF-8 | 3,218 | 3.765625 | 4 | [] | no_license | const body = document.querySelector('body');
const rock = document.querySelector('#Rock');
const paper = document.querySelector('#Paper');
const scissors = document.querySelector('#Scissors');
const playerPick = document.getElementById('player');
const computerPick = document.getElementById('computer');
const playerOut... | true |
26e22497a37f7c7955e375be8f27de3ab2a1e284 | JavaScript | xiayefeng/cli3_demo | /src/utils/observer.js | UTF-8 | 527 | 3.359375 | 3 | [] | no_license | /**
* 观察者模式
*/
// 定义一个主体对象
export class Subject {
constructor () {
this.Observer = []
}
add (observer) {
this.Observer.push(observer)
}
remove (observer) {
this.Observer.filter(item => item === observer)
}
notify () {
this.Observer.forEach(item => {
item.update()
})
}
}
... | true |
85a763d6fd8aa72b7962d9cf83761f5db80f1fbc | JavaScript | g4l/mailbox-app | /src/components/Contacts/createContact/createContact.controller.js | UTF-8 | 752 | 2.796875 | 3 | [] | no_license | class CreateContact{
constructor() {
this.fullName = "";
this.email = "";
this.birthdate = "";
this.gender = "";
this.address = "";
this.avatarUrl = "";
}
create() {
let contactToSave = {
fullName: this.fullName,
email: this.email,
birthdate: isFinite( new Date(this.birthdate) ) ? this... | true |
314752d1082f2ecc9b85cf711365277dd3d6d051 | JavaScript | sudo-javabot/Scritch-streaming-service | /main.js | UTF-8 | 1,956 | 3.34375 | 3 | [] | no_license | const Scratch = require("scratch3-api");
var fs = require("fs");
var session;
var cloud;
async function main() {
session = await Scratch.UserSession.create("username", "password");
cloud = await session.cloudSession("572117964");
}
main();
let FRAME1 = name("@frame");
let FRAME2 = name("@frame");
let... | true |
c8fa25431b33c9958786f4fd8f99a536979c8e39 | JavaScript | icezeros/out-pressure | /service/serialPort/pressure.js | UTF-8 | 879 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | const moment = require('dayjs');
const _ = require('lodash');
const iconv = require('iconv-lite');
// 引入数据编码格式转换模块
let flag;
function analyData({ time, data }) {
const tmpMessage = iconv.decode(data, 'ascii');
if (!flag) {
flag = {
start: 100,
end: 0,
};
_.forEach(tmpMessage, (v, k) => {
... | true |
61db5f2075e8fae02e78c7e5e6327f875eb47cd7 | JavaScript | agodi/cs498-narrative-visualization | /initial-scene.js | UTF-8 | 6,530 | 2.78125 | 3 | [] | no_license | const width = 500;
const height = 500;
const margin = 50;
const yearStatsMap = new Map();
const commitsUrl = "https://api.github.com/repos/washingtonpost/data-police-shootings/commits";
const dataUrl = "https://raw.githubusercontent.com/washingtonpost/data-police-shootings/master/fatal-police-shootings-data.csv";
... | true |
72c24ff6d3664b3aa50aa92bd0bfb6181ad6d4c6 | JavaScript | adams549659584/nodejs-book-samples | /samples/stream-demo/stream-finish.js | UTF-8 | 254 | 2.765625 | 3 | [] | no_license | const fs = require('fs');
const writable = fs.createWriteStream('write-data.txt');
for (let i = 0; i < 10; i++) {
writable.write(`写入 #${i}!\n`);
}
writable.end('写入结尾\n');
writable.on('finish', () => {
console.log('写入已完成');
}) | true |
b7dd6426ac5fecfb639844ea02102a288379405b | JavaScript | liteshotv3/codingTests | /public_html/6-21-17javascript/reverseNumber.js | UTF-8 | 218 | 3.671875 | 4 | [] | no_license |
var number = 12345;
function reverseNumber(number)
{
var answer = 0;
while (number > 0)
{
answer = answer * 10 + (number % 10);
number = Math.floor(number / 10);
}
return answer;
} | true |
d3e9cd72b71f6d68a235c2b5bcc6d9c8109cf6e1 | JavaScript | jackytck/sha1-file-web | /example/src/index.js | UTF-8 | 2,065 | 3.078125 | 3 | [
"MIT"
] | permissive | import sha1sum from 'sha1-file-web'
const input = document.querySelector('input')
const preview = document.querySelector('.preview')
const time = document.getElementById('time')
function validFileType (file) {
const fileTypes = [
'image/jpeg',
'image/pjpeg',
'image/png'
]
for (let i = 0; i < fileTyp... | true |
a2093173d9e4b8e85d78cfc3f8f94d1312fde6a8 | JavaScript | AnantVishwakarma/medico-healthcare | /js/register.js | UTF-8 | 3,748 | 3.359375 | 3 | [] | no_license | const displayError = document.querySelector(".display-error");
const sex = document.getElementById("registration-form").sex;
sex.style.color = "gray";
sex.options[1].style.color = "black";
sex.options[2].style.color = "black";
sex.addEventListener("change", function (event) {
if (sex.value != "") sex.style.color ... | true |
d43b09ac3e70f55cdc39b8d1f0b139166db33cad | JavaScript | silentmatt/utils.js | /src/utils/DateUtil.js | UTF-8 | 1,300 | 2.9375 | 3 | [
"MIT"
] | permissive | var DateUtil = {
clone: function(date)
{
return new Date(date.getTime());
},
/*
delta: function(info, now)
{
// info = { days:-1, hours:0, minutes:0, milliseconds:0 }
},
*/
/*
hhmm: function(hours, minutes, separator)
{
var hh = StringUtil.padZeros(ho... | true |
a7ce9528db6c7b358d548aa7770c54acdbfed532 | JavaScript | AnasBInRiaz123/fb-post | /src/index.js | UTF-8 | 1,029 | 2.625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import "./index.css"
import ava1 from "./image/ava1.png"
import ava2 from "./image/ava2.png"
import ava3 from "./image/ava3.png"
import avatar from "./image/whatisavatar.jpg"
import avatar1 from "./image/whatisavatar1.jpg"
import avatar2 from "./image/whatis... | true |
7ff7752fe1c99c4c7fc56a6a4e30c64b90ebd29a | JavaScript | AlvertosFIorantis/single_page_bootsrap | /js/app.js | UTF-8 | 723 | 2.625 | 3 | [
"MIT"
] | permissive | function LivaTranslateUK() {
document.getElementById('livaCard').classList.add('rotate-sinergates')
}
function LivaTranslateGreek() {
document.getElementById('livaCard').classList.remove('rotate-sinergates')
}
function KolivakisTranslateUK() {
document.getElementById('kolivakisCard').classList.add('rotate-siner... | true |
3d0bbef2a34f8a7037c4f8c3dc044a9c4ca55a1d | JavaScript | lmaran/matemaraton | /src/controllers/exercise.controller.js | UTF-8 | 11,530 | 2.6875 | 3 | [] | no_license | const exerciseService = require("../services/exercise.service");
const idGeneratorMongoService = require("../services/id-generator-mongo.service");
const autz = require("../services/autz.service");
const markdownService = require("../services/markdown.service");
const { availableExerciseTypes } = require("../constants... | true |
a1f4da0216adca35f7c8e1f7cd4dc8f9a814f3a2 | JavaScript | PirialMersus/codewars | /js/main1.js | UTF-8 | 22,915 | 3.71875 | 4 | [] | no_license | // function alphabetPosition(text) {
// let result = "";
// let arr = text.toLowerCase().split("");
// let filtered = arr.filter(
// (currentValue) =>
// currentValue.charCodeAt(0) > 96 && currentValue.charCodeAt(0) < 123
// );
// for (let i = 0; i < filtered.length; i++) {
// if (i !== filter... | true |
9045dc0542331527d7471104fab93bbabb642721 | JavaScript | ElenaTrehub/well-fed-home | /public/js/updateRecipe.js | UTF-8 | 4,116 | 2.921875 | 3 | [
"MIT"
] | permissive | let ingredients = [];
let i = 0;
window.onload = function() {
let ingredientsStr = document.getElementById('ingredients').value;
if(ingredientsStr.length > 0){
ingredients = ingredientsStr.split(';');
for(let i =0; i<ingredients.length-1; i++){
ingredients[i] = ingredients[i] + ';';... | true |
3aae5ae3487a008eb9c677090929b69a56581953 | JavaScript | shermanhui/frontend-nanodegree-arcade-game | /js/app.js | UTF-8 | 6,131 | 3.265625 | 3 | [
"MIT"
] | permissive | // TODO: ADD MENU SCREEN
// TODO: ADD CHARACTER, LEVEL, DIFFICULTY SETTING
// TODO: REDESIGN LEVEL LAYOUT
// TODO: REDESIGN CHARACTERS
var TILE_WIDTH = 101;
var TILE_HEIGHT = (171/2);
var ENEMY_START = -100;
var XPOS = [-2, 99, 200, 301, 402];
var YPOS = [58, 143.5, 229];
var GEM_IMAGES = ['images/gem-orange.png', 'im... | true |
f9269981c1db22a7bc898307996dbb2ada2a687e | JavaScript | ShiShiXu/nodejs | /stream/pipe/pipe.js | UTF-8 | 1,034 | 3.109375 | 3 | [] | no_license | /**
* Created by KidSirZ4i on 2016/5/5.
*/
//加载fs模块
var fs = require("fs");
// 创建一个可读流
var readerStream = fs.createReadStream(__dirname+'/from.txt');
// 创建一个可写流
var writerStream = fs.createWriteStream(__dirname+'/to.txt');
// 管道读写操作
// 读取 from.txt 文件内容,并将内容写入到 to.txt 文件中
readerStream.pipe(writerStream);
console.... | true |
b33878685d57d87f71b6914918efa6df04029510 | JavaScript | Qazzian/tasklist | /server/lib/util.js | UTF-8 | 724 | 2.9375 | 3 | [] | no_license | var _ = require('lodash');
module.exports = {
/**
* Check that all the keys in the first object (testobj) are defined in the second object (authorityObj).
* Does not look at inherited attributes of either object.
*
* @param testObj - the object that needs to be checked.
* @param authorityObj - The objct t... | true |
820af2f71858c57b22b0e6c12594f1b80e350873 | JavaScript | jmedina16/SMH_API_APPS | /apps/scripts/lib/js/kmc1common.js | UTF-8 | 2,386 | 2.53125 | 3 | [] | no_license | // cookie functions
function getCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf... | true |
44366bbf3cfa8692bbb940574ffe5be5d70af4de | JavaScript | goldsmith/diff-eq-grapher | /graph.js | UTF-8 | 3,116 | 3.3125 | 3 | [] | no_license | //http://staff.washington.edu/grigg/
scale = 50
function Point (x, y) {
this.x = x
this.y = y
}
function DrawLine(point1, point2, color) {
ctx.strokeStyle = color
ctx.beginPath()
ctx.moveTo(point1.x, point1.y)
ctx.lineTo(point2.x, point2.y)
if (color === "purple") {
ctx.lineWidth=3.0
ctx.stroke()
ctx.lin... | true |
a87786c96236e27c1568ed75f8eaed4321d3375f | JavaScript | carlosprointersl/Preventa | /PreventaDroid/Resources/ui/common/views/Informes/Tables/ClientsData.js | UTF-8 | 2,792 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | /**
* @fileOverview En este archivo se crean las filas para la tabla de clientes. Estas filas contienen los datos relacionados con los clientes editados.
*
* @author <a href="mailto:juancarlos@prointersl.com">Juan Carlos Matilla</a>
* @version 1.0
*/
/**
* Consulta los clientes editados, según los parámetros, y ... | true |
3e21277e751d4d917ae728415ab773f512a95479 | JavaScript | justBboy/tictactoe-android | /js/index.js | UTF-8 | 2,909 | 3.484375 | 3 | [] | no_license |
var Game = {
huPlayer : "O",
aiPlayer : "X",
winCombos : [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[6, 4, 2]
],
cells : document.querySelectorAll(".cell"),
init: function(){
document.q... | true |
4099ce680534a9bc90a27c5adfd3d280f9d5b0ae | JavaScript | amituuush/cats | /src/components/CardContainer/CardContainer.js | UTF-8 | 3,339 | 2.640625 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
import Card from '../Card/Card';
import './card-container.scss';
class CardContainer extends Component {
constructor(props) {
super(props);
this.handleSortedChange = this.handleSortedChange.bind(this);
}
handleSortedChange(e) {
this.props.sortCa... | true |
c0b74269d9d15481ca9f00ddcdd373a4079b3928 | JavaScript | Coder2100/NodeJS-Notes | /node_file_upload.js | UTF-8 | 2,916 | 3.375 | 3 | [] | no_license | /*Node.js Upload Files
There is a very good module for working with file uploads, called "Formidable".
The Formidable module can be downloaded and installed using NPM:
//npm install formidable
*/
// usage
/*
var formidable = require('formidable');
// steps to use the package and successfully upload file
//Step ... | true |
01c59ff1651029ca4959caa442ab2f2f5feb0061 | JavaScript | arnondao/lapland_code | /resources/js/reducers/videos.js | UTF-8 | 2,223 | 2.546875 | 3 | [] | no_license | import { fromJS } from 'immutable';
import * as types from '../constants/actionTypes';
const videosInitialState = fromJS( [] );
export default function videos ( state = videosInitialState, action ) {
switch ( action.type ) {
case types.ADD_INLINE_VIDEO:
return state.push( fromJS( {
... | true |
f15bf46b38fa506a9105e417c565266e97762765 | JavaScript | spinorial/react-basic | /src/js/Testing/test-store.js | UTF-8 | 1,538 | 2.90625 | 3 | [] | no_license | import {createStore} from 'redux';
//TODO: Export these to a separate file that can be easily changed for different servers
const baseURL = 'https://guidelines.joe:8890/';
const guidelinesURL = 'wp-json/guideline/filter/title=notitle';
const routeURL = baseURL + guidelinesURL;
/*
* Defualt State to be used in the ... | true |
875f595a5ddc41febf83e91dc143c7b28fe3758c | JavaScript | shaurya3007/shaurya07 | /Slingshot.js | UTF-8 | 1,529 | 2.640625 | 3 | [] | no_license | class Slingshot
{
constructor(b1, p2)
{
var options = {'bodyA':b1,'pointB': p2, 'stiffness': 0.04, 'length': 10};
this.sling = Constraint.create(options);
World.add(myWorld, this.sling);
this.sling1 = loadImage("sprites/sling1.png");
this.sling2 = loadImage("sprites/sli... | true |
3aa4a8f0d5bf397f8faf1fc30261570bbf0dade3 | JavaScript | jdoleary/SymptomCorrelator | /js/util.js | UTF-8 | 598 | 2.90625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | const util = {
autoComplete:
function autoComplete(input,list){
if(!input || input.length == 0){
return null;
}
const results = [];
const inList = JSON.parse(JSON.stringify(list));
inList.sort();
for(var i = 0; i < inList.length; i++){
if(inList[i].startsWith(i... | true |
aa03b8782054649374f3761f4be6af828430bd3a | JavaScript | greatgy/Code | /Proj-supergenius-life/Web/src/main/webapp/js/pages/comment-1.0.0.js | UTF-8 | 5,462 | 2.84375 | 3 | [] | no_license | /****************************************************************************************
*天财评论为例: 评论回复是通过js—comment.js实现,该js会在页面加载完毕后,调用id以btncomment开头的元素,通过传入Echanel(板块finance)_oid(用户oid)_uid(详细财经uid)并通过异步方法,
*将数据组织为html在指定区域中显示
*
*详细:
*1、这是一个加在jQuery原型上的插件,规定页面上连接标签,如果是以btncomment开头的话,点击后则会触发此插件功能
*2、触发连接后,将会触... | true |
4085491a916b073475a59669d822294ddcba0cd6 | JavaScript | NBALAJI95/Jamakkol-Prasannam | /src/Components/supplementaryPlanets.js | UTF-8 | 1,999 | 2.546875 | 3 | [] | no_license | const rahuKalam = {
கதிரவன்: { day: 180, night: 84 },
மதி: { day: 36, night: 108 },
சேய்: { day: 154, night: 60 },
மால்: { day: 108, night: 180 },
பொன்: { day: 132, night: 36 },
புகர்: { day: 84, night: 154 },
மந்தன்: { day: 60, night: 132 }
};
const mrthyu = {
கதிரவன்: { day: 60, night... | true |
ed0934f47af672e74282505d5a73f10c66c833fa | JavaScript | amwebexpert/grails-react-app | /client/app/containers/About/saga.js | UTF-8 | 1,059 | 2.75 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /**
* Gets the App About info from backend server
*/
import { call, put, takeLatest, delay } from 'redux-saga/effects';
import request from 'utils/request';
import { aboutInfoLoaded, aboutInfoLoadingError } from './actions';
import { LOAD_ABOUT_INFO } from './constants';
export function* getAboutInfo() {
const re... | true |
34d3193583bfa20587d1f3b129be09ee8bc63517 | JavaScript | woodheadlucy/hangman | /src/components/WrongLetters/WrongLetters.js | UTF-8 | 800 | 2.96875 | 3 | [] | no_license | import React, { Component } from 'react';
import './WrongLetters.css';
class WrongLetters extends Component {
getWrongLetters() {
const wrong = this.props.guessedLetters.filter(letter => {
return !this.props.word.split('').includes(letter)
})
return wrong
}
render() ... | true |
a8fb144f6b0b61cf4fabcd0eb589c5e36e236496 | JavaScript | dxc1995/shandiqikes.github.io | /No-delay-menu/js/megadropdown.js | UTF-8 | 3,317 | 2.6875 | 3 | [
"MIT"
] | permissive | $(function(){
var sub=$('#sub');
var activeRow;//选中的行
var activeMenu;//选中的行对应的二级菜单
var timer;//setTimeout返回的计时器id
var mouseInSub=false;//当前鼠标是否在子菜单里
sub.on('mouseenter',function(e){
mouseInSub=true;
}).on('mouseleave',function(e){
mouseInSub=false;
});
//创建数组,记录
var... | true |
06e13ca9c32c14e781e152e8f82c6425dd86407a | JavaScript | qq377677616/wc190528lvzhan | /ch_pc/js/typewriter.js | UTF-8 | 1,494 | 2.953125 | 3 | [
"MIT"
] | permissive | $(function(){
var self;//当前文本
var text;//当前文本内容
var index=0;//下标
var speed=200;//打字速率
var typewriters=null;//定时打字器
var isCursor=false;//是否显示光标
var isEndCursor=true;//打字完毕后是否显示光标
var cursorStyle="#000";//光标颜色
function autoAdd(){
self.find("b").remove();
self.append(text.sub... | true |
668ea6b5453bbfad61330337dd17ed7bc3f8e026 | JavaScript | chiel/scols | /index.js | UTF-8 | 4,847 | 2.78125 | 3 | [
"MIT"
] | permissive | 'use strict';
var getScrollTop = function() {
return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
};
/**
* SCols
*
* @param {Element} container
* @param {Object} options
* @param {Object} options.colSelector - Column... | true |
d419df8f5e4fa01eb740c0f991620159d47bc0a0 | JavaScript | Srkinator/BitVezbe | /bit/bit-web/Projekat Ajax week 5/js/single.js | UTF-8 | 1,238 | 2.8125 | 3 | [] | no_license | var id = localStorage.getItem('key');
var singleShow = $.ajax({
url: 'http://api.tvmaze.com/shows/' + id,
method: 'GET',
data: {
embed: ['seasons', 'cast']
}
});
singleShow.done(e => {
console.log(e);
let title = $("<h1>");
let img = $("<img>");
let titleMovie = e.name;
le... | true |
6857833acd570a79b870c7d65999af7127357f95 | JavaScript | xxristoskk/curation-station-2 | /bandmapV2/static/js/map.js | UTF-8 | 5,166 | 2.578125 | 3 | [] | no_license | function closeNav() {
$('#sideFeats').css('width', '0');
$('#map-container').css('left', '0');
$('#topnav').css('display','none');
}
/*
Using this in the future to utilize APIView
// get geoJSON
document.getElementById('geojson').onload = function {getGeoJson()};
let geojson;
function ge... | true |
4f68459fd7ce9182d170d97d79b1c1867936cd9d | JavaScript | fndos/Control-de-Visitas-Web | /educate/accounts/static/accounts/js/color.js | UTF-8 | 432 | 2.6875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
changeColor();
console.log("Running Fundación Educate & Colors...")
});
$(document).bind("DOMSubtreeModified", changeColor);
function changeColor() {
var colors = ['#fff5e0', '#f9ffbe', '#e1ffce', '#d7e8e6', '#fbe8ff']
var i = 0;
$(".item").each(function() {
$(this).css... | true |
89dd1fd8d09b4d5be19f19d613215b0b19e87369 | JavaScript | juliakhryst/mongoDB_HW | /controllers/user.js | UTF-8 | 1,838 | 2.671875 | 3 | [] | no_license | const User = require('../models/user');
const Article = require('../models/article');
module.exports = {createUser, getUser, updateUser, deleteUser,getUserArticles};
function createUser(req, res) {
let newUser = new User({
firstName: req.body.firstName,
lastName:req.body.lastName,
role: req.body... | true |
afaa5fbe8dfc2c5c225301b9c54809e8fd81fb37 | JavaScript | JS00001/js-util | /lib/functions/hashString.js | UTF-8 | 278 | 2.515625 | 3 | [] | no_license | 'use strict'
/**
* Module Exports
*/
module.exports = hashString
/**
* @param {String} string
* @param {String} digest
*/
function hashString(string, digest) {
const crypto = require('crypto');
return crypto.createHash('sha256').update(string).digest(digest);
} | true |
80335a90e65bb6db031806ffec301385fe86ee40 | JavaScript | IsseiMori/CMPS160 | /Programming/Prog1/Prog1.js | UTF-8 | 5,112 | 2.796875 | 3 | [] | no_license | var VSHADER_SOURCE =
'attribute vec4 a_Position;\n' +
'void main(){\n' +
' gl_Position = a_Position;\n' +
'}\n';
var FSHADER_SOURCE =
'void main(){\n' +
' gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n' +
'}\n';
function main(){
var canvas = document.getElementById('webgl');
if(!canvas){
console.log("failed t... | true |
e655cb5143cbea2de16104ebd56d0619ab271074 | JavaScript | iaroslavnikitin/Codewars-Katas-1 | /katas/javascript/string-transformer.js | UTF-8 | 791 | 3.84375 | 4 | [] | no_license | function stringTransformer(str) {
let arr = str.split(' ');
let reversedArr = [];
for(let i = arr.length - 1; i >= 0; i--){
reversedArr.push(arr[i]);
}
for(let i = 0; i < reversedArr.length; i++){
reversedArr[i] = reversedArr[i].split('');
}
for(let i = 0; i < reversedArr.length; i++){
fo... | true |
c8d68c09749f4eb15022f62532af067ea20d0949 | JavaScript | reneesarley/sudoku | /spec/game-spec.js | UTF-8 | 4,613 | 2.90625 | 3 | [] | no_license | import {Game} from '../src/game';
describe ('Game', function() {
let winningGame;
let incompleteGameBoard;
let twoRowGameBoard;
let twoRowGameBoardFail;
let oneRowGameBoard;
let oneRowGameBoardFail;
let testNewGame = new Game();
beforeEach(function() {
winningGame = new Game();
winningGame.us... | true |
91d8e007e40d00a9dfe654a8c1f77cf37c8fe2d7 | JavaScript | leyi0924/Multi-User-Social-Web | /Backend/spec/articles.spec.js | UTF-8 | 3,317 | 2.703125 | 3 | [] | no_license | /*
* Test suite for articles
*/
const fetch = require('isomorphic-fetch');
const url = path => `https://protected-earth-75479.herokuapp.com${path}`
const Article = require('../src/model.js').Article
describe('Validate Article functionality', () => {
it('GET /articles (should return at least 5 articles if test ... | true |
5b7ae4a9c547b3b0d79ae6d24b98cce181cd4ea4 | JavaScript | anguyenkn/py4web-vue | /grader/hw8grader/CSE_183_Spring_2020_Assignment_8_Submission_2/static/js/index.js | UTF-8 | 6,849 | 2.734375 | 3 | [] | no_license | // This will be the object that will contain the Vue attributes
// and be used to initialize it.
let app = {};
// Given an empty app object, initializes it filling its attributes,
// creates a Vue instance, and then initializes the Vue instance.
let init = (app) => {
// This is the Vue data.
app.data... | true |
0a76da9ab187f238e3f32f318d48245f6af4bbc1 | JavaScript | haru-programming/coding_practice--2 | /js/fixed-header.js | UTF-8 | 322 | 2.765625 | 3 | [] | no_license | $(function () {
//fvを超えたらスクロールでheaderに色を付ける
var mainPos = $(".header").height();
$(window).scroll(function () {
if ($(window).scrollTop() > mainPos) {
$(".header__top").addClass("transform");
} else {
$(".header__top").removeClass("transform");
}
});
});
| true |