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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e00311bb832cabc72c5d72bae4760258b2426365 | JavaScript | rjt-rockx/sapphyr | /modules/nadekoconnector/awardRole.js | UTF-8 | 1,985 | 2.546875 | 3 | [
"MIT"
] | permissive | const { RichEmbed } = require("discord.js");
module.exports = class AwardRole extends global.utils.baseCommand {
constructor(client) {
super(client, {
name: "awardrole",
memberName: "awardrole",
userPermissions: ["ADMINISTRATOR"],
clientPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
group: "nadekocon... | true |
8adb465ad58a6378212d967579d510d856983bb3 | JavaScript | jdecastroc/UErecord | /src/main/web/js/login.js | UTF-8 | 5,721 | 2.75 | 3 | [
"MIT"
] | permissive | /*************************************************************************
*
* @description
* The following code manage the triggering event handlers and call via AJAX the
* functions of the API through http protocol.
* The getCalendario function load the html of the record calendar page
* The getExpediente funct... | true |
468f128092915ed192b2e2975a326be0a55a0857 | JavaScript | DmitryKgit/algorithms | /9. Массивы/9U_flag.js | UTF-8 | 1,304 | 3.96875 | 4 | [] | no_license | /*
9U.js 13.03.2020
Дан список. Посчитайте, сколько в нем различных элементов, не изменяя самого списка.
Входные данные
Вводится список чисел. Все числа списка находятся на одной строке.
Выходные данные
Выведите ответ на задачу.
Примеры
входные данные
3 2 1 2 3
выходные данные
3
9U с флагом.
O(N^2), треугольная, с хо... | true |
f714890366191b825f20241a35b8613963157614 | JavaScript | mangama/unit-4-game | /assets/javascript/game.js | UTF-8 | 2,039 | 3.6875 | 4 | [] | no_license | $(document).ready(function () {
var wins = 0;
var losses = 0;
var targetedScore = 0;
var yourScore = 0;
var crystals = {
red: 0,
blue: 0,
yellow: 0,
green: 0
};
function getRandomIntInclusive(min, max) {
// min = Math.ceil(min);
// max = Math.floor(max);
return Math.floor(Math... | true |
90311296149eadc456b9bc5147e84c020eb82fed | JavaScript | RonkTsang/P2PDemo | /server/Peer.js | UTF-8 | 2,135 | 2.6875 | 3 | [] | no_license | const TYPE = require('./TYPE')
let peers = {}
let joinLs = {}
class Peer {
constructor(socket, data) {
this.socket = socket
this.id = socket.id
if (data) this.data = data
peers[this.id] = this
data && (this.name = data.name)
this.listen()
this.sendTYPE()
}
static ls() {
return Object.keys(peers)
... | true |
6acbfafaa8e86cb5d7740b5a6096e357504c3124 | JavaScript | Johnyworld/bang-cardpicker | /bang-pickcard.js | UTF-8 | 3,592 | 2.953125 | 3 | [] | no_license | window.onload = function() {
( function bangPickCard() {
var shapesArr = [ 'heart', 'club', 'spade', 'diamond' ];
var numberArr = [ 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K' ];
var canClick = true;
var shape = document.getElementById('shape');
... | true |
542df6789eadf700e62828e767f6513fbf2ab5b3 | JavaScript | Tetta/Orby | /Assets/z2D Physics Puzzle Kit/Scripts/JS/Managers/FeedbackManagerJS.js | UTF-8 | 3,681 | 2.734375 | 3 | [] | no_license | #pragma strict
public class FeedbackManagerJS extends MonoBehaviour
{
public enum TargetState { dragging, rotating};
public var target : ObjectBaseJS; //The target object
public var feedback : SpriteRenderer; //The feedback renderer
public var rotationSpeed : float; ... | true |
edd1c7ccf64e37d319f4e937c3451548e2eaa688 | JavaScript | idxiu/VueEditor | /dist/setTimeout.js | UTF-8 | 279 | 3.015625 | 3 | [] | no_license | let timer = null;
function interval(func,wait) {
let interv = function(){
func.call(null)
timer = setTimeout(interv,wait)//循环设置setTimeout模拟setInterval
}
timer = setTimeout(interv,wait)
}
interval(function(){
console.log("ok");
},1000) | true |
bc902b9b73e5c012e744ce042547294052b61b00 | JavaScript | ipartek/web-zalla | /inigo-vique/proyectos/javascript/js/ini-ej-3.js | UTF-8 | 661 | 2.578125 | 3 | [] | no_license | // Para que Jquery no de por culo
/* globals $ */
var header = document.getElementsByTagName('HEADER'),
footer = document.getElementsByTagName('FOOTER'),
main = document.getElementsByTagName('MAIN');
function modificador()
{
//console.log(header[0].clientHeight);
let height = window.innerHeight - foo... | true |
81f400aacc68d12a0f5dba0dab9cafa568bc6d15 | JavaScript | jfguan/jfguan.github.io | /src/App.js | UTF-8 | 3,444 | 2.765625 | 3 | [] | no_license | import './App.css';
import { useState, useEffect } from 'react'
import {AiOutlineInfoCircle, AiOutlineQuestionCircle} from 'react-icons/ai'
import InputBox from './InputBox';
import { evaluate } from 'mathjs';
import { Keyboard } from './components/Keyboard';
import { AboutModal } from './components/AboutModal';
import... | true |
5fa49f8d0897b83e91baa9a7a248f3d2ddbbc04a | JavaScript | proyectarse/redux-thunk-hook | /src/reducers/nameReducer.js | UTF-8 | 431 | 2.640625 | 3 | [] | no_license | import { ADD_EXAMPLE, FETCH_EXAMPLE } from '../actions/types';
const INITIAL_STATE = {
examples: 'primero',
name: '',
};
const nameReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ADD_EXAMPLE:
return {
...state,
examples: action.payload,
};
case FETCH_EXAMPLE:
return ... | true |
88950d948c40e8f8797487290010712930c75290 | JavaScript | aurora-yn/react-hooks | /src/components/useScroll.js | UTF-8 | 666 | 2.90625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
const useScroll = () => {
const [state, setState] = useState({ x:0, y:0 });
const onScroll = () => {
setState({x: window.scrollX, y: window.scrollY})
}
useEffect(() => {
window.addEventListener("scroll", onScroll);
return () => window.removeEvent... | true |
ad5718f5df3bb8d12f564d0190b5f74d76b81799 | JavaScript | arpit9667/algorithms-js | /test/algorithms/search/testBreadthFirstSearch.js | UTF-8 | 1,045 | 2.640625 | 3 | [
"MIT"
] | permissive | /* eslint-env mocha */
const bfs = require('../../../src').algorithms.search.bfs;
const assert = require('assert');
describe('BFS', () => {
it('should perform bfs on a tree', () => {
const tree = {
root: {
name: 'root',
children: [{
name: 'child_1',
children: [{
... | true |
bea4eb575e7d996d6b9388ba2d211d9432067098 | JavaScript | wIksS/Telerik-Academy | /School Academy/School Academy 2013-2014/JavaScript Fundamentals - October 2013/07. Strings/Solutions/06. ExtractTextFromHTML.js | UTF-8 | 605 | 3.875 | 4 | [
"MIT"
] | permissive | /*
06. Write a function that extracts the content of a html
page given as text. The function should return anything
that is in a tag, without the tags:
<html><head><title>Sample site</title></head><body>
<div>text<div>more text</div>and more...</div>in body</body></html>
result: Sample sitetextmore textand mor... | true |
e775f287eaeab62236ae6f619e12ca0856a302c8 | JavaScript | Kenford20/codeSignal | /community-challenges/alphabet-substring.js | UTF-8 | 483 | 4.46875 | 4 | [] | no_license | // Check whether the given string is a substring of the plaintext alphabet.
// Example
// For s = "efghi", the output should be
// alphabetSubstring(s) = true;
// For s = "bde", the output should be
// alphabetSubstring(s) = false.
function alphabetSubstring(s) {
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
... | true |
aec3419e221dbb0e3a32e251b0ab2c39d3b5ef31 | JavaScript | juljaVysotska/Lectrum | /lesson-16/3.js | UTF-8 | 1,684 | 4.40625 | 4 | [] | no_license | /**
* Задача 3.
*
* Улучшите класс Worker из предыдущей задачи.
* Для свойства rate и days добавьте методы для установки значений.
*
* Условия:
* - Реализация решения — это синтаксис современных классов JavaScript;
* - Приватные свойства необходимо объявить с помощью официального синтаксиса (#имяСвойства).
*/
... | true |
62bf028af59af93d8f54cadac0ee3b3209455720 | JavaScript | machv/esp8266-irrigator | /data/scripts.js | UTF-8 | 3,240 | 2.921875 | 3 | [] | no_license | function secondsToString(duration) {
if(duration == 0) {
return "00:00:00";
}
var sec_num = duration, hours, minutes, seconds;
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60... | true |
b7e3e2ac886776427dd752328150e26508610b88 | JavaScript | oskvortsov/simple-function-js | /src/functions/factorial/_test.spec.js | UTF-8 | 294 | 2.671875 | 3 | [] | no_license | const { factorial } = require('./index');
describe('factorial', () => {
test('factorial(0)', () => {
expect(factorial(0)).toBe(1);
});
test('factorial(1)', () => {
expect(factorial(1)).toBe(1);
});
test('factorial(6)', () => {
expect(factorial(6)).toBe(720);
});
});
| true |
d8cf692fbba574f0077d988bf0d0642206d0cd3c | JavaScript | StevenW1999/projectc | /ClientApp/src/pages/accountCreate/AccountCreate.js | UTF-8 | 9,202 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import './AccountCreate.css';
import { Form, Button, Row, Col } from 'react-bootstrap';
import Image from 'react-bootstrap/Image';
import defPic from '../../images/Default-User.jpg';
const fileTypes = [
"image/jpg",
"image/jpeg"... | true |
de1288731b9a6893bc728b95fbc05fd909215479 | JavaScript | manuestrella28/gsap-tools | /src/store.js | UTF-8 | 2,498 | 2.84375 | 3 | [
"MIT"
] | permissive | import EventEmitter from 'events';
import { TweenLite } from 'gsap';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
class Store extends EventEmitter {
animations = new Map()
// Return animations IDs
get keys() {
return Array.from(this.animations.keys());
}
// Return ... | true |
efedb981859303b575ed3740ec3916f42955a946 | JavaScript | markp112/vue-js-blog | /functions/sparkzCMS_saveToolBarProps.js | UTF-8 | 1,412 | 2.703125 | 3 | [] | no_license | //
// sparkzCMS_saveToolBarPRops.js
// Purpose: writes the updated toolbar props the user has changed to Dynamodb
// f
// created: 01 July 2019
// required parameter - dataItems
// contains the list of toolBarProps
// the siteKey - userId+SiteId
// subKey - Text field indicating the element to be updated
//
const AWS =... | true |
118ec13db84415ff661a85647bac5445542e2d3f | JavaScript | jparrish88/block_diagram | /js/resizer.js | UTF-8 | 11,304 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* Client-side image resizer module
*/
/*global require, define, window, console, atob, unescape, ArrayBuffer, Uint8Array, jQuery, document, setTimeout */
function dataURItoBlob(dataURI, callback) {
// convert base64 to raw binary data held in a string
// doesn't handle URLEncoded DataURIs
... | true |
031c9e9b4fd0c443de8add9883b36d04673093d9 | JavaScript | kaffedrikkeren/MathTesters | /multiplication.js | UTF-8 | 242 | 3.1875 | 3 | [] | no_license | const max1 = 10;
const max2 = 10;
function getNumber1() {
return getRandom(0, max1);
}
function getNumber2() {
return getRandom(0, max2);
}
function isAnswerCorrect(input1, input2, output) {
return output == input1 * input2;
}
| true |
a75267f6b42d0cdc0b01f63a4937bae30069ddae | JavaScript | bcantillano/INST377_Food_Inspection | /src/javascript/server.js | UTF-8 | 846 | 2.65625 | 3 | [] | no_license | // this is a single route, in the simplest possible format
// the simplest format is not necessarily the best one.
// this is, right now, an introduction to Callback Hell
// but it is okay for a first-level example
const express = require("express");
const fetch = require("node-fetch");
const app = express();
const P... | true |
fb3470bb2433b2280dda303c465db8581067a178 | JavaScript | davalos-adrian/8puzzle | /src/App.js | UTF-8 | 4,376 | 3.578125 | 4 | [] | no_license | import { update } from 'lodash';
import {useState} from 'react';
import Square from './Square';
var _ = require('lodash');
Array.prototype.inArray = function(comparer) {
for(var i=0; i < this.length; i++) {
if(comparer(this[i])) return true;
}
return false;
};
// adds an element to the array if it d... | true |
6073307ece9eddc63dee7a47042f89e3b63b61d7 | JavaScript | phamthao202/Movie-app | /src/App.js | UTF-8 | 4,173 | 2.53125 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import MovieList from "./components/MovieList";
import "./App.css";
import "bootstrap/dist/css/bootstrap.min.css";
import Navigation from "./components/Navigation";
import Pagination from "react-js-pagination";
import InputRange from "react-input-range";
import Filter... | true |
d69c0ed949111359480e523ad33c3fe5072dda61 | JavaScript | marianposaceanu/yahoo-open-hack-day | /js/tour.js | UTF-8 | 1,511 | 2.671875 | 3 | [] | no_license | var backend = 'http://tg.code5.ro/api/xhr.php' ;
var proxy = 'http://tg.code5.ro/api/proxy.php' ;
var fetchRankedLocations = function( callback ) {
$.ajax({
url : backend+'?get=rankedLocations' ,
dataType : 'json' ,
type : 'post' ,
success : function( waypoints ) {
callback( waypoints ) ;
}
}... | true |
72f34a16d6176e9ee2cf620acbf461cb03db1059 | JavaScript | xiul/jsHotDraw | /qunit/locatorHandle.js | UTF-8 | 2,528 | 2.78125 | 3 | [] | no_license | module("locatorHandle", {
teardown: function() {
var canvas = document.getElementById('canvas');
if (canvas) {
document.body.removeChild(canvas);
}
sl = null;
}
});
test("Constructor", function() {
var location = new Point(100,100);
var canvas = new Canvas(document);
var figure... | true |
e6452bc4322b39c6a4cbd131f41521528c363c11 | JavaScript | evamarmej/Portfolio_EvaMarchena | /HTML_CSS_JS_PHP/Formulario_HTML_CSS_JS/valid_total.js | UTF-8 | 5,344 | 2.953125 | 3 | [] | no_license |
window.onload = function () {
document.formularioContacto.calcdni.focus();
document.formularioContacto.addEventListener('submit', validarFormulario);
var fecha = new Date(); //Fecha actual
var hora = fecha.getHours(); //obteniendo mes
var minuto = fecha.getMinutes(); //obteniendo dia
var segun... | true |
e1637a43074bd12f8216d0abc968d08ab7877154 | JavaScript | Mahsan-code/javascripting | /strings.js | UTF-8 | 59 | 2.78125 | 3 | [] | no_license | const something = 'this is a string'
console.log(something) | true |
3414aa0a933da307bcaf5ed1edcdc5388633e18c | JavaScript | AriannaChau/recipe-converter | /js/script.js | UTF-8 | 95 | 2.9375 | 3 | [] | no_license | var gal = parseInt(prompt('How many gallons?'));
var liter = gal * 3.785411784
alert(liter);
| true |
c101676415db1348edd6f1b34873ad8e647cfcee | JavaScript | Jebacon/MyFy | /code/src/app/models/debt.model.js | UTF-8 | 2,901 | 2.578125 | 3 | [] | no_license | const sql = require("./db.js");
const Debt = function(debt) {
this.debtName = debt.debtName;
this.balance = debt.balance;
this.rate = debt.rate;
this.payTime = debt.payTime;
this.userId = debt.userId;
this.debtId = debt.debtId;
};
Debt.create = (debt, result) => {
sql.query("INSERT INTO debt(DEBT_NAME, ... | true |
13a5ed90e8e12ef61f5dfa69a80f50d8aff412e5 | JavaScript | miaochangfu/cy | /cyxianxia/client/cy/bin-debug/backup/Game0_backup.js | UTF-8 | 9,161 | 2.71875 | 3 | [] | no_license | // /**
// *
// *@author
// *
// */
// class Game0_backup extends Game0UI {
// constructor() {
// super();
// }
// /**非留空和留空总数组 */
// private totalArr: any;
// /**上面留空对象的数组 */
// private itemTopArr: any;
// /**下面留空对象的数组 */
// private itemBottomArr: any;
// /**选中留空的索引 */
// private chooseIndex: number;
//... | true |
2562ff7ab9106a4325143dd634c03b5ea120d163 | JavaScript | BhartiTTN/ODC_InternalProject | /src/support/action/leftClickWithOffset.js | UTF-8 | 628 | 2.84375 | 3 | [] | no_license | /**
* Created by adamShanahan on 2/23/18.
*/
import {findElementInTable} from '../LookupTables/elementLookupTable';
/**
* Left clicks on a given element with a given X, Y offset.
* @param selectorKey Key for Element lookup table
* @param x X offset, defaults to 0 (top left corner of element)
* @param y Y offset,... | true |
73fba1e692506215dfd39c8345bec80812a74e37 | JavaScript | LucindaX/Firas | /public/js/game.js | UTF-8 | 2,122 | 3.21875 | 3 | [] | no_license | var Game = function(player1, player2, turn, mode=1){
this.mode = mode // 1 (vs comp) 2 ( 2 players)
this.players = [player1, player2];
this.turn = (turn == "1" ? player1 : player2);
this.originalTurn = this.turn
this.board = new Board();
if (this.mode == 1 && this.turn == player2) this.sync();
}
... | true |
d93ae59010b1e8f029c05fd682e49008afcbd048 | JavaScript | Qutadah95/city-explorer | /src/App.js | UTF-8 | 2,697 | 2.546875 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import Form from 'react-bootstrap/Form'
import Button from 'react-bootstrap/Button'
import axios from 'axios';
// import Weather from './components/Weather';
export class App extends Component {
constructor(props) {
super(props);
this.state = {
Name: '',
... | true |
bc4c4b1bac8ed9ac7a7d172efaee36267b47a7e6 | JavaScript | costaafm/C9JS_Javascript | /DOM_Manipulacao-Eventos/public_html/js/manipulacao-eventos.js | UTF-8 | 4,104 | 3.28125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
// PRIMEIRO MÉTODO: ATRAVÉS DO HTML EVENT HANDLER (NÃO RECOMENDADO)
// <input type="text" id="utilizador" onblur="verificaNomeUtil... | true |
fd7a9a79542fba1194d6b6b38aef670ff597f4bf | JavaScript | dan2014/React-Insta-Clone | /instagram/src/components/CommentSection/CommentSection.js | UTF-8 | 1,678 | 2.578125 | 3 | [] | no_license | import React, {Component} from 'react';
import "./CommentSection.css"
import Comments from './Comments'
class CommentSection extends Component {
constructor(props){
super();
this.state = {
comments: props.comments,
commentInput:"",
user:"Dan"
}
}
a... | true |
91f899468ce44ec3a04ac31c62cef8f04f2d7413 | JavaScript | DianaSicevaia/fww-test | /assets/js/main.js | UTF-8 | 551 | 2.765625 | 3 | [] | no_license | function openTab(event, tabName) {
var i, tab__content, tab__links;
tab__content = document.getElementsByClassName("tab__content");
for (i = 0; i < tab__content.length; i++) {
tab__content[i].style.display = "none";
}
tab__links = document.getElementsByClassName("tab__links");
for (i = 0... | true |
a7208cc3ad55e0385a18ac131c82d07e33e6e2dd | JavaScript | hadijahkyampeire/Algorithms | /sorting/js/insertionSort.js | UTF-8 | 342 | 3.90625 | 4 | [] | no_license | const insertionSort = arr => {
const length = arr.length;
for (let i = 0; i < length; i++) {
let element = arr[i];
let j;
for (j = i - 1; j >= 0 && arr[j] > element; j--) {
arr[j + 1] = arr[j];
}
arr[j + 1 ] = element;
}
return arr;
}
console.log(insertionSort([5,3,1,4,6]))
//Outpu... | true |
0c1ffe709d355af6624c5eaa6125da1624706359 | JavaScript | Menchynskyi/todo-list-app | /src/index.js | UTF-8 | 8,069 | 2.703125 | 3 | [] | no_license | import state from './js/data';
import './style/main.scss';
import './style/modal.scss';
import './style/todo-list.scss';
import './style/todo-item.scss';
import './style/message.scss';
let { idx, customLabel, customDescription, customPriority, search, currentPriority, currentStatus, todoItems } = state;
const create... | true |
110224d9c0c8a694742fb3489ef9e1b057294dbb | JavaScript | zc19890502/chaliesZ | /10kvCableConnector/WebRoot/js/ajax.js | UTF-8 | 22,549 | 2.84375 | 3 | [] | no_license | var flag1=0; //用户名通过验证标志, 1为通过,0为不通过
var flag2=0; //密码通过验证标志
var flag3=0; //密码一致验证标志
var flag4=0; //邮箱通过验证标志
var falg5=0; //真实姓名通过验证标志
var flag6=0; //身份证通过验证标志
var flag7=0; //验证码通过验证标志
var flag8=0; //登录验证码通过
var flag9=0; //准考证唯一性通过验证
// Ajax调用函数发送action请求
function ajaxCheck(id){
var inpu... | true |
6308cc1fc803af7903b56e55e48a48b24aed858e | JavaScript | eunjye/jihyeex | /es6/test.js | UTF-8 | 2,343 | 4.40625 | 4 | [] | no_license | 'use strict';
/*
// es6 기능 : 블록 스코프 변수 선언
const sentences = [
{ subject: 'JavaScript', verb: 'is', object: 'great' },
{ subject: 'Elephants', verb: 'are', object: 'large' },
];
// es6 기능 : 객체 분해
function say({ subject, verb, object}) {
// es6 기능 : 템플릿 문자열
// 아래 사용한 것은 따옴표가 아니라 백틱 (`), 즉
// 키보드의 탭 키 ... | true |
087dc88860296e8f23351ad2e4933969d67d4ee8 | JavaScript | lukasoppermann/formandsystem-client | /resources/js/app.js | UTF-8 | 3,275 | 2.546875 | 3 | [] | no_license | var project = {};
/* --------------------------
* Document ready function
*/
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
/* --------------------------
* MAIN SCRIPT
*/
ready(function(window){
// document is ready
... | true |
08e411a7750ce6e1c2284a18cd1016f96bb8cb6d | JavaScript | MarvinMartin24/ReactJs-App | /src/components/modify/Card.js | UTF-8 | 3,319 | 2.671875 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import * as api from '../../services/apiService.js';
import './Modify.css';
class Card extends Component {
constructor(props) {
super(props);
this.state = {
user_id: this.props.card.user_id,
id:this.props.card.id,
... | true |
47b610033eb177f7e34d6f727fc118b268ce684a | JavaScript | edertaveira/Shopping-Cart-React-Redux | /src/store/actions/cartActions.js | UTF-8 | 2,127 | 2.5625 | 3 | [] | no_license | const CART = '_CART_'
export const addToCart = (product, cookies) => {
return (dispatch, getState) => {
let products = [];
if (cookies.get(CART) !== undefined) {
products = cookies.get(CART);
let productsCheck = products.filter(elem => elem.product.id === product.id);
... | true |
5325053640aee4cad051ba730d605db1671afe8b | JavaScript | 7dir/audio-experiment | /multiple-connect.js | UTF-8 | 2,315 | 3.015625 | 3 | [] | no_license | // https://github.com/g200kg/webaudio-customnode
// states that we can connect multiple nodes to gain node
// that contradicts to the spec
// let's test out
// whoa, it does work. Amazing.
import random from 'gauss-random'
let ctx = new AudioContext()
let gain = new GainNode(ctx, {gain: .1})
let osc1 = new Oscillat... | true |
314ac0d8fed30fa2bd763afaf2b9b670601aa033 | JavaScript | wikibook/titanium | /SampleUI/Resources/buttoncontrol.js | UTF-8 | 405 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | // create button
var button = Titanium.UI.createButton({
title:'Click Me!',
color:'#000',
selectedColor:'#fff',
top:20,
width:100,
height:80
});
// create button event listener
button.addEventListener('click', function(e)
{
Titanium.UI.createAlertDialog({title:'Button',message:'Hi! Titanium'}).show();
});
Ti.... | true |
7338eaf14aa0aab196a87e0a4c8c31e8a155f8fb | JavaScript | AntonioVdlC/uncharted-tactics | /public/js/game.src/renderField.js | UTF-8 | 765 | 2.875 | 3 | [] | no_license | const dashify = require("dashify")
const renderField = function (field) {
let fieldLength = field.length
let fieldWidth = field[0].length
let fieldHTML = ""
fieldHTML += `<table class="field">`
for (let i = 0; i < fieldLength; i++) {
fieldHTML += `<tr>`
for (let j = 0; j < fie... | true |
1bb4cfbdc983004b4087f3e66c132b1376913381 | JavaScript | GritBear/MuSee | /WebApp/MuSeeWeb/MuSeeWeb/public/javascripts/visual_global.js | UTF-8 | 988 | 2.65625 | 3 | [] | no_license | var BUFFERS = new Array(2);
var CUR_BUFFER = null;
var CUR_BACK_BUFFER = null;
var WIDTH, HEIGHT;
var TEXTURES = {};
//var FRAME_RATE = 20;
if (!Date.now) {
Date.now = function () { return new Date().getTime(); }
}
$(function () {
BUFFERS[0] = $("#buffer1");
BUFFERS[1] = $("#buffer2");
CUR_BUFFER =... | true |
e4121afc4fbe89f019e0003231aba637d86ea8da | JavaScript | oceandeng/2015work | /oil/song_singcontest/scripts/popup.zepto.js | UTF-8 | 1,579 | 2.53125 | 3 | [] | no_license | /*
* @Author: ocean
* @Date: 2015-05-13 14:02:53
* @Last Modified by: ocean
* @Last Modified time: 2015-08-11 19:06:55
*/
'use strict';
;(function($){
//定义弹出层对象
function Popup(opts){
this.screenW = opts.screenW;
this.screenH = opts.screenH;
opts.path ? this.path = opts.path : '';
this.init();
};
//初始化
... | true |
e49febab6680f1562153bdedb7ff10ca9f8076a6 | JavaScript | iamcsk/instructure-ui | /packages/ui-prop-types/src/xor.js | UTF-8 | 2,545 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 - present Instructure, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the ri... | true |
71f67780e2da0e1bcdcb7f184c80b419161ef15e | JavaScript | chenaey/Library-seating-reservation | /miniprogram/pages/seat/seat.js | UTF-8 | 11,741 | 2.625 | 3 | [] | no_license | const app = getApp()
Page({
data: {
isFromSearch: false,
libName: '图书馆二楼',
hallName: '门口',
currentTime: "2019-10-01 周四 14:30",
seatList: undefined, //主区域
seatListL1: undefined, //次区域-左
seatListL2: undefined, //次区域-右
hidden: "hidden",
selectedSeat: [],
seatScaleHeight: 35,
... | true |
6ebf162fc080684b5ed6554ecc7ad73f323b126d | JavaScript | ewindahl/archive-arcgis-doc-website | /source/js/smartbanner.init.js | UTF-8 | 2,081 | 2.53125 | 3 | [] | no_license | // custom js implementing the smartbanner solution described in
// http://www.dunnsolutions.com/content/application-development-blog/-/blogs/smart-app-banners-for-ios-and-android
var smartbanner = {
init: function () {
// if browser is modern ios browser, don't add banner (A solution for that browser type... | true |
0af1cce671b70c833f012ad4ccd6ba21bb65960e | JavaScript | CoWeDeveloper/JS-Assignment-1-67 | /app.js | UTF-8 | 8,366 | 3.609375 | 4 | [] | no_license | // ## assignent 38-42##
// assign 1
// function first(a,b){
// var c=a**b
// document.write(c)
// }
// first(2,3)
//assign 2
// var year=prompt("Enter the year");
// if (year%4===0){document.write("it is leap year "+ year)}
// else {document.write("it is not a leap year "+ year)}
// //assign 3... | true |
35abfef2558f373f45e66f8b2eed08cc68aea8b4 | JavaScript | commoningtoys/simple-common-ABM | /js/community.js | UTF-8 | 8,651 | 2.75 | 3 | [] | no_license | class Community {
/**
*
* @param {Object} community_args {
num_commoners: Number, | amount of commoners
monthly_hours: Number, | hours the commoner needs to fulfill each month
max_damage_value: Num... | true |
2316eebec8ac9fa1196fcc590bac91e007c3dff4 | JavaScript | eloiGarrido/geoServer | /src/utils/open-weather.js | UTF-8 | 651 | 2.9375 | 3 | [] | no_license | const { openWeatherApiKey } = require('../config')
const fetch = require('node-fetch')
/**
* Fetch current weather from OpenWeather endpoint
* @param {string} lat Latitude
* @param {string} long Longitude
*/
const getWeatherByCoordinates = async (lat, long) => {
const data = await fetch(`http://api.openweatherma... | true |
85b585beee91cbbbc004278dfbe0fe6a98d9e322 | JavaScript | Rheajais/Project-24- | /sketch.js | UTF-8 | 973 | 2.71875 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var ground, paper;
var boundary1, boundary2, boundary3;
function preload()
{
}
function setup() {
createCanvas(1400, 700);
engine = Engine.create();
world = engine.world;
//Create the Bodies He... | true |
72af0e383b42b68585107ddfa0a871a13d51a808 | JavaScript | igoralvarez/async-javascript-fundamentals | /11 Axios/09_patch/src/pages/bookpatch/main.js | UTF-8 | 1,737 | 2.96875 | 3 | [
"MIT"
] | permissive | import {
createElement,
cleanElement,
appendElement
} from '../../view/uiBuilder';
import * as bookAPI from '../../API/bookAPI';
const hasValue = (id) => document.getElementById(id).value !== '';
const getValueById = (id) => document.getElementById(id).value;
const generateProperty = (book, propertyValu... | true |
89c331c46914d78fbe50ef7096df9b4d7f32dfcd | JavaScript | hmahmad2/intermediate-react-learning | /components/Todo.js | UTF-8 | 660 | 2.84375 | 3 | [] | no_license | import React from 'react'
import PropTypes from 'prop-types'
// Here, we make cross off our list if the todo is completed.
// Checked through boolean here.
const Todo = ({onClick, completed, text}) => (
<li
onClick={onClick}
style={{
textDecoration: completed ? 'line-through' : 'none'
... | true |
07477394f9226789cf0aa245092390db98ebaa62 | JavaScript | ryancdang/cs325-game-prototypes | /HW1/js/main.js | UTF-8 | 5,540 | 2.75 | 3 | [] | no_license | "use strict";
window.onload = function() {
var game = new Phaser.Game( 800, 600, Phaser.AUTO, 'game', { preload: preload, create: create, update: update } );
function preload() {
// Load all the assets
game.load.image('sky', 'assets/sky.jpg');
game.load.image('ground', 'assets/platform... | true |
abe5220d4414492abf560eeabeed64aea602f38e | JavaScript | kolev77/SoftUni- | /Tech - Modul/JavaScript, MySQL, jQuery, Ajax/JS Basics Lab/Functions.js | UTF-8 | 653 | 4 | 4 | [] | no_license | function multiply(a, b) {
return a * b;
}
console.log(multiply(2, 3)); // 6 == 2 * 3
console.log(multiply(2)); // NaN == 2 * undefined
console.log(multiply(5, 6, 7)); // 30 = 5 * 6
let print = function(x) { console.log(x) };
[10, 20, 30].forEach(print)
let sum = 0;
[15, 201, 320].forEach(function(x) {
sum += ... | true |
a8e028b25996a0e711298416bbb6f518a6fe2f9e | JavaScript | frostini/graphql-gun | /async.test.js | UTF-8 | 1,207 | 2.890625 | 3 | [] | no_license | import { thunkish } from "./async";
describe("async", () => {
describe("thunkish", () => {
it("starts with a producer and can have many consumers", () => {
let producer;
const consumeA = jest.fn();
const consumeB = jest.fn();
const consumer = thunkish(function(produce) {
producer =... | true |
d0be27a9e34e15b31f789c248429d6f73bccbff8 | JavaScript | BennettToftner/low-poly | /js/networks.js | UTF-8 | 2,955 | 3.484375 | 3 | [] | no_license | var canvas = document.getElementById("game-canvas");
var ctx = canvas.getContext('2d');
var NUM_POINTS_X = 10;
var NUM_POINTS_Y = 10;
var LOWER_RED = 220;
var HIGHER_RED = 255;
var LOWER_GREEN = 100;
var HIGHER_GREEN = 200;
var LOWER_BLUE = 0;
var HIGHER_BLUE = 0;
var distance = 75;
var points = gene... | true |
71fea923a75bda9687bd07ef180a7673607e56b3 | JavaScript | MalihaKabir/problem_solving | /HackerRank/vowelsAndConsonants/vowelsAndConsonants.js | UTF-8 | 1,183 | 4.0625 | 4 | [] | no_license | // With Method:
function vowelsAndConsonants0 (s) {
let storeVow = [];
let storeConst = [];
let n = s.length;
for (let i = 0; i < n; i++) {
if (s[i] === 'a' || s[i] === 'e' || s[i] === 'i' || s[i] === 'o' || s[i] === 'u') {
storeVow.push(s[i]);
} else {
storeConst.push(s[i]);
}
}
console.log(storeVow.... | true |
1de8f69518d7121a10fc21998aaae57631876d79 | JavaScript | jinchao1992/webNav | /src/bgrandom.js | UTF-8 | 689 | 2.59375 | 3 | [] | no_license | const bgList = []
const url = 'https://img.xjh.me/random_img.php'
const handleRandomBg = () => {
return new Promise((resolve, reject) => {
$.ajax({
url,
data: {
return: 'json',
type: 'bg',
ctype: 'nature'
},
success(res) {
resolve(res)
},
error ... | true |
ee2e3b60bca91b14331e1718048ba4d4b54aaba1 | JavaScript | ErnaneJ/Notes-APP | /assets/js/script.js | UTF-8 | 6,072 | 3.078125 | 3 | [] | no_license | document.addEventListener('keydown', e => {if(e.key === 's' && e.ctrlKey)e.preventDefault()});
const rgbToHex = color => {
if(!color) return;
const r = parseInt(color.split("(")[1].split(",")[0])
const g = parseInt(color.split("(")[1].split(",")[1])
const b = parseInt(color.split("(")[1].split(",")[2].... | true |
9f9101a3502420cf9441a2f4e7d9b8b3f6ea9e96 | JavaScript | smw0807/minu_1 | /javascript/functional_programming/test1.js | UTF-8 | 354 | 4.09375 | 4 | [] | no_license | /**
* 함수형 프로그래밍의 대표적인 메소드 map, filter, reduce
*/
const arr = [1, 2, 3, 4, 5];
console.log(arr);
const map = arr.map(function(v) {
return v * 2;
})
console.log(map);
// [ 1, 2, 3, 4, 5 ]
// [ 2, 4, 6, 8, 10 ]
// 원본 데이터는 변하지 않았고, 받은 인자값 만을 이용해 결과를 만듬 (순수함수)
| true |
98b30f7ca389da598173f126ed89f9a88aaa8e82 | JavaScript | rishu2734/NodeJs | /all_About_npm/index.js | UTF-8 | 264 | 2.515625 | 3 | [] | no_license | var chalk = require('chalk');
var validator = require('validator');
console.log(chalk.yellow.inverse("This text has yellow background"));
var result = validator.isEmail("rishabhgmail.com");
console.log(result ? chalk.green.inverse(result) : chalk.red.inverse(result));
| true |
705e58640ab67caa2746599dc3412b932f3511ec | JavaScript | MateusPaixao/QDB | /src/assets/js/common/modules/General/Form/components/_email.js | UTF-8 | 4,322 | 2.53125 | 3 | [] | no_license | // const ValidateEmail = _email => {
// // get valid email
// let filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
// if (_email == '' || _email == null) {
// document.querySelector('.form-group.group-email small').innerHTML = '*Obrigatório.';
// document.quer... | true |
6c7fefbe1cc806f3ac556c11015c083b71a832ac | JavaScript | taktran/joy-joy | /src/joy-joy/index.js | UTF-8 | 2,230 | 2.609375 | 3 | [] | no_license | import ulog from 'ulog';
import * as CONSTANTS from './contants';
const log = ulog('joy-joy');
const WAIT_TIME = 16; // 60fps
const { JOYSTICK_AXES_INDEX, JOYSTICK_DIRECTIONS } = CONSTANTS;
const floatIsEqual = (a, b) => Math.abs(a - b) < Number.EPSILON;
const gamepadConnected = onGamepadConnected => event => {
... | true |
923fa364b782a73a578f6b6ea998aef25b8a52b7 | JavaScript | gurcuesra/node3-weather-website | /src/app-static-assest.js | UTF-8 | 1,606 | 3.171875 | 3 | [] | no_license | const path = require('path'); // Core node
const express = require('express');
// console.log(__dirname);
// // /Users/esrakartal/Desktop/udemy-node/web-server/src
// // console.log(__filename);
// // /Users/esrakartal/Desktop/udemy-node/web-server/src/app.js
// console.log(path.join(__dirname, '../public'));
// /... | true |
8d1ab7368edb2e9397ea0db087951ce992732ea0 | JavaScript | SaurabhGaur01/questionnaire | /src/__tests__/ducks/inputChildren.spec.js | UTF-8 | 1,438 | 2.515625 | 3 | [
"MIT"
] | permissive | import {
setChildren,
clearChildren,
inputChildrenReducer,
} from '../../ducks/userInput/inputChildren';
describe('inputChildren Duck Tests', () => {
const mockObject = 1;
const unknownAction = {
type: 'UNKNOWN',
}
describe('Action Generator', () => {
it('setChildren shoul... | true |
882e049ecdf434d085c350e4640e1f8a60aa8a22 | JavaScript | RahmatSaeedi/focals | /vampr.js | UTF-8 | 3,689 | 3.53125 | 4 | [] | no_license | class Vampire {
constructor(name, yearConverted) {
this.name = name;
this.yearConverted = yearConverted;
this.offsprings = [];
this.creator = null;
}
set creator(creator) {
creator = creator instanceof Vampire ? creator : null;
this._creator = creator;
}
// sets the year a vampire w... | true |
ec5ea41ebe788e898a3f0bacd48339ebc1c44779 | JavaScript | keeeper/js-hometasks | /04-arrays-objects/objects_compare.js | UTF-8 | 2,747 | 3.6875 | 4 | [] | no_license | var objA = {
prop1: 'value1',
prop2: 'value2',
prop3: 'value3',
prop4: {
subProp1: 'sub value1',
subProp2: {
subSubProp1: 'sub sub value1',
subSubProp2: [1, 2, {prop2: 1, prop: 2}, 4, 5]
}
},
prop5: 1000,
prop6: new Date(2016, 2, 10)
};
var ob... | true |
986595e802fe95d18a921ed3a57eeeb7d1fcce57 | JavaScript | ubports/api.ubports.com | /src/changelog/helpers.js | UTF-8 | 1,323 | 2.828125 | 3 | [] | no_license | /*
* Copyright (C) 2018 Marius Gripsgard <marius@ubports.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*... | true |
aaf70aed7139d740281313b41daa3685bd464660 | JavaScript | openupm/openupm-cli | /lib/utils/process.js | UTF-8 | 1,276 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | const childProcess = require("child_process");
/**
* @param {string} command A shell command to execute
* @return {Promise<string>} A promise that resolve to the output of the shell command, or an error
* @example const output = await execute("ls -alh");
*/
function execute(command, { trim }) {
/**
* @param {... | true |
b67c39dfb6b6251ee57c1d745076e3a46d6d3fb7 | JavaScript | 0xTracker/0x-tracker-client | /src/features/metrics/components/metrics-chart-tooltip.js | UTF-8 | 2,117 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import _ from 'lodash';
import numeral from 'numeral';
import PropTypes from 'prop-types';
import React from 'react';
import ChartTooltip from '../../../components/chart-tooltip';
const MONTH_NAME = {
1: 'January',
2: 'February',
3: 'March',
4: 'April',
5: 'May',
6: 'June',
7: 'July',
8: 'August',
9... | true |
ad95a55764c89cc33a2911fd81ad0c142c6b9466 | JavaScript | bigeasy/recover | /recover.js | UTF-8 | 945 | 2.640625 | 3 | [
"MIT"
] | permissive | const Turnstile = require('turnstile')
const events = require('events')
class Eject extends events.EventEmitter {
constructor (turnstile) {
super()
this._turnstile = turnstile
}
get health () {
return this._turnstile.health
}
get size () {
return this._turnstile.s... | true |
08520bb22d43aadbc5a65510cc9d9a77ff3b06f8 | JavaScript | Wolkenberg-Gymnasium/StundenplanWebApp | /src/Reducer/postcreation.js | UTF-8 | 3,369 | 2.546875 | 3 | [] | no_license | const nextStep = (oldStep, diff) => Math.max(0, Math.min(oldStep + diff, 5));
const initialState = {
title: 'Titel hier eingeben',
content: null,
photoMode: null,
images: [],
step: 0,
type: null,
viewPublic: true,
viewStudent: true,
viewTeacher: true,
};
function postCreationReduce... | true |
ae902eaa6b67dc73192f73ca5351e3ce01cb4fc7 | JavaScript | wk-js/wkno | /lib/wkno.js | UTF-8 | 1,566 | 2.640625 | 3 | [] | no_license | 'use strict'
const when = require('when')
const { map } = require('./utils/concurrent.js')
const Print = require('./print')
function createNanoTask(action, context, options) {
const tsk = function NanoTask(result) {
Print.debug(`execute ${Print.magenta(`[${tsk.taskName}]`)}`)
Print.time('lol')
con... | true |
a2d770b2c9676f0d4ff2c3478fcb5c28462a84d7 | JavaScript | vikash6526/node-notes-application | /sms.js | UTF-8 | 737 | 2.640625 | 3 | [] | no_license | var twilio = require('twilio')
var accountSID = 'XXX'
var authToken = 'XXX'
var client = new twilio(accountSID, authToken)
// client.messages.create({
// body: 'Hello from NodeJs',
// to: '+14379884119', // Text this number
// from: '+19388888727' // From a valid Twilio number
// })
// .then((message) =>... | true |
3459df0e57bab74b0f5b226f559e28644223c313 | JavaScript | AcademiaGeekPruebas/Aprendices-Geek | /Módulo 2/01-Conceptos-Básicos/Ejercicio_3/index.js | UTF-8 | 423 | 3.890625 | 4 | [] | no_license | /*3) Crear un algoritmo que calcule los años que usted tiene en base a
su año de nacimiento, debe crear una constante con un valor numérico
(año de su nacimiento) y hacer el cálculo.*/
let a_Nacimiento;
let a_Actual;
let edad;
a_Nacimiento = Number(prompt('Ingrese el ño de nacimiento'));
a_Actual = Number(prompt('I... | true |
315ad36417d3e5f3840217f1de10716bcb2792ef | JavaScript | Meiggin/Reorganize | /z/js/js.js | UTF-8 | 1,764 | 3.140625 | 3 | [] | no_license | //获取页面中的元素
var myplanebox = document.querySelector("div")//游戏界面
var gameScore = document.querySelector("span")//分数
//1.创建我方飞机
function Myplane(w,h,x,y,imgurl,boomurl){
this.w=w;
this.h=h;
this.x=x;
this.y=y;
this.imgurl=imgurl;
this.boomurl=boomurl;
this.createMyplane();
}
Myplane.prototype.crea... | true |
942a30d0b99e885f2c7e766ec5c45a26e6fedd8a | JavaScript | JanNowaczek/firebase | /crud/src/components/List.js | UTF-8 | 2,141 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { db } from '../firebase'
class List extends Component {
state = {
data: []
}
fetchData = () => {
db.ref('/cats').on('value', snapshot => {
const data = [];
if (snapshot.val()... | true |
fd3176843855311392139e626550981252770e95 | JavaScript | 1025623017/blog | /javascript/example.js | UTF-8 | 1,757 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // 全局ajax
export function uAjax(init,_this) {
var type = init.type
var url = init.url
var params = init.params
var successFn = init.success
var failFn = init.fail
var showLoading = init.showLoading
var closeLoading = init.closeLoading
// 默认自带域名
var urlDefault = init.urlDefault
// 默认显示loading
if ... | true |
318ed51eb8184134eb1fa16a954739830b0f1112 | JavaScript | infamily/infinity-reactjs | /src/services/topic.service.js | UTF-8 | 2,899 | 2.515625 | 3 | [] | no_license | import axios from 'axios';
import langService from './lang.service';
import serverService from './server.service';
// getCatergoryString returns a category query string for requests
const getCatergoryString = array =>
array.reduce(
(accumulator, value) => `${accumulator}&categories=${value}`,
''
);
const ... | true |
761e1b6614d22542f4bfc9a6b20afb404feb5953 | JavaScript | robertpan226/ShopifyBackendChallenge | /index.js | UTF-8 | 14,032 | 2.53125 | 3 | [] | no_license | const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const expressMongoDb = require('express-mongo-db');
const MongoClient = require('mongodb').MongoClient;
const utils = require('./utils.js');
const shortid = require('shortid');
const MONGO_URL = 'mongodb://localhost:2... | true |
15d4ac618921662076558acf367f94a450a10eab | JavaScript | jo-rdan/Free-Mentor | /server/config/tables.js | UTF-8 | 2,311 | 2.546875 | 3 | [] | no_license | import { Pool } from 'pg';
import dotenv from 'dotenv';
dotenv.config();
const connSring = process.env.DATABASE_URL;
const pool = new Pool({
connectionString: connSring,
});
const createTable = async () => {
const usersTable = `CREATE TABLE IF NOT EXISTS users(
id SERIAL NOT NULL PRIMARY KEY,
... | true |
85ed556507bc52bed6a317e6c3a09c09e5e09723 | JavaScript | categorialNovum/2048 | /game.js | UTF-8 | 5,534 | 3.078125 | 3 | [] | no_license |
var canvas, ctx, keystate, frames, score, grid, lastMove, currentMove;
var GAME_OVER = false;
var GRID_SIZE = 4;
var CELL_PIXELS = 100;
var FONT_NAME = "Arial";
var TILE_FONT_STR = Math.floor(CELL_PIXELS / 2) + "px " + FONT_NAME;
var GAME_OVER_FONT_STR = 50 + "px " + FONT_NAME... | true |
7bc9fe466e16704ffe51cd8dcec3aea2de692aad | JavaScript | H-Indiana-Holdsworth/weekly-build-2 | /render-food.js | UTF-8 | 407 | 2.84375 | 3 | [] | no_license | export function renderFood(food) {
const foodItem = document.createElement('li');
foodItem.classList.add('food-item');
const foodImg = document.createElement('img');
foodImg.src = food.img ;
const foodSpan = document.createElement('span');
foodSpan.textContent = food.name;
foodSpan.classLi... | true |
a96c3c984c4212c494111a7a27ddb9733c43da35 | JavaScript | milothea/virtual-piano | /script.js | UTF-8 | 4,062 | 2.65625 | 3 | [] | no_license | window.addEventListener('DOMContentLoaded', startScript);
function startScript() {
const btnContainer = document.querySelector('.btn-container'),
fullScreenBtn = document.querySelector('.fullscreen'),
piano = document.querySelector('.piano'),
pianoKeys = document.querySelectorAll('.piano-key'),
audioO... | true |
bc47845cfbb9d44a1183c6dba1e714132a4d5aae | JavaScript | donjude-eng/brad-js | /07_asyncjs_and_ajax/65_part2_custom_library/65_main_custom.js | UTF-8 | 1,651 | 3.265625 | 3 | [] | no_license |
function easyHTTP(){
this.http = new XMLHttpRequest(); ///Why this.http here?
}
//Make an HTTP GET REQUEST
easyHTTP.prototype.get = function (url ,callback) {
this.http.open('GET', url, true);
let self = this; //Why we remove this keyword and used self declared here?
this.http.onload = function () {... | true |
8f6b6fb9aeabed920437e22aa8d7deaf6aa211fd | JavaScript | Asjad27/vuejs-crud-frontend | /src/PeopleService.js | UTF-8 | 642 | 2.640625 | 3 | [] | no_license | import axios from 'axios';
const url = 'http://localhost:8080';
export class PeopleService{
static getPeople() {
const getPeopleURL = `${url}/people/`;
return axios.get(getPeopleURL).then(response => response.data);
}
static newPerson(person) {
const newPersonURL = `${url}/people/`;
... | true |
26c114095dd94634ddcabc7b9ffe3d24f5b7d268 | JavaScript | nss-day-cohort-21/d21-group-chatty-chatty-cathys | /javascripts/main.js | UTF-8 | 16,625 | 3.078125 | 3 | [] | no_license | // console.log("main.js loaded");
{
let radios = document.getElementById("users-radio");
// console.log( "radios", radios );
radios.addEventListener("click", (event) => {
inputArea.focus();
});
let thisMessage;
let userMessages = Chatty.returnJSON();
let inputArea = document.getElementById("me... | true |
530f376c9d0e093ec97917b8181692b6138a8432 | JavaScript | lizitang/JS-note | /对象拷贝.js | UTF-8 | 1,074 | 3.421875 | 3 | [] | no_license | //简单拷贝
function simpleClone1(obj){
var cloneObj={};
if(typeof obj != 'Object'){
return false;
}
for(var i in obj){
cloneObj[i] = obj[i];
}
return cloneObj;
}
//使用属性描述符
function simpleClone2(obj){
var copy = Object.create(Object.getPrototypeOf(obj));
Object.getOwnPropertyNames(obj).forEach(function(prokey){... | true |
b77e703267e852214246c1457aa49f77cbdcff3f | JavaScript | gkalms/GA_codealong | /w01d03/w01d03/functions.js | UTF-8 | 1,032 | 4.4375 | 4 | [] | no_license | //10th Tuesday
/**
function doSomething(Big) {
console.log("ole");
console.log("konichiwa");
console.log(Big);
}
doSomething("hujambo");
*/
//12th Thursday
/**
* function thisIs() {
console.log(5 == "5");
}
thisIs();
/**
function func2(name) {
console.log("Hi,this is ", name);
}
func2("georgie");... | true |
3f7c1ba01a99bafffca3139cb3928b00deeb2927 | JavaScript | PetrPozhoga/test-canvas | /src/index.js | UTF-8 | 2,954 | 3.140625 | 3 | [] | no_license | import arcList from './resource/arcList'
class CanvasMap {
constructor(circleList = [], circleRadius = 0) {
this.circleList = circleList
this.circleRadius = circleRadius
this.start = {
x: null,
y: null,
currentCircleIndex: -1,
currentElementX: null,
currentElementY: null,
... | true |
6c875ac705c4b632dec4b4ab6cb76ec45b1b1f67 | JavaScript | bryanyangg/CSE170WebApp | /public/js/notes.js | UTF-8 | 7,254 | 3.109375 | 3 | [
"MIT"
] | permissive | function initNotes() {
var notes = getNotes();
if (notes == undefined || getVersion() != "123") {
localStorage.setItem("notes", JSON.stringify({}));
localStorage.setItem("version_n", "123");
}
if(notes != undefined && Object.keys(notes).length > 0) {
console.log(Object.keys(... | true |
8c799dd08c8e2da08617125db17747151cab318e | JavaScript | mister12k/beyondworlds | /js/levels/level1.js | UTF-8 | 47,247 | 2.859375 | 3 | [] | no_license | var level1State = {
create: function() {
Character.prototype = Object.create(Phaser.Sprite.prototype);
Character.prototype.constructor = Character;
Item.prototype.constructor = Item;
// We're going to be using physics, so enable the Arcade Physics system
//game.physics.startSystem(P... | true |