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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a8c46a64a27e3c03c27e1751e5273a6a893b3efe | JavaScript | alisbiaa/SET | /src/components/backend/DeckManager.js | UTF-8 | 1,440 | 3.5 | 4 | [] | no_license | const num = [1, 2, 3];
const shape = ["moon", "wave" , "square"];
const shading = ["empty", "hashed", "filled"];
const color = ["red", "orange", "green"];
export const createDeck = (difficulty) => {
let advancedDeck = []; // 81 card
let startDeck = []; // 27 card
let i = 0, j = 0;
for (let n of num)
... | true |
0991cdbe1d1805176500533418f129af5ad6e6d4 | JavaScript | Manu974/miniApiFront | /js/supprimerUtilisateur.js | UTF-8 | 375 | 2.515625 | 3 | [] | no_license |
$('ul').on("click", 'button[name="supprimerUtilisateur"]', function(){
$.ajax({
url:'http://test1.developpeurfbs.com/api/users/'+this.id,
type : 'DELETE',
timeout : 3000,
success: function(data){
alert('utilisateur supprimé');
location.reload(true);
},
error: function(){
a... | true |
d05fec8af719c666fc3c0d8326c1424fa02f9934 | JavaScript | frontenddeveloping/ES2015-deferred-class | /src/es2015-deferred-module.js | UTF-8 | 868 | 3.0625 | 3 | [
"MIT"
] | permissive | const PENDING_STATE = 'pending';
const REJECTED_STATE = 'rejected';
const RESOLVED_STATE = 'resolved';
class Deferred {
static PENDING_STATE = PENDING_STATE;
static REJECTED_STATE = REJECTED_STATE;
static RESOLVED_STATE = RESOLVED_STATE;
constructor() {
let state = PENDING_STATE;
let ... | true |
ebf3e6efad99a8e7a78f66a1b14b7508ca13f4b5 | JavaScript | Contargo/flyps | /site/content/example/clock/clock.js | UTF-8 | 527 | 2.859375 | 3 | [
"MIT"
] | permissive | let color = signal("#000");
let now = signal(new Date());
setInterval(() => now.reset(new Date()), 1000);
function display() {
let time = now.value().toTimeString().split(" ")[0];
return h("h1", { style: { color: color.value() } }, time);
}
function colorInput() {
return h("input", {
attrs: { ty... | true |
7c947838b639f1297e6d18c8744c1bde6813b74d | JavaScript | fernandoaugusto/api-deezer | /lamp-iot-app/server.js | UTF-8 | 1,834 | 2.5625 | 3 | [] | no_license | var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var firebase = require("firebase-admin");
firebase.initializeApp({
credential: firebase.credential.cert("config/serviceAccountKey.json"),
databaseURL: "https://inspecaomaquinas1.firebaseio.com"
});
// Get a reference... | true |
5d791ff59d9ed9ba8f93621bc20fb58e2abab3a0 | JavaScript | Rod-S/free-code-camp-algorithms | /intermediateAlgorithmScripting.js | UTF-8 | 348 | 4.4375 | 4 | [] | no_license | // We'll pass you an array of two numbers. Return the sum of those two numbers plus the sum of all the numbers between them. The lowest number will not always come first.
//
// For example, sumAll([4,1]) should return 10 because sum of all the numbers between 1 and 4 (both inclusive) is 10.
function sumAll(arr) {
... | true |
6ceab89abe75c9e33b323297f5600a0fb3fbf6fe | JavaScript | livein/BoBo-Vant-Demo | /deployment/uploader.js | UTF-8 | 2,600 | 2.671875 | 3 | [
"MIT"
] | permissive | // eslint-disable-next-line import/no-extraneous-dependencies
const http = require('http');
const fs = require('fs');
const { success, info, err } = require('./consoleTemplate');
module.exports = class Uploader {
constructor(args) {
this.hostname = args.hostname;
this.port = args.port;
this.path = args.p... | true |
6f66778a6fd298cce2f6aafa69c7a18df062dea8 | JavaScript | oliverpople/news-summary-challenge | /tests/article-list-model-test.js | UTF-8 | 970 | 2.78125 | 3 | [] | no_license | (function(exports) {
function testArticleListIsCreated() {
var articlelist = new ArticleList();
assert.isTrue(article = new ArticleList());
}
testArticleListIsCreated();
function articlesAreStoredOnList() {
var articlelist = new ArticleList();
assert.isTrue(Array.isArray(articlelist._list));
... | true |
b71f4c1fc0d134f6383ec212c078fd43399432b9 | JavaScript | iancl/nodeQuickChat | /build.js | UTF-8 | 5,027 | 2.546875 | 3 | [] | no_license | /**
* THIS WILL BUILD THE PROJECT AND CREATE THE DIST FILE
*/
// imports
_fs = require("fs"),
_uglifyJS = require("uglify-js");
_jshint = require("jshint");
_uglifyCSS = require("uglifycss");
var publicPath = "public/",
htmlFilePath = "./client.html",
jsFiles = ['public/js/libs/jquery.js', 'public/js/libs/socket... | true |
01e022de7b2ff3825b60fcc3d48d0a0640c87beb | JavaScript | sagudelo1200/holbertonschool-higher_level_programming | /0x14-javascript-web_scraping/101-starwars_characters.js | UTF-8 | 787 | 2.53125 | 3 | [] | no_license | #!/usr/bin/node
// -*- coding utf-8 -*-
const request = require('request');
const id = process.argv[2];
const url = 'https://swapi-api.hbtn.io/api/people/';
function search (id, url) {
request(url, function (err, res, body) {
if (err) {
console.log(err);
} else if (res.statusCode === 200) {
const... | true |
a50c815c83e79fb6caaf99641e87119195904fd3 | JavaScript | Filipovic93/CA2_School | /public/script.js | UTF-8 | 6,227 | 2.765625 | 3 | [] | no_license | $(document).ready(function () {
fetchAll();
deletePerson();
initPersons();
initAddBtn();
initCancelBtn();
initSaveBtn();
showRole();
roleevent();
addRoleToPerson();
});
function showRole() {
$("#btn_addrole").click(function () {
$("#roleform").removeAttr("hidden");
... | true |
091969c18a3ba2556f0ce4ecb5f92af50c80a755 | JavaScript | Igor2122/modern-js-practice | /BOM/bomsyntax.js | UTF-8 | 5,388 | 3.125 | 3 | [] | no_license | /*
Window parameters
history: length, back(), forward(), go(3) pass number if 3 forward 3 pages -3 back 3 pages
navigator:
function f () {
let s = '';
for(var in navigator) {
console.log(s ':', navigator[s]);
}
... | true |
e0b4826f5c0393bf23e90a19a561b5a9408b51ac | JavaScript | MohammadAasif/Post_request | /controller/userControoler.js | UTF-8 | 1,342 | 2.625 | 3 | [] | no_license | const userModal = require("../modal/users");
const storeUser = async (req, res) => {
try {
const user = new userModal(req.body);
console.log(user)
const data = await user.save();
res.status(200).send(data);
} catch (error) {
console.log("Error")
}
};
const getUsers = async (... | true |
6380d45a77ff931d097cb11e27f221969bdbe66f | JavaScript | ealbashesh/rbk-toy-problems-1 | /scoreAName/src/problem.js | UTF-8 | 1,484 | 4.25 | 4 | [] | no_license | /*
Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order.
Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
If you can try and sort the words with your own sort a... | true |
66da0b54ee26bd77f284083a5fc05a40a640e8a7 | JavaScript | ic17rey/D3-Challenge | /D3_data_journalism/assets/js/app_r.js | UTF-8 | 3,187 | 3.234375 | 3 | [] | no_license | // Set up the chart
var svgWidth = 1100;
var svgHeight = 850;
var margin = {
top: 40,
right: 40,
bottom: 100,
left: 100
};
var width = svgWidth - margin.left - margin.right;
var height = svgHeight - margin.top - margin.bottom;
// Create the SVG wrapper, append an SVG group to hold data, and shift... | true |
288cc44da4ef6f87b63a5dc27ecc61aae9045417 | JavaScript | SandraMojsova/Node.js | /homework-02/diagonal-difference.js | UTF-8 | 459 | 3.46875 | 3 | [] | no_license | function diagonalDifference(arr) {
let firstDiagonal=0;
let secondDiagonal=0;
let n=arr.length;
for(let i=0; i<n; i++) {
for(let j=0; j< n; j++) {
if(i==j) {
firstDiagonal+=arr[i][j];
}
if(i==n-1-j) {
//i+j==n-1
... | true |
f413e226df06c525bacbaa8a6676f82d6a106a75 | JavaScript | RosenKrumov/Software-University | /Level #1/Javascript-Basics-Course/JavaScript-Basics/JS-LoopsArraysStrings-Homework/_10_ReverseString/stringReverser.js | UTF-8 | 334 | 3.21875 | 3 | [] | no_license | /**
* Created by Rosen on 18.11.2014 г..
*/
function reverseString(str) {
var strArr = [];
for (var i = 0; i < str.length; i++) {
strArr[i] = str[i];
}
strArr.reverse();
console.log(strArr.join(''));
}
reverseString('sample');
reverseString('softUni');
reverseString('j... | true |
e747a543caf5cfaf778cdd915436b7974dcc9e3a | JavaScript | Manasa2903/Upgrad | /js/bloglist.js | UTF-8 | 1,015 | 3.3125 | 3 | [] | no_license | // Get the modal
var modal = document.getElementsByClassName("modal")[0];
// Get the button that opens the modal
var btn = document.getElementsByClassName("fa fa-trash")[0];
var btn1 = document.getElementsByClassName("fa fa-trash")[1];
var btn2 = document.getElementsByClassName("fa fa-trash")[2];
var btn3 = document.g... | true |
d3e2554fba3206afc51fc35fbe1a6018b3b96779 | JavaScript | johnulbright/react-fundamentals | /src/components/apps/timer-apps/TimerApp.js | UTF-8 | 965 | 3.109375 | 3 | [] | no_license | import React,{useState,useEffect} from "react";
//My code
const TimerApp=()=>{
const [time,setTime]=useState(0);
useEffect(()=>{
setTimeout(()=>{
clearTimeout();
setTime(time+1)},
1000);
}
)
return(
<div>
<h1 className="section-tit... | true |
f165607d79196f37a0b5e9f053b51bdb85dd3712 | JavaScript | bindushreek-288/React-training-RJS | /session 4/Destructure.js | UTF-8 | 212 | 2.6875 | 3 | [] | no_license | const user = { person:
{ employee: {
firstname: "Rahul" },
likes: ["Cycling", "Hiking", "Driving"] } }
let {person:{employee:{firstname:name},likes:likes}}=user;
console.log(name,likes); | true |
e4d7cc93a6a561f76191bbdbef8a6d2c08f92a15 | JavaScript | sat-bulsara/BASIC-AJAX-JQUERY-SETUP | /json-example.js | UTF-8 | 764 | 3.28125 | 3 | [] | no_license | // jquery call to wait for DOM to load
$(document).ready(function(){
// container to output data
var container = "";
// API call as variable
var jokeUrl = "https://api.icndb.com/jokes/random/15/";
// jquery ajax
$.ajax({
url: jokeUrl,
type: "GET",
// datatype can be json or json p
dataType: "json",
s... | true |
05fcd0c410117aa1a13159aee52111c21fa96b54 | JavaScript | TodorVyagov/JavaScript-Fundamentals | /7.Homework-Objects/5-6.Tasks/script.js | UTF-8 | 3,548 | 3.921875 | 4 | [] | no_license | function global() {
//functions to write in the html file to visualize the JavaScript operations
function write(element) {
var node = document.getElementById("write").cloneNode(true);
document.body.appendChild(node);
return node.innerHTML = element.toString();
}
function writeL... | true |
e4b6925d6a52fce30a904014346a21e5fa018861 | JavaScript | FernandoFigueroa0710/toy-problems- | /compareTriplets.js | UTF-8 | 766 | 4.46875 | 4 | [] | no_license | /*
Complete the function compareTriplets in the editor below.
It must return an array of two integers,
the first being Alice's score and the second being Bob's.
compareTriplets has the following parameter(s):
alice 5 6 7
bob 3 6 10
*/
function compareTriplets(a, b) {
// create counters
var counterA = 0;
... | true |
a427f43b787a31160bf5fe24a9085d3a7e08ec13 | JavaScript | waterDoge/zk-demo | /src/main/resources/static/js/color-editor.js | UTF-8 | 3,015 | 2.796875 | 3 | [
"MIT"
] | permissive | !function () {
"use strict";
window.addEventListener("load", bindEvent);
function bindEvent() {
var editors = document.querySelectorAll(".color-edit");
editors.forEach(function (t, number, ts) {
var alphaNode = t.querySelector(".color-edit-alpha");
var colorNode = t.... | true |
e8be2bad932624c9d580fd7114c384ae871c19b5 | JavaScript | Chigozie-Gerald/School-Management | /src/component/swipeFile.js | UTF-8 | 8,259 | 2.53125 | 3 | [] | no_license | class Swipe {
constructor(
element,
threshold,
time,
childrenWidth,
childrenPadding,
currentPage
) {
this.skipMovement = false;
this.interval = undefined;
this.threshold = threshold;
this.childrenPadding = childrenPadding;
this.childrenWidth = childrenWidth;
this.time... | true |
cfc570119b902c4c58b0b1d9a231b37e4720c8b5 | JavaScript | StOriJimmy/Origami | /src/graph.js | UTF-8 | 26,165 | 2.859375 | 3 | [
"MIT"
] | permissive | // Graph.js - operations on a graph with vertices, edges, and faces
// all properties follow the .FOLD file specification github.com/edemaine/fold
// MIT open source license, Robby Kraft
//
// "adjacent": 2 vertices are adjacent when they are connected by an edge
// edges are adjacent when they are both c... | true |
a0ab0fb928dffa2a2baba4fd199d75f8cb7a6f26 | JavaScript | WilHall/wilhall.com | /assets/predictive-search.js | UTF-8 | 8,837 | 2.671875 | 3 | [] | no_license | class PredictiveSearch extends SearchForm {
constructor() {
super();
this.cachedResults = {};
this.predictiveSearchResults = this.querySelector('[data-predictive-search]');
this.allPredictiveSearchInstances =
document.querySelectorAll('predictive-search');
this.isOpen = false;
this.abort... | true |
0061b5065aa3710819420d59b745fd236037c89b | JavaScript | rayGreycloud/js-click-drag | /index.js | UTF-8 | 1,148 | 3.3125 | 3 | [] | no_license | // Grab slider element
const slider = document.querySelector('.items');
// Initialize mousedown flag
let isDown = false;
// Initialize position variables
let startX, scrollLeft;
slider.addEventListener('mousedown', (event) => {
// Toggle mousedown flag
isDown = true;
// Add class for cursor grabbing
slider.cla... | true |
83b436a4fd8c894c7e1a0232330548175bfd1a11 | JavaScript | krnbr/node-learning | /src/hoisting.js | UTF-8 | 1,114 | 4.25 | 4 | [] | no_license | var t = "abc";
function test(){
console.log(t);
var t = "def";
console.log(t);
}
/* ==================
Internally Javascript transforms the above code to this:-
function test(){
var t;
console.log(t);
t = "def";
console.log(t);
}
so it runs around to give output like this:-
undefined
d... | true |
0eb374c0742c3c4467804715f49d3017be299d08 | JavaScript | martins81-web/AEC_Front_End | /Programmation1/Examen 1/Q3.js | UTF-8 | 2,822 | 3.765625 | 4 | [] | no_license | // Eric Martins - 05 décembre 2019
// Question 3 - Examen 1
// Vous devez compléter un programme qui permet de calculer une facture pour l’achat d’une grande Pizza.
//
// Le prix de base de la Pizza au fromage est de 10$.
//
// Si on veut des légumes, il faut ajouter 5$ au prix initial.
// Si on veut du pep... | true |
fc775a616fd3a0ba4a2c137fa745557666d5955f | JavaScript | KevinGomezDev/React-Bootcamp-2019 | /src/reducers/movies.js | UTF-8 | 654 | 2.578125 | 3 | [] | no_license | import { REQUEST_MOVIES, RECEIVE_MOVIES, ERROR_MOVIES, REMOVE_MOVIE } from '../actions/actionTypes'
import initialState from './initialState'
export default (state = initialState.movies, action) => {
switch (action.type) {
case REQUEST_MOVIES:
return { ...state, isFetching: true }
case RECEIVE_MOVIES:
... | true |
d730662278ce462730d0f33e4ca7aa979bf4693a | JavaScript | AlvaroIsrael/hero-ngo-app | /hero-frontend/src/pages/Profile/index.js | UTF-8 | 2,782 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React, {useState, useEffect} from 'react';
import './styles.css';
import logoImg from '../../assets/logo.svg';
import {Link, useHistory} from 'react-router-dom';
import {FiPower, FiTrash2} from 'react-icons/fi';
import api from '../../services/api';
export default function Profile() {
const history = useHisto... | true |
42317d924d5e35870ea4e48ef3ffb80b854abf27 | JavaScript | vanneLv/2018CG-Project | /js/modelScene.js | UTF-8 | 21,141 | 2.625 | 3 | [] | no_license | var group;
var villa1;
function initVilla1() {
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath('./assets/');
mtlLoader.load('villa.mtl', function(materials) {
materials.preload();
var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.setPath('./assets/');
... | true |
8da3a73d95a9e6bf440a59d36f44301f0cadd638 | JavaScript | CSHeelys/Example-Project | /server/controllers/starWarsController.js | UTF-8 | 3,465 | 2.921875 | 3 | [] | no_license | const fetch = require('node-fetch');
const { convertToPhotoUrl } = require('../utils/helpers');
const starWarsController = {};
// ADD MIDDLEWARE TO GET MORE CHARACTERS HERE
starWarsController.getMoreChar = (req, res, next) => {
fetch('https://swapi.dev/api/people/?page=3').then((res) => {
return res.json();
... | true |
8a51ef07b54bfbd43b57ec65b3d70bcdbe2a1edb | JavaScript | adrido/skinsdb-fe | /js/newpages.js | UTF-8 | 25,994 | 2.734375 | 3 | [
"MIT"
] | permissive | function useTexture(src) {
var canvas = document.getElementById('myCanvas');
var img = new Image();
img.onload = function() {
if (canvas.getContext) {
var context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(img, 0, 0, canvas.width, canvas.height);
... | true |
d191e9451b5515d883bf53e851aa7b1e69346812 | JavaScript | ele1993/visualizingthecrisis.github.io | /js/search.js | UTF-8 | 1,044 | 2.609375 | 3 | [] | no_license | $(document).ready(function(){
$.get('keywords.xml', function(d){
var areas=$(d).children().first().children();
for(var a=0;a<areas.length;a++){
var $ar=$("<div class='area'></div>");
$('#bulletin-search').append($ar);
var $area=$(areas[a]);
var keywords=$area.children();
$ar.app... | true |
7819b1d91daa8cd22859665c6c87870dad37ddd4 | JavaScript | Aschwins/p5.js | /game-of-life2/sketch.js | UTF-8 | 344 | 3.375 | 3 | [] | no_license | var n_rows = 10;
var m_cols = 10;
function setup() {
createCanvas(400, 400);
grid = create2DArray(m_cols, n_rows);
}
function draw() {
background(255);
}
function create2DArray(m, n) {
// Creates 2 dimensional array with m columns, n_rows.
let arr = []
let i = Array(m)
for (j = 0; j < i.length; j++) {
arr[j... | true |
1086d3fd0272aa7b082bf0723cfe71f842db51df | JavaScript | karmelcorn/calculator | /calculator.js | UTF-8 | 1,158 | 3.015625 | 3 | [] | no_license | const express = require('express');
const app = express();
app.use(express.urlencoded({extended:true}));
// app.get('/', (req, res) => {
// res.send('Hello World!')
// })
app.get("/", function(req, res){
//res.send('Hello World!')
res.sendFile(__dirname + "/index.html")
//console.log(__dirname);
});
app.pos... | true |
f33bf0128a41148f70bec3ede24566d6abf13afc | JavaScript | nss-evening-cohort-3/spa-milestone-quiz-ryan-b-writin | /quiz.js | UTF-8 | 376 | 2.546875 | 3 | [] | no_license | function populatePage (inventory) {
// Loop over the inventory and populate the page
//generate car cards
//display all properties of car
// Now that the DOM is loaded, establish all the event listeners needed
CarLot.activateEvents();
}
// Load the inventory and send a callback function to be
// invok... | true |
82f7e71401ee8205e475026d1bd04c41a99ab87b | JavaScript | alexYooDev/jsAlgorithmStudy | /weeklyCodingChallenge/WCC2_MutualAssessment.js | UTF-8 | 1,811 | 3.46875 | 3 | [] | no_license | function countMin(arr) {
let count = 0;
let searchMin = Math.min(...arr);
let pos = arr.indexOf(searchMin);
while (pos !== -1) {
count++;
pos = arr.indexOf(searchMin, pos + 1);
}
return count;
}
function countMax(arr) {
let count = 0;
let searchMax = Math.max(...arr);
let pos = arr.indexOf(... | true |
64d0cd23391bf41d6816d90ee224cffc160eac4e | JavaScript | Isaiah-Jones/PopcornStand | /public_html/VIK-PHP/sample_sql.js | UTF-8 | 2,462 | 2.828125 | 3 | [] | no_license | var log = console.log.bind(console);
//******************************************************
function _(x) {
return document.getElementById(x);
}
//******************************************************
function ValidateData() {
// UserID = 1; // get this from somewhere
//Declare variables
var firstname = doc... | true |
090a41d3bcc843e6fee59617211837aaa7f71997 | JavaScript | 190n/five.js | /dist/keyboard.js | UTF-8 | 763 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = init;
function init(elem, capture, callback) {
var pressed = [];
elem.addEventListener('keydown', function (ev) {
if (capture) ev.preventDefault();
pressed.push(ev.keyCode);
callback({
... | true |
4e338ef979dd5980c4450ede28183ffc07b2c69a | JavaScript | Tommy-Appleby/movieGoers | /public/app.js | UTF-8 | 1,249 | 3.046875 | 3 | [] | no_license | const reviewList= document.querySelector('#review-list');
const form = document.querySelector('#add-review-form');
function renderReview(doc)
{
let li = document.createElement('li');
let movieName = document.createElement('span');
let releaseDate = document.createElement('span');
let Genre = document.c... | true |
e8a9f988a12200c6506b2c33e453db011c931834 | JavaScript | fahad1226/JavaScript-Advanced-Concept | /ES-6/fat-arrow-fun.js | UTF-8 | 1,004 | 3.875 | 4 | [] | no_license | const javascript = {
// example with 'this' problem
name: "JavaScript",
libraries: ["React", "Vue", "jQuery"],
printLibraries: function () {
var self = this; // eta ekta simple hack to solve that 'this' problem but its not convenient
//console.log(this);
this.libraries.forEach(fu... | true |
488100087f6da4988626b2f5f83077d07d4477d6 | JavaScript | RodrigoDLPontes/visualization-tool | /src/examples/ExampleModals.js | UTF-8 | 7,987 | 2.9375 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause-Views",
"BSD-2-Clause"
] | permissive | import React from 'react';
// Include the ClassName of algorithms that should have an example modal
const Modals = {
ArrayList: (
<ul>
<li>ArrayLists must be contigous so you cannot add at an index greater than size.</li>
<li>Likewise, you cannot remove at an index greater than or equal to size.</li>
</ul>
... | true |
2a992f53183b6cffb6bcde2ad86843e4dd0918c1 | JavaScript | Cubix1337/ada | /my-app/socket-client/src/NewPlayer.js | UTF-8 | 927 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
class NewPlayerRegistrationButton extends Component {
constructor(props) {
super(props);
this.state = {name: ''}
this.setName = this.setName.bind(this);
console.log(this.props.socket)
}
setName = ... | true |
f038516e06d1e87e7c15a84037833d7be09a284c | JavaScript | yyfrankyy/fwdns | /zone.js | UTF-8 | 1,218 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict';
class Zone {
constructor(hosts, whitelist) {
this.root = {};
this.whitelist = whitelist;
this.hosts = Array.isArray(hosts) ? hosts : [hosts];
this.buildIndex();
}
buildIndex() {
const root = this.root;
this.whitelist
.map(domain => reverse(domain))
.sort()
... | true |
8b8fcdd7f6f03cd9d2fbe47494f56c822e1cc2b3 | JavaScript | notablemind/next | /plugins/browser/Sidebar.js | UTF-8 | 1,855 | 2.640625 | 3 | [] | no_license | // @flow
import React, {Component} from 'react';
import {css, StyleSheet} from 'aphrodite'
export default class Sidebar extends Component {
state: {
width: number,
links: string[],
selected: number,
}
constructor() {
super()
this.state = {
width: 800,
links: [],
selected: 0... | true |
1ab122c27d2d2bf1980c5416a6fa9282b199e55d | JavaScript | gilang-parjiyo/Master-Javascript-Programming-Exercises | /exercises/033-isPersonOldEnoughToDrinkAndDrive/solution.hide.js | UTF-8 | 190 | 3.078125 | 3 | [] | no_license | function isPersonOldEnoughToDrinkAndDrive(person) {
// the person object contains an "age" property inside
// your code here
if(person.age >= 21){
return true
}
return false
} | true |
15aae9ce707218bb3d8424ee70b10506cfd58df3 | JavaScript | hackbansu/todoList-with-SQL-storage-at-node-server | /db.js | UTF-8 | 2,081 | 2.546875 | 3 | [] | no_license | /**
* Created by pawan on 11/2/17.
*/
const mysql = require('mysql');
const dbconf = {
host: 'localhost',
user: 'pawan',
password: 'bansal',
database: 'mydatabase',
};
function getAllTodos(done) {
let conn = mysql.createConnection(dbconf);
conn.connect();
conn.query("SELECT * FROM todos... | true |
649970849cf80f6181949d79e46bbae8318b3620 | JavaScript | abhinavmaurya/WebDevSpring2016 | /public/assignment/client/views/forms/forms.controller.js | UTF-8 | 2,304 | 2.640625 | 3 | [] | no_license | /**
* Created by abhinavmaurya on 2/19/16.
*/
"use strict";
(function (){
angular
.module("FormBuilderApp")
.controller("FormController", FormController);
function FormController(FormService, UserService, $location){
var vm = this;
function init(){
vm.usr = User... | true |
2363cf95a72c6f56f38af83ef12820a46ddf0065 | JavaScript | lordliquid/react-emotion | /src/AnimTypes.js | UTF-8 | 161 | 3.046875 | 3 | [] | no_license | export function tween(start, end) {
if (start > end) {
start = start - 1;
}
if (start < end) {
start = start + 1;
}
return start;
}
| true |
7e80b9f3ff5effafb29cee57cb51787d55103681 | JavaScript | VinylFox/SocrataCodingChallenge | /src/shop/Basket.js | UTF-8 | 1,014 | 3.40625 | 3 | [] | no_license | /**
* @class Basket
* This class is responsible for maintaining a basket of
* products the customer has added.
* @param {Object} config A configuration object to set the initial config for this class
*/
function Basket(config) {
this.items = (config) ? config.items : undefined || [];
}
/**
* Retrieve all i... | true |
b93337283eb2f0fcfaf9f3b290fe656e06b12733 | JavaScript | ballercat/walt | /packages/walt-compiler/src/core/bool.js | UTF-8 | 1,332 | 2.671875 | 3 | [
"MIT"
] | permissive | /**
* Bool plugin.
* Converts boolean identifiers to i32 constants, handles declarations with
* type "bool".
*
* @flow
*/
import Syntax from 'walt-syntax';
import type { SemanticPlugin } from '../flow/types';
export default function booleanPlugin(): SemanticPlugin {
return {
semantics() {
const decla... | true |
0dc285cdc731530b04794f6f0d079997d852880d | JavaScript | HieroWsi/puppeteer-test | /puppeteer/common/mockDate.js | UTF-8 | 2,688 | 3.5625 | 4 | [] | no_license | // const expression = `
// /**
// * Overwrite Date constructor with configurable current time
// * @param {object} Date - The native Date object
// * @param {Number} year - Optional. Default year to this.
// * @param {Number} month - Optional. Default month to this.
// * @param {Number} day ... | true |
a4f9a8588848e9c43641194222023139808ad2e9 | JavaScript | VadimBrodsky/exercism | /javascript/hamming/hamming.js | UTF-8 | 325 | 3.09375 | 3 | [] | no_license | "use strict";
var Hamming = function() {};
Hamming.prototype.compute = function(dna1, dna2) {
if (dna1.length !== dna2.length) {
throw new Error('DNA strands must be of equal length.');
} else {
return dna1.split('').filter((part, i) => part !== dna2[i]).length;
}
};
module.exports = Hamm... | true |
e7e6489ee8a8997e787d475146a2b7e46aea8644 | JavaScript | DamianFox/voting-app | /src/redux/reducers/polls.js | UTF-8 | 1,075 | 2.765625 | 3 | [] | no_license | const initialState = {
polls: [],
poll: {},
error: false
}
export default (state=initialState, action) => {
switch (action.type) {
case 'LOAD_POLLS' :
return {
...state,
polls: action.polls
}
case 'VIEW_POLL':
return {
poll: action.poll
}
case 'ADD_PO... | true |
d36baa8b5671aee698360dc8f6e977b72b799136 | JavaScript | grymyk/js_octa | /src/Sketch/draw.js | UTF-8 | 536 | 2.625 | 3 | [] | no_license | function Draw(sk) {
sk.background(250);
sk.rotateY(sk.frameCount * 0.01);
for (let j = 0; j < 5; j++) {
sk.push();
for (let i = 0; i < 80; i++) {
sk.translate(
sk.sin(sk.frameCount * 0.001 + j) * 100,
sk.sin(sk.frameCount * 0.001 + j) * 100,
... | true |
2220542a296e4232c7078da956633eb55a8fa9ae | JavaScript | DundarKoray/Integrify_Assignment_JavaScript-Questions | /js/question_functional programming.js | UTF-8 | 8,802 | 4.84375 | 5 | [] | no_license | // QUESTIONS
/*
1-Explain the difference between forEach, map, filter, and reduce.
2-Use forEach to console.log each country in the countries array.
3-Use forEach to console.log each name in the names array.
4-Use forEach to console.log each number in the numbers array.
5-Use map to create a new array by changing ... | true |
3857698204b8532a89d954f08dd47ae4fb9d4a91 | JavaScript | christianplusplus/DSabc | /darkSouls.js | UTF-8 | 679 | 2.546875 | 3 | [] | no_license | function RandomImage(){
var a;
a = Math.floor(Math.random() * 7);
if(a == 0){
document.getElementById('banner').src = 'images/DS2KnightBanner(cropped).jpg';
}
if(a == 1){
document.getElementById('banner').src = 'images/dragonSlayer(cropped).jpg';
}
if(a == 2){
document.getElementById('banner').src = 'image... | true |
1d8544d98a8d2f66e16e9f40cd64d28d80e6db75 | JavaScript | lostcomb/Image-Tile | /view/SettingsView.js | UTF-8 | 4,166 | 2.6875 | 3 | [] | no_license | const {settings} = require("../model/Storage");
/**
* This defines the settings view.
*/
module.exports = (function() {
/**
* This constructs a new SettingsView object. It first sets the default values
* for the inputs, then adds the listeners for the inputs.
*
* @param config the object cont... | true |
57ecd1569256696a124f52d57c82ed05bfa3a09b | JavaScript | Felipeesilva/Stream | /static/function/function.js | UTF-8 | 863 | 2.6875 | 3 | [] | no_license | jQuery(function($) {
$('#filtro').change(function() {
var filtro = $('#filtro').val();
switch (filtro) {
case 'todos':
console.log(filtro)
break;
}
switch (filtro) {
case 'fiction':
console.log(filtro)
break;
}
switch (filtro) {
case 'acao':
... | true |
7f89f98e44b00891e4932e9def37fe5499fb9f31 | JavaScript | BUPTEMC/LMS | /public/javascripts/equipment/detail.js | UTF-8 | 2,543 | 2.734375 | 3 | [
"MIT"
] | permissive | function getCookie(c_name){
if (document.cookie.length>0){
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1){
c_start = c_start + c_name.length+1;
c_end = document.cookie.indexOf(";",c_start);
if (c_end == -1) c_end = document.cookie.length;
return unescape(document... | true |
b8f80395cec079e64cd29e8344cf72eb5387cd21 | JavaScript | forever-scmdr/evolve | /web/js/booking-form.js | UTF-8 | 1,752 | 2.59375 | 3 | [] | no_license | $(document).ready(function(){
generateBirthDates();
$(".birth-date").find(".years, .months").change(function(){
disableDays($(this).closest(".birth-date"));
});
// $("#pin").keyup(function(e){
// v = $(this).val();
// if(v.length > 3){
// $("#get-pin").hide();
// $("#set-pin").show();
// }else{
// ... | true |
f627e90949310864b888b83e0bef96680e4578ab | JavaScript | Tipez/Discord-Bot | /app/commands/jokeRandomCategory.js | UTF-8 | 479 | 2.703125 | 3 | [] | no_license | const axios = require('axios').default;
module.exports = {
name: 'jokerandomcategory',
description: 'Renvoie une random Chuck joke pour la cétégorie spécifiée',
execute(message, args) {
const categories = args[0].toString().toLowerCase()
const url = 'http://api.icndb.com/jokes/random?exclud... | true |
841eee43ee50fde6a7edb02b2d915175a59c9cc0 | JavaScript | qcldn/meal-planner-workshop | /src/client/recipeList.js | UTF-8 | 960 | 2.515625 | 3 | [
"MIT"
] | permissive | import React from 'react'
import ReactDOM from 'react'
import Recipe from './recipe'
export default class RecipeList extends React.Component {
constructor(props) {
super(props)
this.handleChooseRecipe = this.handleChooseRecipe.bind(this)
this.recipesReceived = this.recipesReceived.bind(this)
this.re... | true |
172eb105da78ac9d84a8936af29a9662583c1b39 | JavaScript | yumiko2695/event-scheduling-dashboard | /common-dash/server/utils/showsUtils.js | UTF-8 | 1,593 | 2.796875 | 3 | [] | no_license | const firebase = require('firebase')
//get shows
const getShows = async (edition) => {
const db = firebase.firestore()
try {
const showDocs = await db.collection('festival').doc(edition).collection('shows').get()
const shows = showDocs.docs.map((doc) => {return {id: doc.id, ...doc.data()}})
console.log(show... | true |
859972bec9d79ff8c5cc1cab8ceb55b64940aed5 | JavaScript | aghaffar570/DS_JS | /SinglyLinkedList.js | UTF-8 | 3,468 | 4.1875 | 4 | [] | no_license | /*
node -> node -> node -> node -> null
dynamic size, flexible memory usage than arrays
O(1) insertion for front/ end, O(n) at specifc index
O(1) deletion for front only, O(n) at specfic index/ end
O(n) searching/ access in non-contiguous memory
*/
class SinglyLinkedList {
constructor() {
this.head = null;... | true |
404c4209dbd7bdfed2684d9699c81197ff5b0df1 | JavaScript | Kan-T/react-auto-layout | /samples/sampleItems/components/DemoHook.js | UTF-8 | 697 | 2.609375 | 3 | [
"MIT"
] | permissive | import React from "react";
import useCount from "./useCount";
function DemoHook() {
// Declare a new state variable, which we'll call "count"
const [count, countPlus, countMinus] = useCount(0);
return (
<div className="demo-hook">
<h2 data-testid="countvalue" className="mx-5">{count}</h2>
{/* <b... | true |
cf344ef1e77564452078447e1044ad9ae4bdaaf0 | JavaScript | Thylossus/tud-movie-character-insights | /Server/Tools/evaluation basic/evaluate.js | UTF-8 | 9,015 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
var evaluation1 = require('./processed-evaluation-1.json');
var evaluation2 = require('./processed-evaluation-2.json');
var fs = require('fs');
var ss = require('summary-statistics');
var _ = require('underscore');
function calcMember(evaluation) {
return evaluation.length;
}
function calcCorrectAn... | true |
79200b1553c17a400828d0dda791bf5d0935891e | JavaScript | awalin/ConferenceMonitor | /visualizations.js | UTF-8 | 3,274 | 2.796875 | 3 | [
"LPPL-1.3c"
] | permissive |
// function tweetPace(){
//now show the pace of the tweets, quantized per hour //
d3.csv('tweet-pace-hour.csv', function( data ){
format = d3.time.format("%Y-%m-%d %H:%M");
var w = 900,
h = 200;
var m = [20, 40, 20, 40];
w = w - m[1] - m[3];
h = h - m[0] - m[2];
var parse = d3.time.form... | true |
f825cc5d74921b490eba1037cc4ab3504f003d47 | JavaScript | FlavioGavarini/ProgettoTPS | /scriptProj.js | UTF-8 | 916 | 2.8125 | 3 | [] | no_license | var table = document.getElementById("tab");
var cells = table.getElementsByTagName("td");
var tot = 0;
for (var i = 0; i < (cells.length -1); i++)
{
var v = cells[i].textContent;
if (! isNaN(v))
{
v = parseInt(v); // parseInt converte in numeri ma non ritorno un valore bo... | true |
f81af1531acc98c36aca8284bd35f23d38dfdc7d | JavaScript | QuentinDamianino/wsei-javascript-zadania | /1_Zadania/obowiązkowe/1_Funkcje_czasu/js/app.js | UTF-8 | 245 | 3.515625 | 4 | [] | no_license | function countHello(number){
var number2 = 1;
const interval = setInterval(function(){
console.log('Hello ' + number2);
if(number === number2) clearInterval(interval);
number2++;
}, 1000);
}
countHello(10); | true |
71121c8f70cb0210e9181770709dbfc278ad009c | JavaScript | jesusmoya95/DWEC | /Tema 2/Ejercicios/Doc2Ejerc8.js | UTF-8 | 477 | 3.3125 | 3 | [] | no_license | function numaleatorio() {
var aleatorio = Math.round(Math.random()*2);
switch (aleatorio){
case 0:
document.write('<img src="imagen1.jpg" width="700" height="500"');
break;
case 1:
document.write('<img src="imagen2.jpg" width="700" height="500"');
... | true |
e7e08a19141c49a1fa18423bc2528bc6a2ae6a8b | JavaScript | Valkrys/team-solid-waffle | /api/spec/family.spec.js | UTF-8 | 952 | 2.6875 | 3 | [] | no_license | const request = require('request');
const app = require('../index.js');
const BASE_URL = `${process.env.SERVER_URL}:${process.env.PORT}`
describe("GET /families", function () {
let err;
let res;
let body;
beforeAll(function (done) {
request.get(`${BASE_URL}/families`, (e, r, b) => {
err = e;
... | true |
08cfd952876fd2d7faf45bafe035f3674e1ebf94 | JavaScript | italo-patricio/domain-graph-service-netflix | /apollo-gateway/resolvers/index.js | UTF-8 | 1,548 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | const { products, sellers } = require('../data');
const DataLoader = require('dataloader');
// // Example with problem N + 1
// module.exports = {
// Query: {
// products: () => products,
// },
// Product: {
// seller: (parent) => {
// console.log(`fetching seller ${parent.id}`)... | true |
b0f2b80e4bd9bb8af357f84fd510c9c2c5382202 | JavaScript | PolarisTLX/Algorithms-and-Data-Structures | /CodeFights/Grab all longest strings.js | UTF-8 | 864 | 3.625 | 4 | [] | no_license | https://codefights.com/arcade/intro/level-3/fzsCQGYbxaEcTr2bL/solutions
Given an array of strings, return another array containing all of its longest strings.
Example
For inputArray = ["aba", "aa", "ad", "vcd", "aba"], the output should be
allLongestStrings(inputArray) = ["aba", "vcd", "aba"].
function allLonges... | true |
ea9eeac17d800fc2baca03be8a5329a175cfea45 | JavaScript | SokolovAlex/react-starter | /config.js | UTF-8 | 1,046 | 2.5625 | 3 | [] | no_license | const path = require('path');
const cwd = relpath => path.resolve(process.cwd(), relpath || '');
class Condition {
constructor(pred) {
this.is = pred;
this.isNot = !pred;
}
if(thenValue, elseValue = undefined) {
return this.is ? thenValue : elseValue;
}
ifNot(thenValue, e... | true |
fa62f316b1c26cf4387735b251b9b72208a4d968 | JavaScript | ciqulover/snake | /dist/main.js | UTF-8 | 3,213 | 2.53125 | 3 | [] | no_license | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex... | true |
5ec992efbb8e26aa595e5660b46ec85e86c88648 | JavaScript | THRY/React-Oreka | /src/components/CategoryDisplay.js | UTF-8 | 4,217 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import '../Stylesheets/components/CategorySelector-style.scss';
class CategoryDisplay extends Component {
state = {
catList: []
}
componentWillMount() {
this.createCatList();
}
hasBorderBottom(listLenght, currentIndex) {
let style = {};
if(window... | true |
b8c29c4ec4121e11c9af5b0be85bbd6c09eeea8e | JavaScript | dhershman1/kyanite | /src/object/any.js | UTF-8 | 879 | 3.25 | 3 | [
"MIT"
] | permissive | import _curry2 from '../_internals/_curry2.js'
/**
* @name any
* @function
* @since v0.1.0
* @category Object
* @sig Object k (v -> Boolean) -> Object -> Boolean
* @description Takes in a schema of functions to apply to an object, makes sure any of them pass
* @param {Object} schema An Object schema co... | true |
48e9706069ffe2bb57e503044a22ee575ba24e87 | JavaScript | laredlaboratorio/javascript | /js/app2.js | UTF-8 | 10,197 | 2.640625 | 3 | [] | no_license | var operandoa;
var operandob;
var operacion;
var cantidadDecimal = false;
var resultado = false;
var signo = null;
var reducir = 0;
function calculadora() {
var display = document.getElementById("display");
var cero = document.getElementById("0");
var uno = document.getElementById("1");
var dos = document.getEleme... | true |
442fdb66742843e1661d3b3e081e10d0504af917 | JavaScript | AlexMrgt/react-mesto-api-full | /frontend/src/utils/api.js | UTF-8 | 2,398 | 2.5625 | 3 | [] | no_license | class Api {
constructor(
{
baseUrl,
}) {
this._baseUrl = baseUrl;
}
_checkResponce(res){
return res.ok ? res.json() : Promise.reject(`Ошибка: ${res.status}`)
}
getUserInfo(){
return fetch(`${this._baseUrl}/users/me`, {
'credentials': 'include',
})
.then(res =>... | true |
731ebc38dbae35c7c9979a570e9d662b6d2513b7 | JavaScript | LarissaCouto14/Serratec_2021 | /Fase 3/questão12.js | UTF-8 | 361 | 3.34375 | 3 | [] | no_license | //O programa “bem-vindo” pergunta seu nome e sobrenome, e depois gentilmente te cumprimenta.
const prompt = require ("prompt-sync")();
const ler = require("prompt-sync")();
var nome = ler ("Digite seu nome: ");
var sobrenome = ler ("Digite seu sobrenome: ");
console.log ("Olá " + nome + sobrenome + ", seja bem vin... | true |
eadc4cc367a0d77edd400eb822b096dd04a6db04 | JavaScript | tstrat-devmountain/simulation-2 | /sim2/src/ducks/reducer.js | UTF-8 | 2,724 | 2.9375 | 3 | [] | no_license | const INITIAL_STATE = {
name : '',
address: '',
city : '',
state : '',
zip : 0,
img : '',
mortgage: 0,
rent: 0,
dashboard : true
}
const CLEAR_ALL = "CLEAR_ALL";
const UPDATE_NAME = "UPDATE_NAME";
const UPDATE_ADDRESS = "UPDATE_ADDRESS";
const UPDATE_CITY = "UPDATE_CITY";
const UPDA... | true |
b59585d6333f73c92971da13480358e5e277a167 | JavaScript | jakobbossek/jquery.highlightQuery | /jquery.highlightQuery-1.0.js | UTF-8 | 1,384 | 2.84375 | 3 | [] | no_license | ;(function($) {
jQuery.fn.highlightQuery = function(arg) {
var options = $.extend(
{},
$.fn.highlightQuery.defaults,
arg
);
return this.each(function() {
// determine referrer
var referrer = document.referrer || "http://www.google.de/?q=venenatis vestibulum";
// extract query string
var q... | true |
6414f1d67a0637f692e3b97b59acc8b583d6cf17 | JavaScript | meiaalsup/compost-share | /client/src/AddLocation.js | UTF-8 | 12,355 | 2.59375 | 3 | [] | no_license | import React from 'react';
import './AddLocation.css';
import SERVER_URL from './config';
import Geocode from "react-geocode";
Geocode.setApiKey("AIzaSyCpRMzf69BbqeV9IuswQUXeW19VXmJ3azg");
Geocode.setLanguage("en");
Geocode.setRegion("en");
class AddLocation extends React.Component {
constructor(props) {
super(... | true |
be45c8943e26b7de99e52a5f1cfaabdb806fc742 | JavaScript | ibrianfrancisco/mancala | /js/main.js | UTF-8 | 3,318 | 3.515625 | 4 | [] | no_license | // Variables
let player, board, gameover;
// Elements
const bowls = document.querySelectorAll('.bowl');
const winMsg = document.getElementById('win-msg');
const playerName = document.getElementById('player');
const gameButton = document.getElementById('new-game');
// Functions
function initilize() {
board = [4,4,4,... | true |
4d9b803bc961dc45ea3b42a6e1d72ad7f46dfec6 | JavaScript | emrickgarrett/Carcassonne | /board_game/Player.js | UTF-8 | 707 | 3.328125 | 3 | [] | no_license | const {Meeple} = require('./Meeple');
class Player{
constructor(name, color){
this.name = name;
this.color = color;
this.init();
}
init(){
this.points = 0;
this.meepleList = [];
for(var i = 0; i < 7; i++){
this.meepleList.push(new Meeple(this));
}
}
toString(){
return name + ", " + col... | true |
f6781c116218404eb294d190e3e1b0f959dce0bf | JavaScript | indraarianggi/learn-reactjs-part3 | /src/firebase/firebase.js | UTF-8 | 4,335 | 3.21875 | 3 | [] | no_license | import * as firebase from 'firebase';
import moment from 'moment';
// Initialize Firebase
const config = {
apiKey: "AIzaSyBCBz0HBp83ZDYaHpbXbYPfh_EkBpfyFHo",
authDomain: "expensify-9abad.firebaseapp.com",
databaseURL: "https://expensify-9abad.firebaseio.com",
projectId: "expensify-9abad",
storageBu... | true |
3b3621bac97e6a9d0efb1f982dcb6cb00172dceb | JavaScript | JustinLague/Demo-Website | /server/src/controllers/image.controller.js | UTF-8 | 2,342 | 2.609375 | 3 | [] | no_license | const ImageData = require('../models/imageData').ImageData;
const Image = require('../models/image').Image;
const fs = require('fs');
class ImageController {
async image(req, res) {
try {
var id = req.params.id;
var image = await ImageData.findOne({ _id: id }).select("-__v").exec();
res.... | true |
c9436be36c6492d191944a58eac93be4c1bba8f5 | JavaScript | cgers/DevConnector | /client/src/reducers/postReducer.js | UTF-8 | 994 | 2.890625 | 3 | [] | no_license | import { ADD_POST, GET_POSTS, POST_LOADING, DELETE_POST, GET_POST } from '../actions/types';
//Empty object for the errors
const intitalState = {
posts: [], // An array of posts
post: {}, // A singular object or post
loading: false // Set spinner to not loading
};
export default function(state = intitalState, act... | true |
78c5c1292117282e5817694473b2f102735cdd66 | JavaScript | Tresor11/Coding-Challenges | /Linked-list/remove-nth-node-from-the-end.js | UTF-8 | 438 | 3.3125 | 3 | [] | no_license |
//problem link
// https://leetcode.com/problems/remove-nth-node-from-end-of-list/
var removeNthFromEnd = function (head, n) {
let dummy = new ListNode("a");
dummy.next = head;
let current = head;
let i = 0;
while (current !== null) {
i++;
current = current.next;
}
i = i - n;
current = dummy;
... | true |
59ad50b8381b4715a6a4a7c74a5e64f9f90a30c6 | JavaScript | lnchambers/javascript-add-comments-challenge | /source/addComment.js | UTF-8 | 833 | 2.734375 | 3 | [] | no_license | $(document).ready(function(){
$('#new_comment_button').click(function () {
$('new_comment_button').hide();
var body = '<textarea name="comment_body"></textarea>'
var author = '<input name="author" type="text"></input>'
var submit = '<input id="comment-submit" name="submit" type="submit"></input>'
... | true |
fd09a6e57b7fe5ef003158cca3b58effdf6da66c | JavaScript | ScriptRaccoon/Netflix-Rate-Button | /main.js | UTF-8 | 2,289 | 2.84375 | 3 | [] | no_license | const currentMovie = {
id: "28630857",
title: "Princess Mononoke",
rating: null,
added: false,
};
let ratingPossible = false;
$(".ratingImage").click(showRatingOptions);
$(".addImage").click(toggleAdd);
$(".cancel").click(() => {
if (!ratingPossible) return;
hideRatingOptions();
});
functio... | true |
120625e05319570240807dc793c361bfde93e073 | JavaScript | mdeamico/cannons | /src/weapons/munitions/Ball.js | UTF-8 | 287 | 3 | 3 | [] | no_license | export class Ball {
constructor(strength) {
this.x = 0;
this.y = 0;
this.radius = 3;
this.vx = 1;
this.vy = -1;
this.isAlive = true;
this.color = "#000000";
this.strength = strength;
}
update() { /*empty */}
}
| true |
34dc9d0c4e0a970256fd65be8ab24fead2a67861 | JavaScript | gustavofsp90/Phonegap_Javascript-TravelPal_App | /platforms/browser/www/js/my-app.js | UTF-8 | 8,116 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive |
// Initialize app
var myApp = new Framework7();
// If we need to use custom DOM library, let's save it to $$ variable:
var $$ = Dom7;
// Add view
var mainView = myApp.addView('.view-main', {
// Because we want to use dynamic navbar, we need to enable it for this view:
dynamicNavbar: true
});
// Handle Cord... | true |
b9338355e2ee335b31d76b8147aa9188b050bf22 | JavaScript | GeoKnow/Jassa-Core | /lib/sparql/expr/E_OneOf.js | UTF-8 | 1,328 | 2.671875 | 3 | [] | no_license | var Class = require('../../ext/Class');
var Expr = require('./Expr');
// helper
var getSubstitute = function(node, fnNodeMap) {
var result = fnNodeMap(node);
if (!result) {
result = node;
}
return result;
};
// TODO Change to ExprFunctionN
// TODO rhs should be exprList instead of nodes
var E_... | true |
18ddea2026d978eb724bfb24761d7d9061b9ea8d | JavaScript | banjolina-jolie/2013-04-more-data-structures | /spec/treeSpec.js | UTF-8 | 1,322 | 3.640625 | 4 | [] | no_license | describe("tree", function() {
var tree;
beforeEach(function() {
tree = makeTree("Node0");
});
it("should have methods named 'addChild' and 'contains', and a property named 'value'", function() {
expect(tree.addChild).toEqual(jasmine.any(Function));
expect(tree.contains).toEqual(jasmine.any(Functio... | true |
7503bbc298494e6ffd994649af28b33960fc24f7 | JavaScript | Ivansek/thesis | /application/Population.js | UTF-8 | 13,168 | 3.0625 | 3 | [] | no_license | function Population(size, crossover_rate, mutation_rate)
{
this.population = this.init(size);
this.m_rate = mutation_rate;
this.c_rate = crossover_rate;
}
Population.prototype.init = function(size)
{
var population = [];
var start_time = new Date();
for( var i=0; i<size; i++)
{
population.push(new Configurati... | true |