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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c0a2945c8491ef0e4f692588bb5b9fd9897b1523 | JavaScript | rakeshdr543/seriesapp | /src/components/posts/Characters.js | UTF-8 | 806 | 2.5625 | 3 | [] | no_license | import React, { useState } from 'react'
const Characters = ({posts}) => {
const [currentPage] = useState(1);
const [postsPerPage] = useState(10);
const indexOfLastPost=currentPage * postsPerPage;
const indexOfFirstPost=indexOfLastPost-postsPerPage;
const currentPosts=posts.slice(indexOfFirstPost,indexOfLas... | true |
1d13838ed2e9265ad1df11d8d6fe77858cd0d4ad | JavaScript | arno06/Savely | /includes/components/anicolas/StageChart.js | UTF-8 | 3,617 | 2.640625 | 3 | [] | no_license | var StageChart = (function(){
var publicAPI = {};
function init()
{
document.querySelectorAll('*[data-role="StageChart"]').forEach(publicAPI.create);
}
function SimpleChart(pElement)
{
if(!pElement)
return;
var outTimeOut = null;
var tooltip = document.createElement('div');
tooltip.classList.add('... | true |
1f2a6c9d9737d6be4a0877cfae6a66bb781e6723 | JavaScript | josephgarner/Civ6GameTracker | /JS/civs.js | UTF-8 | 682 | 2.6875 | 3 | [] | no_license | $civs = [];
$leaders = [];
function setArrs(civs, leaders){
$civs = civs;
$leaders = leaders;
}
function loadLeader(player){
var id = "#"+player+"CIV";
var id_Leader = "#"+player+"LEADER";
var selectedCiv = $(id).children("option:selected").val();
var select = $(id_Leader);
if(selectedCiv ... | true |
7c617b6b29d08804e50a903b8ac5c6813bf5591d | JavaScript | kengste/pokedex | /src/Button.js | UTF-8 | 560 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
export default class Button extends Component {
constructor() {
super();
this.state = {
nameAscOrder: true,
}
}
handleClick = (event) => {
const nameAscOrder = !this.state.nameAscOrder;
this.setState({nameAscOrder});
this.props.onChange(eve... | true |
765134ac3c3a25d70ec0e606d6989e3927c43d9b | JavaScript | testedsp2/tested | /api/services/findInArrayService.js | UTF-8 | 336 | 2.671875 | 3 | [] | no_license | module.exports = {
findInArray : function( arry, param, value ){
//This function return the index of a param in a value
for (var i = 0, len = arry.length; i<len; i++) {
if (param == "") {
if ( arry[i] == value) return i;
} else {
if (param in arry[i] && arry[i][param] == value) return i;
}
}
re... | true |
0e1cb02acc9ceba97e1c536c9fac42a716f0ca75 | JavaScript | myyhikali/news_release_system | /web/article_manage.js | UTF-8 | 2,448 | 2.515625 | 3 | [] | no_license | window.onload = getArticlesPublished();
function getArticlesPublished(){
$.ajax({
xhrFields: {
withCredentials: true
},
type: "GET",
url: "http://localhost:10080/manage/article" ,
dataType: "json",
success: function (result,status,xhr) {
... | true |
a43db35687bcdfca6d1fe17ae2a8418ceaa10363 | JavaScript | gcsmckinnon/comp-1073-fall2018 | /Week-02/PhraseGuess/main.js | UTF-8 | 4,759 | 4.125 | 4 | [] | no_license | // Step 1a: Store the Game Board element
const gameBoard = document.querySelector('#gameBoard');
// Step 1b: Store the Feedback element
const feedback = document.querySelector('#feedback');
// Step 1c: Store the Letter Placement element
const letterPlacement = document.querySelector('#letterPlacement');
// Step 1d: ... | true |
890924bbc3cd6bb8dcbf6cb4106d41b26f28740e | JavaScript | sonyasha/flask_app_js_python_d3 | /python_app/static/js/sports.js | UTF-8 | 13,864 | 2.765625 | 3 | [] | no_license | $( document ).ready(function() {
console.log( "ready!" );
});
d3.select(window).on("resize", makeResponsive);
makeResponsive();
function makeResponsive() {
var svgArea = d3.select("body").select("svg");
if (!svgArea.empty()) {
svgArea.remove();
}
var svgWidth = window.innerWidth-15; //ex... | true |
2de0a4bfb8fa44c43c5d2dccf50e20551b941b58 | JavaScript | BrendaBriseuo/Metodos-HTTP | /forms.js | UTF-8 | 662 | 2.515625 | 3 | [] | no_license |
'use strict'
var http=require('http').createServer(webServer),
form= require('').readFileSync('form.html')
querystring = require ('querystring'),
util = require('util'),
dataString = ''
function webServer(req, res)
{
if(req.method == 'GET')
{
res.writeHead(200, {'Content-Type' : 'text/html'})
... | true |
f37baeb67cb9b3302d66597638adc95aae42675d | JavaScript | codyloyd/pixelsketch | /script.js | UTF-8 | 1,211 | 2.9375 | 3 | [] | no_license | var gridSize = 16
$(document).ready ( function() {
$("#drawing").click(function(){
gridSize = $("#number").val();
makeGrid("drawing");
$("#wrapper").on('mousedown mouseup', function mouseState(e){
if (e.type == "mousedown") {
$(".drawing").mouseenter(function(){
$(this).css("background-color",... | true |
2c19987848df92a946e4cf3e2ac2ece8600efd7e | JavaScript | jdbjerrekaer/AU-Blackboard-JS-Webscraper | /coursePlanTest.js | UTF-8 | 976 | 2.515625 | 3 | [
"MIT"
] | permissive | const table = document.querySelector(".vtbegenerated table")
const array = document.querySelectorAll(".vtbegenerated table a")
var links
for (let index = 0; index < array.length; index++) {
const element = array[index];
links.append(element);
}
var uniqueLinks = new Set(links)
for (let index = 0; index < uniqueLin... | true |
f9e79bda7977ff82a5effb4045fae87750aff915 | JavaScript | JustHappit/karma-happit-reporter | /test/util.shell.test.js | UTF-8 | 4,717 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
var rewire = require('rewire');
var chai = require('chai');
var sinon = require('sinon');
chai.config.includeStack = true;
chai.use(require('sinon-chai'));
var assert = chai.assert;
var eq = assert.equal;
var ok = assert.ok;
describe('util/shell.js test suite', function() {
var module;
var sut;
... | true |
27c8ecb20443d8a46b10d4334365d205ba9680fd | JavaScript | cfer619/OLDtwit | /servidor.js | UTF-8 | 1,581 | 2.640625 | 3 | [] | no_license | var port= process.env.PORT || 3000;
var express = require("express");
var multer = require("multer");
var app = express();
var nom = ' ';
var storage = multer.diskStorage({
destination: function (req, file, callback) {
callback(null, './uploads');
},
filename: function (req, file, callback) {
... | true |
74991c51aa9cb2d3e1fdb426c622fbf9e479014e | JavaScript | davecade/ticket-logger | /src/JS_Utilities/_utilities.js | UTF-8 | 3,840 | 3.625 | 4 | [] | no_license |
// -- Quick Sort Aglorithm
export function quickSort(array, sortBy) {
if(sortBy==='id' || sortBy==='sort') return;
quickSortHelper(array, 0, array.length-1, sortBy)
return array;
}
function swap(i, j, array) {
let temp = array[j];
array[j] = array[i]
array[i] = temp
}
function quickSortH... | true |
d5ef9f6673f98d942f0e36d27b12bc79151b2be1 | JavaScript | hamilton-lima/vaca5 | /lib/layout.js | UTF-8 | 2,860 | 2.75 | 3 | [] | no_license | /**
* @class GridLayout
*
* @param _x
* @param _y
* @param _width
* @param _height
* @param _lines
* @param _columns
* @return
*/
function GridLayout(_x, _y, _width, _height, _lines, _columns, _border) {
this.from = Scene;
this.from();
this.invalid = true;
this.x = _x;
this.y = _y;
this.width = _wid... | true |
886ef7309690ea15e27b16481583b656221014b7 | JavaScript | wutongshu1993/offerCode | /offer/18.树的子结构.js | UTF-8 | 963 | 3.625 | 4 | [] | no_license | /**
* Created by lh on 2017/1/3.
* 输入两棵二叉树A,B,判断B是不是A的子结构。
* 想法是先比较根节点是否相等,相等则进行下一步子节点的比较
*/
function TreeNode(x) {
this.val = x;
this.left = null;
this.right = null;
}
function HasSubtree(pRoot1, pRoot2)
{
// write code here
var res = false;
if(pRoot1 != null && pRoot2 != null){
if(... | true |
42347f5ea6afc03746a3b80f0f3d74ceaa99a542 | JavaScript | AdamThreepwood/projectWeb | /fetchasteroids.js | UTF-8 | 6,187 | 3.5 | 4 | [] | no_license | // Function for defining todays date, and the date a week ago for the GET which
// requires specific dates to accept request
let today = new Date().toISOString().slice(0, 10);
//let lastWeek = today
console.log(today);
document.getElementById("dateShow").textContent = today;
function createDate(days, months, years) ... | true |
003ab1dadae70bd9d5348b1159c19e5f2aefee43 | JavaScript | joskid/insta-app | /src/redux/reducer/fetchFeeds.reducer.js | UTF-8 | 481 | 2.609375 | 3 | [] | no_license | const init = {
loading: false,
data: null,
error: undefined
};
export const fetchFeedsReducer = (state = init, action) => {
switch (action.type) {
case "FETCH_FEEDS_START":
return { ...state, loading: true };
case "FETCH_FEEDS_SUCCESS":
return { ...state, loading: false, data: ac... | true |
646c604488c3801bb34f03d8a61c781aa47b4b0d | JavaScript | leon-do/rabbitMQ-Demo | /3.recieveTicker/send.js | UTF-8 | 1,734 | 3.21875 | 3 | [] | no_license | /**
https://www.rabbitmq.com/tutorials/tutorial-two-javascript.html
@purpose send many messages
sender == task == producer
reciever == worker == consumer
|-----------| |------> recieve1
send ----->| queue1 |-----|
|-----------| |------> recieve2
send =
[x] message sent: message-0
[x] mess... | true |
e988a1a0306066df917c6dbfdb65d79725862d96 | JavaScript | nuwrldnf8r/cities | /lib/cities.js | UTF-8 | 4,743 | 2.734375 | 3 | [] | no_license | var cityArray = require('./cityarray');
var natural = require('natural');
var tokenizer = new natural.WordTokenizer();
if(typeof(Number.prototype.toRad) === "undefined") {
Number.prototype.toRad = function () {
return this * Math.PI / 180;
}
}
var getDistance = function(start, end, decimals) {
dec... | true |
96bf704b721f8ffd94685f2787c032221df12325 | JavaScript | stepkaofficial/stepkaofficial.github.com | /MultiDraw.js | UTF-8 | 7,301 | 2.671875 | 3 | [
"MIT"
] | permissive |
function Multidraw(multidrawTarget, drawingTechnology) {
if (!multidrawTarget.style.position)
multidrawTarget.style.position = "relative";
var logging = window.location.search.match(/\blog\b/i) != null;
var msgs; // optional textarea for debug messages; may be undefined
var drawingTarg... | true |
d26119d75e3bf36165bc3d5c88f29ccb8108e06b | JavaScript | bnates/pdx-d2-javascript | /week_7/angular-factory/js/index.js | UTF-8 | 1,376 | 2.625 | 3 | [] | no_license | var angular = require('angular');
var $router = require('angular-route');
console.log( '$router', $router );
var i = 1;
function LettersService(){
this.$get = function(){
return ['a', 'b', 'c'];
};
}
var name = angular.module('app', [])
.constant('MAGIC_NUMBER', 42)
.value('classname', 'jsda')
.config([ '... | true |
a57b6aa6298c26334778d6255f1933a850afc647 | JavaScript | zhenduan/forex | /script.js | UTF-8 | 9,434 | 3.015625 | 3 | [] | no_license | // const fromForex;
// const toForex;
var fromValue;
var toValue;
var fromForex;
var toForex;
var myJson;
var aud_cny_ask;
var aud_cny_bid;
var aud_usd_ask;
var aud_usd_bid;
var aud_hkd_ask;
var aud_hkd_bid;
var aud_nzd_ask;
var aud_nzd_bid;
var aud_jpy_ask;
var aud_jpy_bid;
var aud_gbp_ask;
var aud_gbp_bid;
var... | true |
3260aac7fac1461d42f0ea6d415cb8ad8e0ce0d4 | JavaScript | weijia0208/JS-advanced-lessons | /LS19/demo1.js | UTF-8 | 379 | 3.90625 | 4 | [] | no_license | //创建正则对象
//方式一
var reg1 = /[bcf]at/gi;
//方式二 通过RegExp构造函数来实例化正则对象
var reg2=new RegExp(/[bcf]at/,"gi");
var reg3 = new RegExp(/[bcf]at/,"gi");
console.log("a fAt bat ,a faT cat".match(reg1));
console.log("a fAt bat ,a faT cat".match(reg2));
console.log("a fAt bat ,a faT cat".match(reg3));
//(4) ["fAt", "bat", "faT", "... | true |
0343fbef52a306ab3e28a938c75a1592e556516c | JavaScript | leandrop20/particle-editor-for-script4-phaser- | /lib/script4/display/TileSprite.js | UTF-8 | 418 | 2.671875 | 3 | [] | no_license | class TileSprite extends Phaser.TileSprite
{
/**
* texture = if atlas (atlas.textureName) or textureName only!
*/
constructor(texture, x = 0, y = 0, width = 10, height = 10)
{
var atlas = texture;
if (texture.indexOf('.') != -1) {
var parts = texture.split('.');
atlas = parts[0];
texture = parts[1] + ... | true |
7ba4c251ce73a7da747156526dd711b1a6702c48 | JavaScript | jerryHZLiang/sort-algorithm | /mergeSort/mergeSort.js | UTF-8 | 565 | 3.609375 | 4 | [] | no_license | var merge = function(left, right) {
var result = []
while(left.length && right.length) {
result.push(left[0] <= right[0] ? left.shift() : right.shift())
}
return result.concat(left.concat(right))
}
function mergeSort(arr) {
if(arr.length < 2) return arr
var middle = Math.floor(arr.leng... | true |
e26c83457c2be13cbf2573720bfdc5f9852832bc | JavaScript | anna-yukhno/Date-Picker | /datePicker.js | UTF-8 | 3,929 | 3.078125 | 3 | [] | no_license | function DatePicker() {
var self = this;
var SIZE = 7;
var weekDays = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
var months = ['Январь', 'Февраль',
'Март', 'Апрель', 'Май',
'Июнь', 'Июль', 'Август',
'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
];
//------calendar grid initialization--------------------------... | true |
3a1e0d15b067e27607e095cc7b2704614e705627 | JavaScript | Tjiersv/TypeScript-Test | /destructuracionObjetosArreglos/app.js | UTF-8 | 413 | 3.78125 | 4 | [
"MIT"
] | permissive | //Ejemplo 1 Objeto
var avenger = {
nombre: "Steve",
clave: "Capitán America",
poder: "Super Droga"
};
var poder = avenger.poder, clave = avenger.clave, nombre = avenger.nombre;
console.log(nombre, clave, poder);
//Ejemplo2 Arreglo
var avengers = ["Thor", "Capitán", "Ironman"];
var thor = avengers[0], steve ... | true |
83dfa668dad5ecbf575bbbcbeb56402e074ca6bf | JavaScript | LewAndrade/freetime-webapp | /components/Activity.js | UTF-8 | 2,241 | 2.734375 | 3 | [] | no_license | import styles from "../styles/Activity.module.css";
const Activity = ({ action, name }) => {
const mountText = (action = "", name = "") => {
switch (action) {
case "Listen":
return (
<>
<h1 className={styles.text}>hey babes now go listen to</h1>
<h1 className={styl... | true |
9bd33feca2c2c83c24712b62f98a04bc891696da | JavaScript | Joyce-w/CardMatch | /app.js | UTF-8 | 2,969 | 3.8125 | 4 | [] | no_license | const gameContainer = document.getElementById("game");
const div = document.getElementsByClassName('newDiv');
const divs = document.querySelector('#game div')
let arr = [];
let noMatch = [];
let clicks = 0;
const COLORS = [
"red",
"blue",
"green",
"orange",
"purple",
"red",
"blue",
... | true |
03b4b959c7c2970d9c05debf77f7b8275f43a266 | JavaScript | mujina93/phaser2skeleton | /create.js | UTF-8 | 1,721 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | var player;
var platforms;
var cursors;
var jumpButton;
var score;
var scoreLabel;
var black;
function create() {
// global variables
this.X_SPEED = 250;
this.Y_SPEED = 400;
this.GRAVITY = 500;
game.ENEMY_SPEED = 100;
// initialize score
score = 0;
// black space
black = g... | true |
4b280290d337b1ec4ecadcfeac0f8954ac2869f4 | JavaScript | ZodiacSyndicate/leet-code-solutions | /medium/8.字符串转换整数-atoi/8.字符串转换整数-atoi.js | UTF-8 | 2,811 | 4.0625 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=8 lang=javascript
*
* [8] 字符串转换整数 (atoi)
*
* https://leetcode-cn.com/problems/string-to-integer-atoi/description/
*
* algorithms
* Medium (16.56%)
* Total Accepted: 33.2K
* Total Submissions: 200.3K
* Testcase Example: '"42"'
*
* 请你来实现一个 atoi 函数,使其能将字符串转换成整数。
*
* 首先,该函数会根据... | true |
d2b3c70bc97b303df0cf4f1b460831751b0e40bc | JavaScript | planet-221b/pureMVC-example | /src/com/planet221b/example/view/component/ProgressView.js | UTF-8 | 1,044 | 2.84375 | 3 | [] | no_license | /**
* Created by sargis on 7/5/17.
*/
import Phaser from 'phaser'
export default class ProgressView extends Phaser.Group {
static NAME = 'ProgressView'
static SHOW = ProgressView.NAME + 'Show'
static HIDE = ProgressView.NAME + 'Hide'
static UPDATE = ProgressView.NAME + 'Update'
constructor () {
super(... | true |
a1af217ec6d4338c7f1fef0b32e7777e99e1484e | JavaScript | mannysinghh11/PokeDex | /src/components/Pagination.js | UTF-8 | 3,022 | 2.6875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import styles from '../styles/Pagination.css'
class Pagination extends React.Component {
constructor(props) {
super(props);
this.handleActivePages = this.handleActivePages.bind(this);
this.updateActiveClasses = this.updateActive... | true |
64b2fe247e54b1cd37d494bdcbfd1fc13eefa2af | JavaScript | AAI-USZ/FixJS | /input/100+/before/122fb962ee20d65e6f0fb2b1b6da5454de7a63d9_0_2.js | UTF-8 | 524 | 2.78125 | 3 | [
"MIT"
] | permissive | function(req, res) {
var character = req.params.character;
var in_url = req.params.in_url || '';
if( characters.indexOf( character.toLowerCase() ) === -1 ) {
res.send( "I don't know who that character is", 404 );
} else {
url = decodeURIComponent( in_url );
if( url && !url.match( /^https?:\/\//i ) && !url.m... | true |
29bac893d371fa56d8a5f2cbbfccc77fbc3189f0 | JavaScript | Grimmgalohm/Coffee-shop-CLI | /index.js | UTF-8 | 3,267 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env node
const colors = require('colors');
const inquirer = require('inquirer');
const cmd = require('commander');
const mongoose = require('mongoose');
const Coffee = require('./db/coffee-shop-db.js');
mongoose.connect('mongodb://localhost/coffee-cats-test')
.then(instance => {
const conn = instance.... | true |
c1829532284b576d680ef00c7d7ce8306996df98 | JavaScript | vsmanoj-98/reactproject | /src/child.js | UTF-8 | 1,007 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class Child extends Component {
constructor(){
super();
console.log('Child constructor');
}
componentWillMount(){
console.log('Child componentWillMount')
}
componentDidMount(){
console.log('Child componentDidMount')
... | true |
8e93bd85805d79e9e65ae6c3effd33ab3e666d60 | JavaScript | jypkkjj/betty | /lab/index.js | UTF-8 | 5,350 | 2.578125 | 3 | [] | no_license | import init, { run_test } from "./pkg/lab.js";
const background = "#023f68";
const foreground = "#abd4f1";
const green = "#48c17b";
const red = "#e4597c";
const blue = "";
const getData = async () => {
const map = (d) => {
return {
date: new Date(d.date),
open: +d.open,
close: +d.close,
... | true |
fd8ad694beef268a7bfcb717a22c7a7eaa23fbcb | JavaScript | pabloluzk1/Javascript | /Exemplo02.js | UTF-8 | 297 | 3.609375 | 4 | [] | no_license | //alert('Se fu... mundo')
function concatenar(){
var camponome=document.getElementById("nome");
var campoSobrenome=document.getElementById("sobrenome");
var nome=camponome.Value;
var sobrenome= campoSobrenome.value;
var nomeCompleto=nome+" "+sobrenome;
alert("Nome completo: "+ nomeCompleto);
} | true |
7354a8594970437208e1cdca4397255d4d4094c1 | JavaScript | borntofrappe/project-euler | /004 - Largest Palindrome Product/script.js | UTF-8 | 2,124 | 4.09375 | 4 | [] | no_license | function largestPalindromeProduct(n) {
// largest n digit number
const largestNumberString = Array(n)
.fill(9)
.join("");
const largestNumber = parseInt(largestNumberString, 10);
// smallest n digit number
const smallestNumberString = Array(n)
.fill("")
.map((val, index) => (index === 0 ? 1 ... | true |
2d6d59f2be1346f5de40df5f8947aba0e7ac81d5 | JavaScript | Babak-Gholamzadeh/number-to-english-phrase | /index.js | UTF-8 | 1,566 | 3.28125 | 3 | [] | no_license | const num2words = num =>
num ? (() => {
const units = [
['', 'ten ', '', ''],
['one ', 'eleven ', '', 'thousand '],
['two ', 'twelve ', 'twenty ', 'million '],
['three ', 'thirteen ', 'thirty ', 'billion '],
['four ', 'fourteen ', 'forty ', 'trilli... | true |
59d3aabd7116c4794b3957b70eb21f7d52d19558 | JavaScript | lea19019/cse341-node-team | /public/scripts/isViewed.js | UTF-8 | 2,001 | 2.953125 | 3 | [] | no_license | const updateViewed = async (node) => {
const movieId = node.parentNode.querySelector('[name=titleId]').value;
const linkPath = window.location.origin;
const csrf = node.parentNode.querySelector('[name=_csrf]').value;
const isViewed = node.checked;
try {
const response = await fetch(`${link... | true |
a199b7b012d5aaead28e582a41ff6521c87fbde7 | JavaScript | WayneBruton/online-template | /server/routes/authorizationRoutes.js | UTF-8 | 4,770 | 2.578125 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const pool = require("./connection");
const jwt = require("jsonwebtoken");
const Joi = require("joi");
const bcrypt = require("bcryptjs");
const saltRounds = parseInt(process.env.SALT_ROUNDS);
router.use((req, res, next) => {
const schema = {
... | true |
7cfa3b702d8b7d57d9e021fe1c31a15cc4ceaa77 | JavaScript | 3moz/eloquentjs | /ch03/recursEven.js | UTF-8 | 275 | 3.5 | 4 | [] | no_license | // function isEven(num) {
// return num===0 || (num-2)%2===0;
// } //my first soln
function isEven(num) {
if (num===0){return true;}
else if (num===1){return false;}
else return (num > 0) ? isEven(num-2) : isEven((-1*num)-2);
}
console.log(isEven(process.argv[2]));
| true |
44bcae5ec6ef03f07115e473c8f3ae062a11abf0 | JavaScript | mreis1/promise-chain-sample | /index.js | UTF-8 | 1,052 | 2.921875 | 3 | [] | no_license | var promise = require('bluebird');
var _ = require('lodash');
var callback = function (err) {
console.log(err)
}
function process() {
return new promise(function (resolve) {
var files = [
'/a.png',
'/b.png'
]
var stack = [];
_.each(files, function (f... | true |
4fc0488bdc0c5dfb20fa20b3be96c03910ec86e7 | JavaScript | paulitex/sproutcore | /frameworks/handlebars/extensions/bind.js | UTF-8 | 5,246 | 2.71875 | 3 | [
"MIT"
] | permissive | sc_require('extensions');
/**
Adds the `bind`, `bindAttr`, and `boundIf` helpers to Handlebars.
# bind
`bind` can be used to display a value, then update that value if it changes.
For example, if you wanted to print the `title` property of `content`:
{{bind "content.title"}}
This will return the `t... | true |
970bce310cf3630f1a742a9404e4183189d6a1bc | JavaScript | daphnesmit/dtnl-react-frontend-setup | /source/utilities/scroll-to/javascript/scroll-to/scroll-to.js | UTF-8 | 3,518 | 2.671875 | 3 | [] | no_license | import Events from '@utilities/events'
import raf from 'raf'
const ST_HOOK = 'a[href^="#"]'
const ST_DURATION = 500
const ST_OFFSET = 50
class ScrollTo {
constructor() {
this._bindEvents()
this._initElements()
}
/**
* Bind event
*/
_bindEvents() {
Events.$on('scroll-to::scroll', (event, dat... | true |
ef600bcc240fe523f0eac3ef87f4b269e308d9e2 | JavaScript | conorsmith/hoarde | /src/Frontend/Js/Transfer/View/InventoryWeightView.js | UTF-8 | 151 | 2.9375 | 3 | [] | no_license | class InventoryWeightView {
constructor(el) {
this.el = el;
}
repaint(weight) {
this.el.innerText = weight / 1000;
}
} | true |
e26602155b256f5e4a383df72b17f16282e616d6 | JavaScript | andrew749/cardtransitionlibrary | /script.js | UTF-8 | 562 | 2.625 | 3 | [] | no_license | $(document).ready(function(){
var waypoint=[];
for( i=0;i<1000;i++){
$(".container").append("<div class=\"card hidecard\" id=\""+i+"\">"+i+"</div>");
var tempwaypoint = new Waypoint({
element: document.getElementById(i),
handler: function() {
console.log("... | true |
3639bd8be0fd45a61e673880826b565a27d1c606 | JavaScript | HarielGiacomuzzi/SuperPonto | /web/src/table.jsx | UTF-8 | 1,107 | 2.546875 | 3 | [] | no_license | import React from 'react';
export default class Table extends React.Component {
constructor(props) {
super(props);
this.state = { data : [] }
}
componentDidMount() {
fetch('localhost:9000/findByMail', {
method: 'GET',
headers: {
'email' : 'as@asd.cmo'
}
})
.t... | true |
9502ec2d0439797944450bcd3b9f4dd09dec1ea7 | JavaScript | zachbrowne/atmailopen | /html/dutch/javascript/abook.js | UTF-8 | 2,959 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | function DelContact(type,email, id) {
// We are trying to remove a bunch of addresses at the same time
if(deltotal || type == 'multi') {
if (confirm(['Are you sure you want to delete the ' + deltotal + ' selected addressbook items?'])) {
document.abook.delmulti.value='1';
document.abook.submit();
CleanUp... | true |
3adb04c43ec2ad44b71e175721fd3f40cbf13d1f | JavaScript | kancho-kanchev/Telerik | /WEB/04 JavaScript Part II/Lection 03 Advanced Functions/03.Console.js | UTF-8 | 817 | 3.03125 | 3 | [
"MIT"
] | permissive | var specialConsole = (function () {
function _format(str /*, params */) {
var selfArguments = arguments;
return str.replace(/\{(\d+)\}/g, function (match, p1) {
return selfArguments[+p1 + 1];
});
}
return {
writeLine: function () {
console.log(_for... | true |
46c716f97efbb0d8117d2cc77d0e735544fb8a53 | JavaScript | Alexismcx/shiftmakerApplicationMobile | /shiftmakerapp/reducer/notes.js | UTF-8 | 1,014 | 2.921875 | 3 | [] | no_license | export default function note(notesList = [], action){
if(action.type === 'saveNotes'){
return action.notes
} else if(action.type === 'deleteNotes'){
var notesCopy = [...notesList]
var position = null
for (let i = 0; i < notesCopy.length; i++) {
if(notesCopy[i]._id ===... | true |
4dedec7ecdd93a6dfef69b69b3028776e6a14bd4 | JavaScript | moatorres/typetags | /lib/tests/Set.spec.js | UTF-8 | 1,722 | 3 | 3 | [
"MIT"
] | permissive | import { TypeTags } from '../resources/TypeTags'
import { toString } from '../utils'
let set = new Set()
let setIterator = new Set().values()
describe('Set', () => {
it('Should be defined', () => {
expect(Set).toBeDefined() // static object
expect(TypeTags.Set).toBeDefined()
})
it('Should match the typ... | true |
86324653379580def6fca410404fae3caeb171d2 | JavaScript | Carradino/Initial-Pre-Work | /5-Introduction-to-JavaScript/106-Use_the_Conditional_(Ternary)_Operator.js | UTF-8 | 220 | 3.59375 | 4 | [] | no_license | /* condition operator (condition ?) can be used to make if-else statements one line.
condition ? statement-if-true: statement-if-false; */
function checkEqual(a, b) {
return a == b ? true : false;
}
checkEqual(1, 2);
| true |
899690f8b222ae65222540a922cf16a6ea290744 | JavaScript | VCCD/dwellplayd | /native/store/community.js | UTF-8 | 1,591 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import axios from 'axios'
import { addUserToCommunity } from '../store'
import CONFIG from '../api-routes'
const apiURL = CONFIG.API_URL
/*--------actions-------*/
const GET_COMMUNITY = 'GET_COMMUNITY'
const CLEAR_COMMUNITY = 'CLEAR_COMMUNITY'
/*--------action creators-------*/
const getCommunity = community => ({ ... | true |
5815b0299c614d35823fef6291030a27f19c57bf | JavaScript | cemiand/SimpliCar | /src/store/actionCreators/productsAction.js | UTF-8 | 1,821 | 2.796875 | 3 | [] | no_license | import axios from "axios";
import { SET_PRODUCTS, SET_SINGLEPRODUCT } from "../constants";
const products = (data) => ({
type: SET_PRODUCTS,
payload: data,
});
const singleProduct = (data) => ({
type: SET_SINGLEPRODUCT,
payload: data,
});
// PEDIDO A TODOS LOS PRODUCTOS
//PEDIDO CON API SIMPLICAR
// export ... | true |
f5f3a5cf8ba513e83c289c247caa1321ebd9971e | JavaScript | chatoo2412/codelab-typescript | /output/type2.js | UTF-8 | 223 | 3.09375 | 3 | [] | no_license | "use strict";
/* let vs const */
var a = "aaa";
var b = "bbb";
var c = "ccc"; // c: string
var d = "ddd"; // d: 'ddd'(literal). See chapter 11.
var e = {
f: "fff",
};
e.f = "f2f2f2";
e.f = 555;
e.g = "ggg";
| true |
bd8aff6bc80ef0ab13bb0b2ca6ca75999639ac06 | JavaScript | jako2889/The-Final-Order | /production/src/pages/app/lecture/components/theory_and_quiz/quiz.js | UTF-8 | 1,640 | 2.640625 | 3 | [
"MIT"
] | permissive | import React, { useState } from "react"
import { Quiz_con, Answer_con } from "./quiz_styles"
import checkedIcon from "../../../../../assets/icons/checked.png"
import unCheckedIcon from "../../../../../assets/icons/unChecked.png"
const Quiz = props => {
// STATE
const [value, setValue] = useState("No Answer Selecte... | true |
b6fa99bf641357f105fb938becee4e7ec9299ad8 | JavaScript | algorithms-club/algorithms-normatov | /methods/QuickUnion/QuickUnion.js | UTF-8 | 2,094 | 3.15625 | 3 | [] | no_license | 'use strict';
class QuickUnion {
constructor() {
this._elements = [];
this._numberElementsInComponent = [];
}
connect(a, b) {
if (this.isConnected(a, b)) return;
if (isNaN(this._elements[a])) this._elements[a] = a;
if (isNaN(this._elements[b])) this._elements[b] =... | true |
029e09878eedc9efd0713b7bdeec77c2cb43f763 | JavaScript | baitianxin111/baidumap | /homeWork_baidujiangjie/Navigor.js | UTF-8 | 1,308 | 3.171875 | 3 | [] | no_license | (function(){
function NavigationControl (){
this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT;
this.defaultOffset = new BMap.Size(0,0);
}
//继承父类control
NavigationControl.prototype = new BMap.Control();
//重写初始化方法
NavigationControl.prototype.initialize = function(map){
var containter = document.createElement('div');
... | true |
77a690756611c55613a95ccbf32723f11473fea8 | JavaScript | aadil42/Unsplash-Image-Getter | /src/FComponents/SearchBar.js | UTF-8 | 1,120 | 2.609375 | 3 | [] | no_license |
export default function SearchBar({initialState, dispatch}) {
const {
checkFetchedImages,
Action,
ApiUrl,
client_id,
currunt_page,
per_page } = initialState;
function showLoaderUntilFetching(inputText = "") {
dispatch({type: Action.SHOW_LOADER});
handleSubmit(inputText);
... | true |
374ffa95f1c82becab52a5f11eb93a0ff7e74eb8 | JavaScript | davidborah-gda/dynamic-box | /index.js | UTF-8 | 970 | 2.890625 | 3 | [] | no_license | const App = {
count: 0,
colors: ['red', 'green', 'blue'],
init(){
this.cacheDom();
this.bindEventListeners();
this.render();
},
cacheDom(){
this.root = document.querySelector('#app');
this.forwardBtn = this.root.querySelector('.forward');
this.backBtn = this.root... | true |
5c4334333e8eabb49b1df483fcd374866853a770 | JavaScript | nirsgv/leetByte | /problems/bubbleSort/bubbleSort.test.js | UTF-8 | 260 | 2.859375 | 3 | [] | no_license | const bubbleSort = require('./bubbleSort');
test('Be a function', () => {
expect(typeof(bubbleSort)).toBe('function');
});
test('Sorting numbers', () => {
expect(bubbleSort([2,1,0,44,125,7,45,67,-67])).toEqual([-67, 0, 1, 2, 7, 44, 45, 67, 125]);
}); | true |
e8f5b2e88d6fdd6b6fb6612906c16d6d3f7161c5 | JavaScript | blargo1/AstroWeightCalculator-jQuery | /index.js | UTF-8 | 758 | 3.140625 | 3 | [] | no_license |
var planets = [
['Pluto', 0.06],
['Neptune', 1.148],
['Uranus', 0.917],
['Saturn', 1.139],
['Jupiter', 2.640],
['Mars', 0.3895],
['Moon', 0.1655],
['Earth', 1],
['Venus', 0.9032],
['Mercury', 0.377],
['Sun', 27.9]
];
planets.reverse();
$.each(planets, function( index, value ){
$... | true |
08c777d9e71a542dc9f1ccf12b750e1e2a7f6268 | JavaScript | rmkubik/status-code | /src/moves.js | UTF-8 | 235 | 2.671875 | 3 | [] | no_license | import movesData from "../assets/moves.txt";
const moves = {};
movesData.split("\n").forEach((line) => {
const [key, power, area] = line.split(" ");
moves[key] = { key, power: parseInt(power), area };
});
export default moves;
| true |
c7bda15c7231d99b937224f28eff56a3937aca83 | JavaScript | zseti/observe.js | /observe.js | UTF-8 | 2,111 | 3.078125 | 3 | [] | no_license | /*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <pierre@doulcet.fr> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can bu... | true |
d527eba8f689817189d1a38769e3e70c62508fe8 | JavaScript | lokidokicoki/things-stuff-gack | /js/things.js | UTF-8 | 6,620 | 2.78125 | 3 | [] | no_license | var LDC = LDC || {};
LDC.Thing = function (uid,x,y) {
this.uid = 'T'+uid;
this.age = 0;
this.energy = 300;
this.eaten = false;
this.position = [x,y];
this.selected = false;
// expression of genes, choose highest value (dominant)
this.traits = {speed:1, tumble:10, hunt:30, efficiency:1};
this.direction = 0;
t... | true |
cb6e8713dbdfcc48dfc0434715f89a15375f9809 | JavaScript | troygilbert/tiny-adventures-prototypes | /2014-05-09-prototype/basic.js | UTF-8 | 1,115 | 3.03125 | 3 | [] | no_license | var mapWidth = 7;
var mapHeight = 7;
var tileWidth = 32;
var tileHeight = 32;
var game = new Phaser.Game(
mapWidth * tileWidth, mapHeight * tileHeight,
Phaser.CANVAS, 'phaser-canvas',
{
preload: preload,
create: create
}
);
var map;
var layer;
function preload() {
game.scale.maxWidth = 960;
game.scale.maxH... | true |
bd5a04c79e8790c63b28c59b2a3c448969426d34 | JavaScript | vamship/generator-react-redux-web | /generators/app/templates/src/js/utils/url-path-template.js | UTF-8 | 2,020 | 3.140625 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* Represents a url path with replaceable parameters. This utility class can be
* used to generate paths for redirect requests/API calls, and also for route
* definitions within teh web application.
*
* Methods allow access to the raw template path, and a specific path instance
* generated by re... | true |
07165683a149f5034c9a056d369b983d8845ea57 | JavaScript | Cullen-Contrive/Contrive | /src/components/SearchNetwork/SearchOptions.jsx | UTF-8 | 6,627 | 2.625 | 3 | [] | no_license | // Component to manage search bar --> feeds into SearchNetwork and seen at path /search
import React, { useState, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
//CUSTOM COMPONENTS:
import SearchResults from './SearchResults';
// MATERIAL UI
import useStyles from './Search.styles';... | true |
d376a6780a93530e2dc7539b2d07813c3326c141 | JavaScript | bingland/braydenuvu | /dgm2760/02inspectorclouseau/main.js | UTF-8 | 828 | 2.640625 | 3 | [] | no_license | const header = "Inspector Clouseau"
const subheader = "\"This IZ Chief Inspector Clouseau speaking on the pheaun\""
document.querySelector('header h1').innerHTML = header
document.querySelector('header h2').innerHTML = subheader
const xSize = window.innerWidth
const ySize = window.innerHeight
document.querySelector('#... | true |
6552cdfb1db6f900dcac09e8c302b875843a2702 | JavaScript | anupriya-gupta/Web-Development-Intern | /src/api/question-list.js | UTF-8 | 2,834 | 3.046875 | 3 | [] | no_license | import _ from 'lodash';
import { store } from '../store.js';
import { apiFetchBegin, apiFetchSuccess, apiFetchError } from 'actions';
function addParameterToURL(uri, amount, difficulty, type) {
let parameters = [];
console.log(amount)
if (amount !== undefined) {
parameters.push('amount=' + amount);... | true |
d363c6930925ac48e773c4dc6d923f729f0ea3f6 | JavaScript | gentolam/test-site | /scripts/main.js | UTF-8 | 278 | 3.390625 | 3 | [] | no_license | let myHeading = document.querySelector('h1');
myHeading.textContent = 'Hello world!';
document.querySelector('html').onclick = function() {
alert('别戳我,我怕疼。');
}
function multiply(num1, num2) {
let result = num1 * num2;
return result;
}
multiply(4, 7); | true |
abd350c99c20ceb71692ebcde1a49b16acc6be78 | JavaScript | aniket-teltumbade-au9/breaking-bad-universe | /src/redux/reducers/charactersReducer.js | UTF-8 | 617 | 2.640625 | 3 | [] | no_license | import { SET_CHARACTERS, SEARCH_CHARACTER } from "../actionTypes";
import { SINGLE_CHARACTER } from "../actionTypes";
const initialState = {
characters: null,
character: null,
serachResult: null
};
const charactersReducer = (state = initialState, { type, payload }) => {
switch (type) {
case SET... | true |
8085da7156583dfc94f40d0b024d52c2e7957d14 | JavaScript | pakph/google-books-search | /client/src/pages/Search.js | UTF-8 | 1,959 | 2.609375 | 3 | [] | no_license | import React, { useState } from "react";
import API from "../utils/API";
import Header from "../components/Header";
import SearchBar from "../components/SearchBar";
import ResultsContainer from "../components/ResultsContainer";
function Search() {
const [search, setSearch] = useState("");
const [results, setResult... | true |
12981e55569a4349e11bc09a679c0e03f9a75f73 | JavaScript | jeanchen-smu/CAT | /frontend/src/reducers/newPostReducer.js~ | UTF-8 | 1,772 | 2.5625 | 3 | [] | no_license | import moment from 'moment';
const today = new Date((new Date()).valueOf() + 1000*3600*24)
export default function NewPostReducer (
state = {
qacoins: {
value: 0
},
date: null,
dateTime: moment(today).format("YYYY-MM-DD HH:mm"),
errMsg: null,
errMsgOpen: f... | true |
438f4f77469ab6ccf6bd85abdee3d39349e1c0f3 | JavaScript | Markok989/quiz-update | /src/components/quiz/Quiz.js | UTF-8 | 7,400 | 2.78125 | 3 | [] | no_license | import React from 'react';
import $ from 'jquery';
import { connect } from 'react-redux';
import { Panel } from 'react-bootstrap';
import { Link } from 'react-router';
import QuestionQuiz from './QuestionQuiz';
class Quiz extends React.Component {
// konstruktor sa property
constructor(props) {
super... | true |
e591962a1a6f19cf69d8fe13dd2699159a52d3e6 | JavaScript | xiaotianxia/popWin.js | /popWin.js | UTF-8 | 9,389 | 2.671875 | 3 | [] | no_license | //-----------------------------------------
//-------简单弹窗插件----------------------
//-------Created in 2015.6-----------------
//-------Created by DZ---------------------
//-----------------------------------------
(function(window,document){
// ---------------函数声明区------------------
// -------------基础方法--------------... | true |
ef1b7cdb0762a19223d5ccd46d60ae2e16241549 | JavaScript | marcuswarrenca/envoke-zapier | /helpers/flatten_lead_response.js | UTF-8 | 383 | 2.53125 | 3 | [] | no_license | const ForOwn = require('lodash/forOwn');
module.exports = (responseData) => {
ForOwn(responseData.contact, (value, key) => {
switch ( key ) {
case 'id':
case 'remote_id':
// case 'external_id':
responseData[`contact_${key}`] = value;
break;
default:
responseData[key] = value;
break;
... | true |
a67877ee4d0fb8c492520ee443fff7b519705c90 | JavaScript | nidhisyeli27/weather-app | /src/server/server.js | UTF-8 | 5,305 | 2.9375 | 3 | [] | no_license | // Setup empty JS object to act as endpoint for all routes
const dotenv = require('dotenv')
dotenv.config()
var path = require('path');
const fetch = require('node-fetch')
// Express to run server and routes
const express = require('express');
// Start up an instance of app
const app = express();
// Dependencies
const... | true |
544ef6d793f335c3efb874ead801366d7b4519fc | JavaScript | Cscharf91/ceddit-frontend | /src/components/LogIn.js | UTF-8 | 3,754 | 2.59375 | 3 | [] | no_license | import Axios from 'axios';
import React, { useEffect, useRef, useState } from 'react';
const LogIn = (props) => {
const wrapperRef = useRef("");
const wrapperRefSignUp = useRef("");
const [loginForm, setLogInForm] = useState(false);
const [signUpForm, setSignUpForm] = useState(false);
const [signUp, setSignU... | true |
d1f4c5d2ead09743b1fa46fef9fc004728e51a71 | JavaScript | djrobinson/campaign_finance | /src/server/data_format/count_quotes.js | UTF-8 | 412 | 2.8125 | 3 | [] | no_license | var fs = require('fs');
fs.readFile('candidate_summaries.csv', (err, data) =>{
lines = data.toString().split('\n');
lines.forEach((line, j)=>{
if(err) console.log(err);
var lineArr = line.toString().split('');
var count = 0;
for (var i = 0; i < lineArr.length; i++){
if (lineArr[i] === '"'){
... | true |
8aec253452812725cb38538aef8a768e8ff94a1d | JavaScript | biubiubiulol/my_websites | /test2.js | UTF-8 | 1,040 | 3.765625 | 4 | [] | no_license | //This function is going to check the form of the input.
function checker() {
var name, phone, email;
var flag1=false, flag2=false, flag3=false;
display = false;
name = document.getElementById("name").value;
phone = document.getElementById("phone").value;
email = document.getElementById("mail").value;
if (!name)... | true |
f6e6ebc0ce9c8b33537116bbc5952f55dd30204d | JavaScript | juliandkatz/face-rekognition-security | /sqs-poller/index.js | UTF-8 | 1,452 | 2.65625 | 3 | [] | no_license | const AWS = require('aws-sdk')
const sqs = new AWS.SQS({
apiVersion: '2012-11-05',
region: 'us-east-1'
})
const PROJECT_NAME = process.env.PROJECT_NAME
const QUEUE_NAME = `${PROJECT_NAME}-us-east-1-results-queue`
const POLLS_PER_SECOND = 8
async function getQueueUrlByName (queueName) {
try {
const result = ... | true |
011e9d0faa41faf8161f5ef477913576f7cdced9 | JavaScript | rifatcholakov/JS-Core-Module | /{1} JS Fundamentals (Course)/[13] Exercise Objects and JSON/Objects and Assoc Arrays - Exercises/p04_StoreCatalogue/store-catalogue.js | UTF-8 | 551 | 3.515625 | 4 | [
"MIT"
] | permissive | function storeCatalog(arr) {
let catalog = {};
for (let string of arr) {
let [name, price] = string.split(" : ");
catalog[name] = Number(price);
}
let names = Object.keys(catalog).sort();
let letters = new Set();
for (let product of names) {
let cur... | true |
72d1bdc2c78e101367ede9d6a723450f3a61e296 | JavaScript | liamwooding/bbq | /bbq-js/src/main/javascript/bbq/gui/button/GUIButton.js | UTF-8 | 5,098 | 2.921875 | 3 | [] | no_license | include(bbq.gui.GUIWidget);
include(bbq.util.BBQUtil);
/**
* GUIButton
*
* This class creates a link which can be used to receive on click events.
*
* @class bbq.gui.button.GUIButton
* @extends bbq.gui.GUIWidget
*
*/
bbq.gui.button.GUIButton = Class.create(bbq.gui.GUIWidget, {
_disabled: false,
_down: fal... | true |
41b5abdffef56f369aed7c2d7cfc781087b55987 | JavaScript | mogolola/Coding4Interviews | /剑指offer/029-最小的K个数/code.js | UTF-8 | 1,121 | 3.125 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function left(i) {
return 2 * ++i - 1;
}
function right(i) {
return 2 * ++i;
}
function swap(A, i, j) {
let temp = A[i];
A[i] = A[j];
A[j] = temp;
}
function minHeapify(A, i) {
let p = A[i];
let l = A[left(i)], r = ... | true |
b28b287e73d8880a889c66c5a1f742e195b47a6f | JavaScript | mushahiroyuki/ljs3 | /example/ch14/ex14-03-7/main.js | UTF-8 | 1,180 | 3.6875 | 4 | [] | no_license | function countdown(seconds) {
return new Promise(function(onFulfilled, onRejected) {
const timeoutIds = [];
for(let i=seconds; i>=0; i--) {
timeoutIds.push(setTimeout(function() {
if(i===13) {
timeoutIds.forEach(clearTimeout); /* すべてクリア */
return onRejected(new Error(`${i}という数は不吉過ぎま... | true |
e26a0b9b3b12a6d2f940c5ead5ea57728da90f15 | JavaScript | justinthareja/data-structures | /sprint-two/src/graph.js | UTF-8 | 1,088 | 3.484375 | 3 | [] | no_license |
var Graph = function(){
this.storage = {};
};
var GraphNode = function(value) {
this.value = value;
this.edges = {};
};
Graph.prototype.addNode = function(node){
// debugger;
this.storage[node] = new GraphNode(node);
};
Graph.prototype.contains = function(target){
return this.storage.hasOwnProperty(tar... | true |
8197e189983e44c211beceb23af015ae00130aac | JavaScript | DimitarSamarov07/SoftUni-Software-Engineering | /JS Advanced/JS Applications/Exams/JS Applications Exam – UniEnt SPA/scripts/notifications.js | UTF-8 | 920 | 2.9375 | 3 | [] | no_license | const [infoBox, loadingBox, errorBox] = document.querySelectorAll(".alert");
const toggleSwitch = {
true: "block",
false: "none"
}
const timeoutSwitch = {
true: (el) => {
setTimeout(function () {
el.style.display = "none";
}, 5000)
}
}
export function toggleLoading(show) {
... | true |
81a9e5f7df8af10e3e737b64d04ca63206730e32 | JavaScript | chengshuqiang/Vue-UI-for-PC | /src/utils/utils.js | UTF-8 | 2,474 | 3.34375 | 3 | [] | no_license | /** 设置 localStorage 添加对时间的控制,hour单位为小时
* data=null时使用原始sessionStorage(key,value两个参数默认为session),即关闭浏览器过期
* data=0时,使用localStorage,即永不过期
* data>0时添加时间控制,即指定过期时间,类似于cookies
* */
export function setStorage (key, value, hour) {
if (hour === 0) {
window.localStorage.setItem(key, JSON.stringify(value))
} else if (... | true |
2d2fad84426c6bf18921cf35290820f297c0a934 | JavaScript | VKhvesyk/myWebsite | /src/js/script.js | UTF-8 | 1,819 | 2.625 | 3 | [] | no_license | 'use strict';
window.onload = function() {
const preloader = document.querySelector('.preloader'),
preloaderUp = document.querySelector('.preloader__up'),
preloaderDown = document.querySelector('.preloader__down'),
preloaderLeft = document.querySelector('.preloader__left'),
... | true |
59224e1afaadbad84368be68d4ab81d7c30107ad | JavaScript | DomantasKelpsas/Ktu_demo | /js/functions.js | UTF-8 | 321 | 2.640625 | 3 | [] | no_license | $('#tshirt-options-col').css('display','none'); // Hide the text input box in default
function myFunction() {
if($('#tshirt-check-box').prop('checked')) {
$('#tshirt-options-col').css('display','block');
} else {
$('#tshirt-options-col').css('display','none');
}
}
//PRINT TO CONSOLE
... | true |
98228ea8129c032da0e9b3a67dc0b7b09e9fd9b0 | JavaScript | mauhr1987/pvapp | /js/game1.js | UTF-8 | 7,675 | 2.859375 | 3 | [] | no_license | const gameHeader = '<div id="game-header"><h2>Beginner</h2></div>';
var currentView = document.getElementById('game-by-definitions');
var pVerbs = pverbs;
var length = pVerbs.length;
var clueOneEnable = true;
var clueTwoEnable = true;
var coins = 3;
var verbPoints = 4;
var currentVerb, verbPointsId, coinsId;
var userSc... | true |
6e60d476e1d35be242f2b78a9be03ca1c8deb174 | JavaScript | MaryKathryn0/NYTSearch | /mainScript.js | UTF-8 | 1,001 | 3.15625 | 3 | [] | no_license | //#region Variable Declaration
var searchTerm = $("#searchTerm");
var totalRecords = $("#numRecords");
var startYear = $("#startYear");
var endYear = $("#endYear");
//#endregion
//#region API Variables
// articlesearch.json?q={query}&fq={filter}
// Example Call
// https://api.nytimes.com/svc/search/v2/articlesearch.j... | true |
217f7ff8c26db6fe4a5b6968e7c91e3184d2059f | JavaScript | marian-cojoc-ro/demo-music-vis | /src/scripts/transform.js | UTF-8 | 665 | 2.640625 | 3 | [] | no_license | import _assign from 'lodash/assign';
const sampleCanvasState = {
width: 100, // total canvas width
height: 100, //total canvas height
beats: [ //beats array with coords, size, and orientation
{
pos: [
['x1', 'y1'],
['x2', 'y2'],
],
color: 'hsla()'
}
]
};
// takes appl... | true |
9627336ec312743471a2b6c07185718a0e4b5cb8 | JavaScript | Bytefield/gallery_matadero | /programa.js | UTF-8 | 5,900 | 2.53125 | 3 | [] | no_license | // Globals
const window_width = window.innerWidth;
const window_center_x = window.innerWidth / 2;
const window_height = window.innerHeight;
const window_center_y = window.innerHeight / 2;
const coeficient_rotation_y = 15;
const content = document.querySelector('.content')
const left = content.querySelector('.left');
... | true |
92b4f2dad6e46edc7977c2b103802cb8a36cbdb9 | JavaScript | rachelinkala/Flash-Cards | /index.js | UTF-8 | 1,051 | 3.171875 | 3 | [] | no_license | // display a card
// be able to put text on card
// be able to put text on other side of card
// be able to add a new card
// be able to edit a card
// be able to delete a card
class Card {
constructor(term, definition) {
this.term = term;
this.definition = definition;
}
}
let newCard = document.getElemen... | true |
492422539d02fe2d82b950cc645a632e3fe16635 | JavaScript | amit8001/Wannabe_Amazon | /bamazonSupervisor.js | UTF-8 | 3,247 | 2.984375 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var keys = require("./keys.js");
var Table = require('cli-table');
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
// Your username
user: "root",
// Your password
password: keys.dbpwd.pwd,
database: "bamazon"
})... | true |