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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
90a9196cbd085252b9699e2bd90d87f8aa5b95a0 | JavaScript | CodingRosen/js_basics | /s7.js | UTF-8 | 3,867 | 4.21875 | 4 | [] | no_license | // 12/19/2020 - Session 7
// Review of Sync/Async - Blocking/Non-blocking
// Readline question method running async
// Reviewed Arrays & Loops
// ArrayMethodsExamples
// objects, creating them
// practiced typeof
// learned about the Constructor method
// this, new, instanceof - the... | true |
8ee83604d8103d682ab79ba867e02ae2fb5646bb | JavaScript | evanscatie/dom-exercise-20191206 | /scripts/index.js | UTF-8 | 2,327 | 3.703125 | 4 | [] | no_license | // Challenge #1 make this show up on the page at all
const oneAddress = "https://google.com";
const linkContainer = document.querySelector(".js-link-container");
// function linkPlacer(linkPath) {
// const links = document.createElement(`a`);
// links.href= linkPath;
// links.textContent = linkPath;
// ... | true |
2381722f921a2b2fa174bce8e50bce2be8db2ae8 | JavaScript | mrbernnz/peach | /w04/d02 Review & Websockets/picky.js | UTF-8 | 381 | 2.828125 | 3 | [] | no_license | // write a client that sends back to the server "hey server" when (and only when) it receives the message "hey client"
var strng = process.argv[2];
var WebSocket = require("ws");
var ws = new WebSocket("ws://localhost:3000");
ws.on("open",function()
{
ws.on("message",function(message)
{
if (message===) {
... | true |
4bb27a6af0e0faa881b9b654b7af036ff5840b86 | JavaScript | seunboy1/data-structures-algorithms | /algorithms/traversal/depth-first-search/depthFirstSearch.js | UTF-8 | 2,009 | 3.90625 | 4 | [
"MIT"
] | permissive | const Stack = require('../../../data-structures/stacks/linked-list-stack/linkedListStack');
/**
* - My JS implementation of DFS for a tree
* - Traverses a binary tree from its root and returns an array of the nodes in traversal order
* - Time complexity: O(n), n = Number of nodes
* - Space complexity: O(n)
... | true |
3ef81ad76324c608d25453d83a6a9cde28908945 | JavaScript | deepakbhattmits/typescript | /dist/generics.js | UTF-8 | 2,814 | 3.703125 | 4 | [] | no_license | "use strict";
// Generic type is a type which is kind of connected with some other types
// and is really flexible regarding which exact type that other type
// const names: Array<string | number> = ['Deepak'];
// console.log(names)
// const promise: Promise<string> = new Promise((resolve, reject) =>
// {
// setTi... | true |
f89b9d7b744428a49d8b93851894a11cb16fcdcf | JavaScript | robotiko/self-balancing-robot-1 | /server-test.js | UTF-8 | 1,260 | 2.71875 | 3 | [] | no_license | const io = require('socket.io')()
io.on('connection', (socket) => {
socket.on('subscribeToTimer', (interval) => {
console.log('client is subscribing to timer with interval', interval)
setInterval(() => {
socket.emit('timer', new Date())
}, interval)
})
socket.on('toggleMotors', () => {
con... | true |
8febf2ff3283911e4a9dba20ecb7cbd60f1563a9 | JavaScript | optomal7/oop-practice | /jsinfo/calcNew.js | UTF-8 | 437 | 4.09375 | 4 | [
"MIT"
] | permissive | function Calculator() {
this.read = function() {
this.value1 = prompt("value the first");
this.value2 = prompt("value the second");
};
this.sum = function() {
return parseInt(this.value1) + parseInt(this.value2);
};
this.mul = function() {
return this.value1 * this.value2;
}
}
let calcul... | true |
da4755896b2a9d9f8b012c1079245b8b0d5f329d | JavaScript | Tlakatlekutl/TP_KtoWin_Project | /static/js/like.js | UTF-8 | 2,869 | 2.578125 | 3 | [
"MIT"
] | permissive | (function() {
"use strict";
$(".js-post-like").click(event => {
event.preventDefault();
console.log(event.target);
console.log(event.target.getAttribute("post-id"));
$.ajax({
method: "POST",
url: "/like/",
data: {
id: event.target.getAttribute("post-id"),
ct: 'post... | true |
3eb5e95dd71bdf1c4c5cbedcce3aa75c38de1685 | JavaScript | Auh3b/Malawi-MP-News-Finder | /js/main.js | UTF-8 | 3,146 | 2.6875 | 3 | [] | no_license | // serpApi key
const apiKey =
"5fcfb3698bfe5c573d6398cc324fb3c0e7c9016110ad75e61d10e408b40d57ad";
// parties
const partiesList = (data) => {
let parties = new Set(data.map((i) => i.Party));
return Array.from(parties);
};
// get representives
const repList = (data) => {
let filtered = data.forEach((i) => {
... | true |
a8110f696d459117b5a1a7b17450f5ce7cd0e9c9 | JavaScript | kpow/kpow.com | /src/components/BookItem.js | UTF-8 | 1,952 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Image, Card } from 'semantic-ui-react';
class BookItem extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentDidMount() {
//let bookImage = null;
// fetch('https://api.microlink.io?url='+this.props.data.book.link)
... | true |
3ed7a85243fd7742b5a37f576490b490d6af4a78 | JavaScript | sahiljoshi515/Dynamic-Programming | /Memoization/gridTraveler.js | UTF-8 | 927 | 4.40625 | 4 | [] | no_license | // Recursive function for solving the Grid Traveler problem
// We need to find the number of ways a traveler can reach the bottom right corner from the top left corner by only being able to move bottom or right.
// gridTraveler(m: number, n: number, memo: {string: number}): number
const gridTraveler = (m, n, memo = {})... | true |
67ee21fc8274c76c163f7937c4008a09870e0c45 | JavaScript | kamildomagalski/PersonalTrainer | /src/js/application/exercises/Exercises.js | UTF-8 | 2,634 | 2.578125 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
import firebase from "firebase";
import AllExercises from "./AllExercises";
import UserExercises from "./UserExercises";
function Exercises({userData}) {
const [exercises, setExercises] = useState([])
const [userExercises, setUserExercises] = useState([])
const ... | true |
a3868490990ae0ffc20942854f40b664a41b9e8e | JavaScript | camgrafiman/blog-strapi-frontend | /components/articles.js | UTF-8 | 1,134 | 2.59375 | 3 | [] | no_license | import Card from "./card";
// Este componente recibe un prop ({ articles })!
// Viene de la página index.
const Articles = ({ articles }) => {
const leftArticlesCount = Math.ceil(articles.length / 5);
console.log("articulos en la izquierda: ", leftArticlesCount);
const leftArticles = articles.slice(0, le... | true |
0995af62b8a17132f00a2ba5d6199163c23e98a5 | JavaScript | inglopez89/EncuestaClimaOrganizacional | /informes/ajax/informe5.js | UTF-8 | 2,561 | 2.984375 | 3 | [] | no_license | // JavaScript Document
addEvent(window,'load',inicializarEventos,false);
function inicializarEventos()
{
var ref=document.getElementById('form1');
addEvent(ref,'submit',enviarDatos,false);
}
function enviarDatos(e)
{
if (window.event)
window.event.returnValue=false;
else
if (e)
e.preventDefault(... | true |
484fc0c4a8da031c59898cc2df52dd7d764853e0 | JavaScript | cilantrol/bloc-jams | /scripts/album.js | UTF-8 | 13,559 | 3.015625 | 3 | [] | no_license | var createSongRow = function(songNumber, songName, songLength){
var template =
'<tr class="album-view-song-item">'
+ ' <td class="song-item-number" data-song-number="' + songNumber + '">' + songNumber + '</td>'
+ ' <td class="song-item-title">' + songName + '</td>'
+ ' <td class="song-item-duratio... | true |
d6b7b89d0ad6260726abc3059c07c0846f088e67 | JavaScript | Tan-Moy/webDev_camp | /Practise/list.js | UTF-8 | 1,014 | 3.84375 | 4 | [] | no_license | var todos = [];
var quit = "";
do {
var input = prompt("What would like to do?");
if (input === "list") {
listTodos();
}
else if (input === "new") {
newTodos();
}
else if (input === "quit") {
exit();
}
else if (input === "delete") {
deleteTod... | true |
ba5ec34af2059ddcbbf307ff6f3890bcff7f44da | JavaScript | ColinJohnson747/NYTIMES- | /script.js | UTF-8 | 859 | 2.796875 | 3 | [] | no_license | $(document).ready(function() {
var queryURL =
"https://api.nytimes.com/svc/search/v2/articlesearch.json?q=" +
"george" +
"&api-key=ibkac4hZC04NsZtR3o3emSwXiYlsbj6e";
var searchTopic = $("#")
function ajaxCall() {
$.ajax({
url: queryURL,
method: "GET"
}).then(f... | true |
bfc03d47b36494ee005409490e8d1cea1c9c2697 | JavaScript | hineshvadgama/freecodecamp | /mutations.js | UTF-8 | 390 | 3.765625 | 4 | [] | no_license | function mutation(arr) {
let arr1 = arr[0].toLowerCase();
let arr2 = arr[1].toLowerCase();
arr1 = arr1.split('');
arr2 = arr2.split('');
let doesIncludeAll = true;
for (let i = 0; i < arr2.length; i++) {
if (!arr1.includes(arr2[i])) {
doesIncludeAll = false;
... | true |
9a1cc0264521c9eeed16af0da2a37af123a54e8e | JavaScript | onny2010/js-simple-problem | /lowest-elements-with-function.js | UTF-8 | 508 | 3.9375 | 4 | [] | no_license | function lowestElement(numbers) {
let lowest = numbers[0];
for (let i = 0; i < numbers.length; i++) {
const element = numbers[i];
if (element < lowest) {
lowest = element;
}
}
return lowest;
}
const ages = [45, 55, 17, 20, 30, 35, 15];
const smallest = lowestElement(... | true |
0e935101822b49919e0161e17bba2e4eb5dd3d0c | JavaScript | ameenalii/codesignal-intro-js | /alphabeticShift.js | UTF-8 | 468 | 3.6875 | 4 | [] | no_license | function alphabeticShift(inputString) {
let alphabet = ['a', 'b' ,'c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
inputString =inputString.split("")
for(var i=0;i<inputString.length;i++){
var index=0;
if(inputString[i] != 'z'){
... | true |
60d91140b2e015a168c34ce96d9ac10ad941523d | JavaScript | brandtiwari007/redux_exp | /src/store/reducer.js | UTF-8 | 319 | 2.671875 | 3 | [] | no_license | const initialState={
counter:21
}
const reducer=(state=initialState,action)=>{
switch(action.type){
case 'INCREMENT':
return {counter:state.counter+1}
case 'DECREMENT':
return {counter:state.counter-1}
default:
return state;
}
}
export default reducer; | true |
f6067f7ce91b67861228f58b9e9b94bb93dde339 | JavaScript | Bcdirito/moodsic | /src/components/playlist/Playlist.js | UTF-8 | 3,000 | 2.546875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { PlaylistStyle } from './PlaylistStyle.js';
import playlistData from '../../db/playlistData.js';
const Playlist = ({ loggedIn, choices, retakeQuiz }) => {
const [playlistID, setPlaylistID] = useState(null);
const [playlistKey, setPlaylistKey] = useState(n... | true |
65df96c6cacaf9673891eee187e5fb16a661c408 | JavaScript | asalria/lab-javascript-advanced-algorithms | /starter-code/src/StackDataStructure.js | UTF-8 | 830 | 3.8125 | 4 | [] | no_license | function StackDataStructure () {
this.stackControl = [];
this.MAX_SIZE = 20;
}
StackDataStructure.prototype.isEmpty = function(){
return (this.stackControl.length > 0) ? false : true;
}
StackDataStructure.prototype.canPush = function(){
if(this.stackControl.length < this.MAX_SIZE)
{
... | true |
5183e94fbe036611c7981f0fb161c9aa8627f47a | JavaScript | tarkesh2shar/herokuappboilerplate | /server/server.js | UTF-8 | 790 | 2.5625 | 3 | [] | no_license | const express=require('express');
//getting environment variables to be used
require('dotenv').config();
// Main code starts here!!
const app=express();
//using React build folder as a public access point
app.use(express.static('client/build'));
//basic api request//
app.get('/xyz',(req,res)=>{
res.send(... | true |
7ce79603983e9bb37c1b6f7bc3eebdc30a7235b7 | JavaScript | Qhappyman/data-structures-and-algorithms | /滑动窗口/滑动窗口的最大值-剑指offer59-.js | UTF-8 | 1,683 | 3.5625 | 4 | [] | no_license | 滑动窗口加双向队列
class Solution {
public int[] maxSlidingWindow(int[] nums, int k) {
if(nums.length == 0||k==0){
return new int[0]; //如果队列长度为0则返回0
}
Deque<Integer> deque = new LinkedList<>(); //声明一个双向队列
int[] res=new int[nums.length-k+1]; //存放结果的数组
... | true |
6fdf941743a953462865c7c957284045c8c53ba0 | JavaScript | mpaolodr/reducer-todo | /reducer-project/src/reducers/reducer.js | UTF-8 | 1,075 | 2.90625 | 3 | [] | no_license | //DATA
import { data } from "../data";
export const initialState = {
todos: data
};
export const DataReducer = (state, action) => {
switch (action.type) {
case "ADD_TODO":
if (action.payload.item !== "") {
const names = state.todos.map(todo => todo.item.toLowerCase());
if (names.indexOf(... | true |
e26b285968b6d068fe516f7abc7a4bbe191e9bc6 | JavaScript | sljohnsondev/performance_playground | /test_methods.js | UTF-8 | 1,028 | 2.609375 | 3 | [
"MIT"
] | permissive | const path = require('path');
module.exports = {
create_test_array,
existing,
pathName,
replaceExt,
sliceExt,
regExExt,
substrExt
};
function existing(all_files) {
const final_values = [];
all_files.forEach(value => {
final_values.push(value.substr(0,value.length-4));
})... | true |
6af85eee85e86568c2e8663840c87bda0958b5fe | JavaScript | jchancoding/imgurScrape | /app.js | UTF-8 | 651 | 2.984375 | 3 | [] | no_license | const scraper = require('./scraper');
const url = "https://imgur.com/gallery/1667M";
const fs = require('fs')
const path = 'text.txt';
//callback example
scraper.imgScrape(url, (data)=>{
console.log('1data from scraper recieved');
console.log('randomjunk'+ data);
});
//Promise example
scraper.imgScrape2(url)
.t... | true |
a1587209c9d371cd27aa5606f5ca240d5d158c74 | JavaScript | stropitek/core | /src/image/utility/__tests__/setChannel.js | UTF-8 | 908 | 2.765625 | 3 | [
"MIT"
] | permissive | import {Image} from 'test/common';
describe('get a specific channel from an image', function () {
it('should check channels from a RGBA image', function () {
let image = new Image(1, 2);
let red = new Image(1, 2, [230, 100], {
kind: 'GREY'
});
image.setChannel(0, red);... | true |
223fd3fb60fde2e11fe3feab9952d7e690544ce0 | JavaScript | 14081214/engine-test-game | /engine/engine.js | UTF-8 | 32,245 | 2.796875 | 3 | [
"MIT"
] | permissive | "use strict";
var engine;
(function (engine) {
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
}
engine.Point = Point;
class Rectangle {
constructor() {
this.x = 0;
this.y = 0;
this.width = 1;
thi... | true |
ca131fcc08941193e57f9f28f9ce32d8436c65b0 | JavaScript | ctueck/UniDB | /js/UniDB-Dialog.js | UTF-8 | 7,456 | 2.546875 | 3 | [] | no_license | /*************************************************************************************************************/
/***** Class: Dialog - dialog window with one mainRecord and (optionally) related Records that ***************/
/***** are displayed in-line *... | true |
3dd66c2a95a0e71781d46d88d5f945a566248985 | JavaScript | nexgencodecamp/craftyjs-examples | /motion-path/main.js | UTF-8 | 2,072 | 3.125 | 3 | [] | no_license | /* Initialise variables */
var _screenWidth = 800;
var _screenHeight = 600;
var points = [];
var loopDone = false;
/* Initialise Game Engine */
Crafty.init(_screenWidth, _screenHeight, document.getElementById('gamecanvas'));
var shipSpriteImages = {"sprites": {"img/galaga-ship.png": {tile: 47, tileh: 50, map: {ship_s... | true |
9fd046f5175e6186f9bb2c8532f8a654b3655696 | JavaScript | brianngichu/Traingle-Tracker | /scripts.js | UTF-8 | 1,048 | 3.6875 | 4 | [] | no_license | function triangle() {
var side1 = parseInt(document.getElementById("side1").value);
var side2 = parseInt(document.getElementById("side2").value);
var base = parseInt(document.getElementById("base").value);
var sides = [side1, side2, base];
var answer;
if (side1 <= 0 || side2 <=0 || base <=0){
... | true |
831653004c8c9289685784180ba7607244a78c32 | JavaScript | AArtemida/TicTacToe | /src/App.js | UTF-8 | 5,262 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Board from './Board';
import Mytooltip from './tooltip';
//判断胜利
function calculateWinner(squares) {
const lines = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4,... | true |
3171a6e2e8225f2fd981816cf24328c580590b78 | JavaScript | Shalomraz/camera-app | /main.js | UTF-8 | 1,190 | 2.78125 | 3 | [
"MIT"
] | permissive | (function ($window, $document) {
var utils = {
q: function (selector) {
return $document.querySelector(selector);
},
prepend: function (parent, child) {
parent.insertBefore(child, parent.firstChild)
},
create: function (element) {
return $document.createElement(element);
}
};
$window.utils = ... | true |
ba9a618a2f3c745d0a4ab63e6a08a6743ee9223a | JavaScript | seasonphp/PDR | /public/js/jAjax.js | UTF-8 | 2,628 | 3.28125 | 3 | [] | no_license |
/**
* @author Pedro Ribeiro - pcelta
* Data: 23/05/2011
*
*
* "Classe" responsável por efetuar requisições ajax
*
* Métodos disponíveis
*
* slack(form)
* - recebe o formulario como paramêtro
* - o formulario deve estar com o atributo action declarado
*
*
sigle(url)
- recebe a url alvo
... | true |
67dd68fc8357788dce07c3f79c2e1d779be225e3 | JavaScript | CodingChallengesAlt/CodingChallenges-Alt | /CC_01_StarField/Star.js | UTF-8 | 1,121 | 3.078125 | 3 | [] | no_license | // Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/17WoOqgXsRM
// instance mode by Naoto Hieda
function Star(sketch) {
this.x = sketch.random(-sketch.width, sketch.width);
this.y = sketch.random(-sketch.height, sketch.height);
this.z = sketch.random(sketch.... | true |
a8e625544310db669f6d34082fe39588b0f3ac68 | JavaScript | Type-of-Read/url2slack | /src/popup.js | UTF-8 | 1,734 | 3.078125 | 3 | [] | no_license | var request = require('superagent');
var OptionsStorage = require('./OptionsStorage.js');
var optionsStorage = new OptionsStorage();
var sendUrlToSlack = (callback) => {
var queryInfo = {
active: true,
currentWindow: true
};
// Most methods of the Chrome extension APIs are asynchronous. This means that... | true |
47504d1d598792753566a494741e2102a4af71fa | JavaScript | liiza/talkoohakemisto-www | /app/templates/helpers/select.js | UTF-8 | 2,101 | 2.875 | 3 | [
"MIT"
] | permissive | define(['jquery', 'underscore', 'Handlebars'], function ( $, _, Handlebars ) {
var selectTmpl = _.template('<select <%= attributes %>><%= options %></select>');
var optionTmpl = _.template('<option value="<%= id %>"<%= selected %>><%= name %></option>');
/**
* Create select list with a possible selection
... | true |
283821f182a6c1813f6a7570a678631ee1d5c72a | JavaScript | jcarlostoledos/underlist | /app.js | UTF-8 | 17,318 | 2.96875 | 3 | [] | no_license | //Developed by Juan Carlos Toledo
//Underlist v0.1
// Resources index:
// 1. POST - User (register) /register
// 2. POST - User (login) /login
// 3. GET - Lista /lista
// 4. POST - Lista /lista
// 5. PUT - Lista /lista/:id
// 6. DELETE - Lista ... | true |
901715ee6b4044302233b85c7b16c8714cb4a451 | JavaScript | BarryPro/JavaEE_Eclipse | /Si-Tech/npage/s7983/pagedtable.js | UTF-8 | 10,249 | 2.71875 | 3 | [] | no_license | /**
* Copyright (c) 2009 Lee, Heungsub <lee@heungsub.net>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* co... | true |
fc4cd7396bbfb096aa3da06b810436a6ac695130 | JavaScript | michalstocki/patternfly-react | /packages/patternfly-3/patternfly-react/src/components/DateTimePicker/TimeComponents/PickTimeClock.js | UTF-8 | 3,478 | 2.59375 | 3 | [
"MIT"
] | permissive | import React from 'react';
import PropTypes from 'prop-types';
import { noop } from '../../../common/helpers';
import { AM, PM, HOUR, MINUTE } from './TimeConstants';
class PickTimeClock extends React.Component {
state = {
ampm: this.props.time.getHours() >= 12 ? PM : AM
};
static getDerivedStateFromProps(ne... | true |
60af1a9f0b275ce96c1d04edcc25a0fe03a870c1 | JavaScript | Vlrohm/webassembly | /app.js | UTF-8 | 2,489 | 2.578125 | 3 | [] | no_license | // const handler = require('serve-handler');
// const http = require('http');
// const server = http.createServer((request, response) => {
// // You pass two more arguments for config and middleware
// // More details here: https://github.com/zeit/serve-handler#options
// return handler(request, response);
// }... | true |
1d5a83505d6c5fce65686ebe908d898e06e3d4b6 | JavaScript | astgit/deployment | /output/theme/js/modules/generic/helper.js | UTF-8 | 831 | 2.6875 | 3 | [] | no_license | define(function (require) {
/**
* A module for creating helper mixin functions with lodash.
*
* @module helper
* @author Sean McEmerson
* @version 0.1.0
* @requires lib/lodash/utility/mixin
* @requires lib/lodash/object/has
*
* @example <caption>Include the module</capti... | true |
91850a3c058c122f70ab0760374e49b9880bbf2f | JavaScript | anniegiang/dsa | /interview-cake/findDuplicateSpace.js | UTF-8 | 1,733 | 4.09375 | 4 | [] | no_license | // https://www.interviewcake.com/question/javascript/find-duplicate-optimize-for-space
// O(1) space and O(nlgn) time (pigeonhole property, n distinct items with n + 1 items)
function findRepeat(numbers) {
// Find a number that appears more than once
let left = 1;
let right = numbers.length - 1;
while (left... | true |
123ba53810b616ee5865a72f9c0e71344366f080 | JavaScript | alanvargasweb/estudos | /javascript/udemy-curso/secao-17-desafio/script.js | UTF-8 | 1,135 | 2.71875 | 3 | [] | no_license | (function () {
'use strict'
var $carrossel = document.querySelector('#carrossel');
var $carrosselInner = document.querySelector('#carrossel-inner');
var $carrosselItens = $carrosselInner.querySelectorAll('img');
var $bullets = document.querySelector("#bullet");
var bannerAtual = 0;
var qtdB... | true |
8b780ee0edfef7f8f711eeb7252093805049d4b8 | JavaScript | dj/react_game_of_life | /src/game.js | UTF-8 | 6,758 | 3.390625 | 3 | [
"WTFPL"
] | permissive | /** @jsx React.DOM */
function Point(x, y) {
this.x = x;
this.y = y;
this.neighbors = function() {
// Just return all possible neighbours for now
// TODO: handle edge cases (literally)
// This will return the wrong point if you give
// supply a negative x or y
retur... | true |
128d7681bff5629712ed703ea5652207ae6395e3 | JavaScript | webformula/pax-components | /src-docs/themeGenerator.js | UTF-8 | 4,506 | 2.765625 | 3 | [
"MIT"
] | permissive | export default new class ThemeGenerator {
constructor() {
this.textRegex = /--mdw-theme-text-(\w*)?(-on-\w*)--(\w*)$/;
this.onRegex = /(--mdw-theme-on-)(\w*)--(\w*)$/;
this.themeRegex = /(--mdw-theme-)(\w*)--(\w*)$/;
this.hexRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
this.rgbRegex = /rgb... | true |
7e0bca52407bd7c33e79eb4a90a978d4745ab46a | JavaScript | steria773-archive/Cake | /examples/button_01.js | UTF-8 | 540 | 2.75 | 3 | [
"MIT"
] | permissive | alert("Check Web Developer Console For More!!!");
CreateCanvas(400,400,"3px black solid");
Initialize();
SetDrawingMode("fill");
var playButton = new Button(150, 200, 200, 50, 'Play', {
//Colors!!!
'default': { top: '#1879BD', bottom: '#084D79' },
'hover': { top: '#678834', bottom: '#093905' },
... | true |
e81e17463d0707c87f0ab688db336352a17daa05 | JavaScript | PalexM/slider-range | /__tests__/state-functions.test.js | UTF-8 | 685 | 2.5625 | 3 | [] | no_license | import { render } from "react-testing-library";
import "dom-testing-library/extended-expect";
expect.extend({
toBeWithinRange(received, min, max) {
const pass = received >= min && received <= max;
if (pass) {
return {
message: () =>
`expected ${received} not to be within range ${min} ... | true |
a4ed725f40068c319f1ccb9ba1d938df1ac88b7d | JavaScript | Rafifihsan/praxis-academy | /01-05/coba2/sum.js | UTF-8 | 799 | 3.609375 | 4 | [] | no_license | function sum(start,end){
let array = [];
for(let i = start; i <= end; i++){
array.push(i) ;
}
return array.reduce((sum,value) =>sum += value);
}
console.log(sum(1,10));
let obj = { a: 21, b: "c"
}
console.log(Object.values(obj));
console.log(Object.keys(obj));
console.log(O... | true |
e5b3d46eb241854dca836ac9e55241c146883326 | JavaScript | Goosetaculous/work4u | /routes/jobRoutes.js | UTF-8 | 4,687 | 2.578125 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
var path = require("path");
var Job = require("../controllers/JobModelController.js");
var User = require("../controllers/UserModelController.js");
// collect all job data
router.get("/all", (req, res)=> {
console.log("api route job/all called.");
J... | true |
d16b7f22f98ae403a8e60d15152b0183f412fb6f | JavaScript | StolpnerA/js--base-course | /02/ht/AndreiKuzmich/script.js | UTF-8 | 8,806 | 4.1875 | 4 | [] | no_license | /* eslint no-var: "off" */
/* eslint no-unused-vars: "off" */
/* eslint max-len: "off" */
/**
* Написать функцию `isDeepEqual`
* которая принимает на вход двe переменных
* и проверяет идентичны ли они по содержимому. Например
* @param {*} objA
* @param {*} objB
* @return {boolean} идентичны ли параметры по сод... | true |
0bd8115649fb16fac0c389c96bc83d9f0cde93a6 | JavaScript | DiingDong/REMS | /javascript/users.js | UTF-8 | 645 | 3.09375 | 3 | [] | no_license | var order="";
loadUsers();
//Realiza una funcion cuando se presiona el boton respectivo
document.getElementById("se_submit").addEventListener("click", setSearch);
function loadUsers(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if (t... | true |
5f42d75b92815159029b9554da6a894ca5b5e41d | JavaScript | lulzzz/BetterValidations | /BetterValidations/Assets/Scripts/Angular/register.js | UTF-8 | 2,081 | 2.625 | 3 | [] | no_license | const app = angular.module('angularExampleApp', []);
class AngularInputFormDirective {
constructor() {
this.templateUrl = 'angular-input-form-template.html';
this.restrict = 'A';
this.scope = {
value: '=angularInputForm',
label: '@label',
error: '=error',
inputType: '@inputType'
};
}
}
// We cre... | true |
228bb2869bb1189885eb5629d73ac63311e6b067 | JavaScript | joshthompson/adventofcode | /2021/05/index.js | UTF-8 | 1,443 | 3.5 | 4 | [] | no_license | const fs = require('fs')
fs.readFile(`${__dirname}/input.txt`, (_e, data) => {
const start = +new Date()
const lines = data.toString().split('\n').map(line => new Line(line))
console.log('Part 1', part1(lines))
console.log('Part 2', part2(lines))
console.log('Time:', new Date() - start, 'ms')
})
class Line {
... | true |
b6fb098801fb6289b3691a5d296f4a0460339af7 | JavaScript | yaqootturman/toDo-redux-react-native | /reducer.js | UTF-8 | 702 | 2.625 | 3 | [] | no_license |
const initialState = {
task: '',
tasks: [],
complete: false
}
const reducer = (state = initialState, action) => {
switch (action.type) {
case 'ON_CHANGE_TASK':
return {
...state,
task: action.task,
};
case 'ADD_TASK':
return {
...state,
tasks: state.... | true |
0a0f727c26e36afd6b8ec45715cf6747a5695aad | JavaScript | ghidra/game | /game/src/game/pawn_factory.js | UTF-8 | 6,133 | 2.75 | 3 | [] | no_license | game.pawn_factory=function(d,world,layer){
game.actor.call();
this.init(d,world,layer);
return this;
}
game.pawn_factory.prototype=new game.actor();
game.pawn_factory.prototype.constructor=game.actor;
game.pawn_factory.prototype.init=function(d,world,layer){
game.actor.prototype.init.call(this);
thi... | true |
a548a96a422f8ef26728b67f478f39267fb6c38b | JavaScript | mattoh1/support-frontend | /support-frontend/assets/helpers/types/__tests__/optionTest.js | UTF-8 | 551 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | // @flow
// ----- Imports ----- //
import { headOption } from '../option';
// ----- Tests ----- //
describe('option', () => {
describe('headOption', () => {
it('retrieves the first item from an array', () => {
expect(headOption([1, 2, 3])).toBe(1);
expect(headOption([null, 2, 3])).toBeNull();
... | true |
636238048f10c0d9543063113b26e7cabf8cb2e1 | JavaScript | Connectify/connectivity_diagnostics | /src/js/ui/spinnercomponent.js | UTF-8 | 2,378 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview UI component for tests running spinner.
* @author ebeach@google.com (Eric Beach)
*/
goog.provide('ccd.ui.SpinnerComponent');
/... | true |
4f9c2c0e6b0f4dffa53a697dd718c8c4a4f22091 | JavaScript | prasannaspider/backgroundgen | /script.js | UTF-8 | 801 | 3.140625 | 3 | [] | no_license | var lodash = require('lodash');
var aray = [1,2,3,4,5,6,7,8];
console.log('answer:', lodash.without(aray, 4));
var h3 = document.querySelector("h3");
var color1 = document.querySelector(".color1");
var color2 = document.querySelector(".color2");
var dombody = document.querySelector("body");
function setBodyBackgrou... | true |
659f469b2100de476737c391935a392017fa88c3 | JavaScript | xwsxethan/MusicScoring | /WebCode/js/MusicScoring.js | UTF-8 | 30,108 | 2.59375 | 3 | [
"MIT"
] | permissive | var validationResults
var complexityOutput;
var colorCounter = 1;
var clickedRow;
var superTable;
var pieparts;
var histoExists = false;
var pieExists = false;
var legendExists = false;
var dagExists = false;
var tempVariableHolder;
var samplePieces;
var guesses;
var oldGuessIndex = -1;
$(document).on('ready', functio... | true |
d2902de5eeb36c5b5e436699f9713ca52068f9b7 | JavaScript | linzhiyuan00/learncodejs | /letcode/coco/index.js | UTF-8 | 1,470 | 4.28125 | 4 | [] | no_license | // 位移运算符 右移
// 针对二进制位 0000 1011
// 利用位移运算,/2 *2 的效果
// console.log(11>>1); //右移 0000 0101
// console.log(11<<1); // 左移 0001 0110
// 猛哥给蜗牛买香蕉
// N pils of banans 每挂香蕉上的香蕉数量不一样 一共多少
// 数组 [] [3,6,7,11] H小时内吃完 一小时吃几根香蕉 一小时内吃mid根香蕉, 一次只能吃一把
// 最少吃几根 , 可以在H小时内吃完
/**
* @desc 最少吃香蕉的速度,在规定时间内吃完
* @param {number... | true |
b480bd8c524b24b379a27f019136b7976e74600e | JavaScript | hemantsingh117/mycode | /html/js_1.js | UTF-8 | 1,934 | 3.75 | 4 | [] | no_license | // this code print the following statment
// document.write("hemant singh from india ");
// this home page statment print when you enter on the page
// alert("HOME PAGE");
// java script variables
// var b = 20;
// var a = 10;
// this use for plus funcation
// var c = a+b;
// document.write((a+b));
// console.... | true |
ab2e521625cec3f3f818b4ea5c1c8264810d09a2 | JavaScript | wvwall/js-jsnacks-blocco-1 | /jsnack5/main.js | UTF-8 | 417 | 4 | 4 | [] | no_license | // Creare array vuoto
var numeri = [];
//Chiedi per 6 volte di inserire un numero //Controllare se è dispari e aggiungilo nell'array
for (var i = 0; i < 6; i++) {
var numero = parseInt(prompt("Inserisci un numero: "));
if(!isNaN(numero) && numero%2){
numeri.push(numero);
} else {
console.l... | true |
8807f5fd72840f1a6264b2c1bd4efdfe1795d1e1 | JavaScript | ha3158987/Daily-Algorithm | /프로그래머스/prg_12925.js | UTF-8 | 670 | 4.03125 | 4 | [] | no_license | //프로그래머스 level.1 #12925: 문자열을 정수로 바꾸기
//https://programmers.co.kr/learn/courses/30/lessons/12925
//제출 답안:
function solution(s) {
let answer = '';
const temp = s.split("");
temp.map(el => {
if (typeof el === "string") answer += el;
});
answer = answer * 1;
return answer;
}
//시행착오가 많지는 않... | true |
21071107c757cbee897666b94588e5c5d1bf3f1f | JavaScript | malipramod/data-structure-algorithm | /HackerRank/01 Warmup/Javascript/03 Compare the Triplets/CompareTriplets.js | UTF-8 | 489 | 3.984375 | 4 | [
"MIT"
] | permissive | 'use strict';
// Complete the compareTriplets function below.
function compareTriplets(a, b) {
var solution = []
solution[0] = 0;
solution[1] = 0;
for (let i = 0; i < a.length; i++) {
if (a[i] > b[i])
solution[0]++;
else if (a[i] < b[i])
solution[1]++;
}
... | true |
e883229e28fbd142b40df91dcafac16283f6823c | JavaScript | sveta-slepner/3d-ar-viewer | /src/components/Controls.js | UTF-8 | 815 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import {OrbitControls} from "three/examples/jsm/controls/OrbitControls";
import {Box3, Vector3} from "three";
export class Controls {
constructor(camera, domElement) {
this.camera = camera;
this.domElement = domElement;
this.controls = new OrbitControls(
camera,
domE... | true |
1e2cb677666afa5762b007fa5aae57d6a59e51b3 | JavaScript | ampatspell/kaste | /app/utils/index.js | UTF-8 | 942 | 2.71875 | 3 | [] | no_license | import dayjs from 'dayjs';
const contentTypes = {
'image/png': 'PNG image',
'image/jpg': "JPEG image",
'image/jpeg': 'JPEG image',
'application/pdf': 'PDF file',
'application/zip': 'ZIP file'
};
let fallbackContentType = 'File';
export const formatContentType = contentType => {
return contentTypes[conten... | true |
9bed942e32d363ab1b14568c1afa3bb8ec1c7924 | JavaScript | lichengzhou/nodBlog | /models/loadUser.js | UTF-8 | 2,197 | 2.515625 | 3 | [] | no_license | /**
* Created by ahtasham on 29/01/15.
*/
var db = require('./connect');
//load userdetails middleware
function LoadUser (obj) {
this.obj = obj;
this.loadUserData = function(callback) {
var retObj = {
userProfile: '',
cats: ''
};
var userProfile = {
... | true |
5821bbef238b032e20860c40819b4a81be9f0269 | JavaScript | jessebriata/jessebriata | /js/anim5.js | UTF-8 | 225 | 3.09375 | 3 | [] | no_license | let x;
function setup(){
createCanvas (500,500);
background(color(200,300,200,x));
noFill();
x = 10;
}
function draw(){
background(color(200,300,200,x));
ellipse(mouseX,mouseY,x,x/5);
x +=10;
if (x>250){x=0}
}
| true |
d3197abf91c021f486e85c189d2c54bf6b0c0d02 | JavaScript | mattvox/brickworks | /src/components/types/custom/tests/cssWithUnit.test.js | UTF-8 | 2,008 | 2.765625 | 3 | [
"MIT"
] | permissive | import cssWithUnit, { isValid } from '../cssWithUnit';
describe('Custom prop type - cssWithUnit', () => {
describe('isValid function', () => {
it('should accept a number and return true', () => {
expect(isValid(10)).toBe(true);
});
it('should accept undefined and return true', () => {
expect... | true |
9567d165cae6c475f6d1d8060eaafc41c78ebb6e | JavaScript | elinakudiiarova/JSlessons | /HOMEWORK/task 5(2).js | UTF-8 | 169 | 3.390625 | 3 | [] | no_license | function min(number1, number2) {
if (number1 > number2) {
return number1;
} else {
return number2;
}
}
console.log(min(0, 10));
console.log(min(0, -10));
| true |
ea4b944ece682229a4cbed09b3a24a1ddcec5fda | JavaScript | SoozaV/UniWebSidad-JS | /Ejercicio 13 - DOM/codigo.js | UTF-8 | 526 | 4.28125 | 4 | [] | no_license | var divi = document.getElementById("palindromo");
var texto = prompt("Introduce un texto");
function palindromo(texto){
var inverso = texto.split(" ");
inverso = inverso.join("");
inverso = inverso.split("");
inverso.reverse();
inverso = inverso.join("");
var texto2 = texto.split(" ");
texto2 = texto2... | true |
fcb9ff81a174dba7dd6af497d1a0d80560b25902 | JavaScript | sergioalberto/NightwatchJS-Framework | /test/libs/shell.js | UTF-8 | 1,081 | 2.875 | 3 | [
"MIT"
] | permissive |
/**
* @description Class to execute commands line
* @author Sergio Gonzalez Q <sergioalbertogq@gmail.com>
* @source https://nodejs.org/api/child_process.html
* @place Cartago, Costa Rica
* @date Jun 2018
*/
const {
exec, execSync, spawn, spawnSync,
} = require('child_process');
const shell = require('shelljs... | true |
349eecfbabeb6799ac9085fd4379c25acfb34617 | JavaScript | rebeccawinterfield/Build-an-Interactive-Form | /interactive-form-v1/js/script.js | UTF-8 | 8,977 | 2.984375 | 3 | [] | no_license | //counter variables to prevent repeated messages
let a = 0;
let b = 0;
let c = 0;
let d = 0;
let e = 0;
let f = 0;
let g = 0;
let h = 0;
let j = 0;
const name = $('#name');
const email = $('#mail');
const card = $('#cc-num');
//function to check if email is in a valid format
function validateEmail(emailValue) {
... | true |
9c4c4f4339a07a8550e25e2d7fb5ff67190aaf94 | JavaScript | mimiyin/collective-play-s20 | /03_pairing/00_ouija_mobile/public/output/sketch.js | UTF-8 | 1,739 | 3.46875 | 3 | [] | no_license | // Open and connect input socket
let socket = io('/output');
// Listen for confirmation of connection
socket.on('connect', function () {
console.log("Connected");
});
// Keep track of partners
let users = {};
// Keep track of average position
let pAvgPos;
function setup() {
createCanvas(windowWidth, windowHeight... | true |
87180e75ea54514b8c7e4e4f1cd7617e20a8796c | JavaScript | uchia-itachi/TechNews | /project/UDEMY JAVSCRIPT PROJECT/app.js | UTF-8 | 2,536 | 2.953125 | 3 | [] | no_license | var score=[0,0];
var currentscore=0;
var activeplayer=0;
var gameon=true;
//document.querySelector('#current-'+activeplayer).innerHTML=dice;
//var x=document.querySelector('#current-'+activeplayer).innerHTML;
document.querySelector(".dice").style.display="none";
document.querySelector('.btn-roll').addEventListener('cli... | true |
aa0ff6b0f5c77bb230f191f14003e6d5226502fc | JavaScript | hitomi-inoue/javascript-and-dom | /DOM-exercise/js/dom.js | UTF-8 | 937 | 4.03125 | 4 | [] | no_license | //Task 1
//Access HTML element with id tag-line.
let tag = document.getElementById("tag-line");
//Access all h2 headings that belong to div with the class name bg-main-content.
let headings = document.querySelectorAll(".bg-main-content h2");
//Create the variable collect and assign it with content of tag-line.
le... | true |
0a8acef0c735ee5540bf9496c6921d756ae1c859 | JavaScript | santhanakrishnanstark/javascript-class | /7. DOM/index.js | UTF-8 | 3,164 | 4 | 4 | [] | no_license | /**
* Document Object Modal
*
* Html document is structured as a Javascript Object. These HTML element has different properties.
*
* We can able to get, create, append or remove the HTML element using Javascipt.
*
* Selecting a HTML element is similar to selecting using CSS.
*
*/
// Getting Element
// 1... | true |
cad8c7e90efd5288e4523ee9e4a94ce1f106e440 | JavaScript | ArpadGBondor/50_Projects_In_50_Days-42_Live_User_Filter | /scrtipt.js | UTF-8 | 1,337 | 3.40625 | 3 | [] | no_license | const results = document.getElementById('result');
const filter = document.getElementById('filter');
const listItems = [];
filter.addEventListener('input', (e) => filterResults(e.target.value.toLocaleLowerCase()));
fetchUsers();
async function fetchUsers() {
const url = 'https://randomuser.me/api/?results... | true |
1d29e004f9a28e14c4bbd414ec90ed40df34aba0 | JavaScript | Matoseb/satisfying-keyboard | /js/utils.js | UTF-8 | 1,221 | 2.625 | 3 | [] | no_license | const UTILS = {
roundRect(c, x, y, w, h, r) {
if (w < 2 * r) r = w / 2;
if (h < 2 * r) r = h / 2;
c.moveTo(x + r, y);
c.arcTo(x + w, y, x + w, y + h, r);
c.arcTo(x + w, y + h, x, y + h, r);
c.arcTo(x, y + h, x, y, r);
c.arcTo(x, y, x + w, y, r);
return c;
},
halfPI: Math.PI * 0.5,... | true |
1a3cdce6959a9d1e6cbec7fe0226e9b31b8cbf86 | JavaScript | danieldanielecki/MERN-App | /routes/api/users.js | UTF-8 | 3,061 | 2.78125 | 3 | [] | no_license | // Whenever Mongoose's methods are being used we need to use await, because it returns a Promise.
const bcrypt = require("bcryptjs");
const config = require("config");
const express = require("express");
const gravatar = require("gravatar");
const jwt = require("jsonwebtoken");
const router = express.Router();
const { ... | true |
edbb9498c806c0449107f887def02ac35814a34d | JavaScript | galiarballo/Meeting-3 | /calculadora/app.js | UTF-8 | 1,173 | 4.03125 | 4 | [] | no_license | function Sumar () {
var n1 = document.getElementById("num1").value;
var n2 = document.getElementById("num2").value;
var suma = parseInt(n1) + parseInt(n2);
alert("La suma es: " +suma)
}
function Restar () {
var n1 = document.getElementById("num1").value;
var n2 = document.getElementById("... | true |
e8ec45a85cab58eeb3e75a648e77f63dd2b0b514 | JavaScript | miguelpduarte/cm-3d | /common.js | UTF-8 | 785 | 2.78125 | 3 | [] | no_license | // Perform setup for 3d drawing, to ensure consistency between different types
export const setup_3d = (sk) => {
sk.textFont('sans-serif');
sk.createCanvas(600, 600, sk.WEBGL);
sk.normalMaterial();
};
export const preload_3d = (sk) => {
const roboto_font = sk.loadFont('assets/Roboto-Regular.ttf');
... | true |
0a3acfcee30facee170a633762a827200e7eee59 | JavaScript | itselectroz/neat | /neat/Network.js | UTF-8 | 8,621 | 3.078125 | 3 | [] | no_license | function* entries(obj) {
for (let key of Object.keys(obj)) {
yield [key, obj[key]];
}
}
class Network extends Genome {
constructor(fitness, generation) {
super();
this.fitness = fitness || 0;
this.generation = generation || 0;
this.neurons = {};
}
isDead(neu... | true |
08f91e81a1389d16d909319c9d45c728b52dc0dc | JavaScript | NicolasD27/univers | /app/javascript/react_app/reducers/projects_reducer.js | UTF-8 | 486 | 2.53125 | 3 | [] | no_license | import { FETCH_PROJECTS, PROJECT_POSTED, PROJECT_DELETED } from '../actions';
export default function(state = [], action) {
switch (action.type) {
case FETCH_PROJECTS:
return action.payload;
case PROJECT_POSTED:
const copiedState = state.slice(0);
copiedState.push(action.payload);
... | true |
0de3839d9e15b909d1b3e7a6207361c0c706042c | JavaScript | AdAscoltare/leetcode-everyday-by-js | /dynamic programming/M0213. House Robber II.js | UTF-8 | 732 | 2.90625 | 3 | [] | no_license | /*
* @Descripttion:
* @version:
* @Author: Wang Wenzheng
* @Date: 2020-11-26 13:55:30
* @LastEditors: Wang Wenzheng
* @LastEditTime: 2020-11-26 14:07:16
*/
/**
* @param {number[]} nums
* @return {number}
*/
var rob = function (nums) {
const l = nums.length;
if (l == 1) {
return nums[0];
}
let dp =... | true |
045b38b6ec2d74e1dc197f1e0112bff6d56dabae | JavaScript | BLZbanme/leetcode | /面试题/051-060/053II/demo-1.js | UTF-8 | 522 | 3.53125 | 4 | [] | no_license | function missingNumber(nums) {
var lo = 0;
var hi = nums.length - 1;
while (lo <= hi) {
debugger
var mid = lo + ((hi - lo) >> 1);
if (nums[mid] <= mid) {
lo = mid + 1;
}
else {
hi = mid - 1;
}
}
return lo;
}
;
console.log(missin... | true |
ff1879092dbffe43cf05ae776acb67c5afff1824 | JavaScript | sahat/pascal.js | /lib/modules/uncomment.js | UTF-8 | 527 | 2.765625 | 3 | [] | no_license | var Token = require('./token');
function Uncomment(scanner) {
this.scanner = scanner;
this.next = function () {
while (true) {
var token = this.scanner.next();
if (token.tokenType != Token.TK_COMMENT) {
return token;
}
}
};
this.lookAhead = function () {
while (true) {
... | true |
762853277857f410a2995691c1361b444c27c1c7 | JavaScript | lucasfranchini/foodcamp-react | /src/components/Footer/Footer.js | UTF-8 | 590 | 2.625 | 3 | [] | no_license | import {Link} from "react-router-dom";
import "./Footer.css";
export default function Footer(props){
const {principal,drink,desert} = props.selectedTypes;
let texto;
const confirmation = (principal===true && drink===true && desert===true);
if(confirmation){
texto = (<Link to="/revisar">Finaliz... | true |
0dcb47067ced5539b71b557d8cc34af37be00f4f | JavaScript | colevandersWands/banksies | /part1/inheritance/lesson2-1.js | UTF-8 | 736 | 3.703125 | 4 | [] | no_license | // -------------------------------------------------------
// lesson 2-1, context in context
// -------------------------------------------------------
console.log('lesson 2-1:');
//-- here is a great article on context:
//-- http://javascriptissexy.com/understand-javascripts-this-with-clarity-and-master-it/... | true |
b130946cc0d1e04318004afad0138722ad1b4451 | JavaScript | timchoi-debug/quiz-maker | /questions_form.js | UTF-8 | 1,331 | 3.015625 | 3 | [] | no_license | document.write(<script type="text/javascript" src="questions.js"></script>);
document.write(<script type="text/javascript" src="questions_database.js"></script>);
var mysql = require('mysql');
const { title } = require('process');
const Connection = require('mysql/lib/Connection');
var db;
var score;
function open()... | true |
089d14ab28fe23531b895075117a3ee1a661d85d | JavaScript | 360-tcastilho/CodeQLExample | /codeql-runner/codeql_databases/csharp/working/tracer-env.js | UTF-8 | 453 | 2.5625 | 3 | [] | no_license |
const fs = require('fs');
const env = {};
for (let entry of Object.entries(process.env)) {
const key = entry[0];
const value = entry[1];
if (typeof value !== 'undefined' && key !== '_' && !key.startsWith('JAVA_MAIN_CLASS_')) {
env[key] = value;
... | true |
9f2b418767eaf02287879ee3cf2314538942ac62 | JavaScript | Sppokk/My-First-Website | /Projeto Pedro Teixeira 5-2-2021/peixesAdm.js | UTF-8 | 4,022 | 2.953125 | 3 | [] | no_license | function mostraRegistos(registos) {
let conteudo="";
for (registo of registos) {
conteudo+=`<tr><td>${registo.id}</td><td>${registo.nome}</td><td>${registo.descricao}</td><td>${registo.tamanho}</td><td>${registo.cardume}</td><td>${(registo.ameacada) ? "✔" : "✖"}</td><td><button type="button... | true |
2ca34dcfd3d59f71610ebc75557b344ad33d5128 | JavaScript | smoline/eloquent_javascript | /ch3_practice.js | UTF-8 | 2,543 | 4.5 | 4 | [] | no_license | // Bindings and scopes
const halve = function (n) {
return n / 2
}
let n = 10
console.log(halve(100))
// → 50
console.log(n)
// → 10
const hummus = function (factor) {
const ingredient = function (amount, unit, name) {
let ingredientAmount = amount * factor
if (ingredientAmount > 1) {
unit += "s"
... | true |
868456d26ec0ef3ad29f2c203dc9f9d851d33fd7 | JavaScript | UMM-CSci-4453-Fall-2017/lab-7-aliens-lab7 | /ben-showDatabases.js | UTF-8 | 776 | 2.5625 | 3 | [] | no_license | var credentials = require('./credentials.json');
var mysql = require('mysql');
credentials.host="ids.morris.umn.edu";
var connection = mysql.createConnection(credentials);
connection.connect(function(err){
if (err) {
console.log("aww crap an error \n");
console.log(err);
} else {
console.log("no erro... | true |
1639280d120ea4c96225fefae464da52109c19ac | JavaScript | aodegaa/SP | /Assets/Scripts/Musher.js | UTF-8 | 1,470 | 2.5625 | 3 | [] | no_license | #pragma strict
private var speed: float = 2.0;
private var scenePosition : float = 0.0;
var success : boolean;
static var collision : boolean;
function Start () {
}
function Update ()
{
if(!AvalancheScript.instructions){
Time.timeScale = 1.0;
if(!collision){
if(scenePosition<115){
scenePosition+=3*Tim... | true |
c362edf2cbabe38fc97774ed15a6897e1df4bbc3 | JavaScript | AnastasiiaIvanovaUA/Lessons | /Lesson 21/js/script.js | UTF-8 | 259 | 2.828125 | 3 | [] | no_license | var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://my-json-server.typicode.com/typicode/demo/posts', false);
xhr.send();
if (xhr.status != 200){
alert ('Помилка' + xhr.status + ': ' + xhr.statusText);
} else {
alert (xhr.responseText);
}
| true |
7bb61e2d66538bdc480911dbc4348e4096e359c8 | JavaScript | Zombiefruit/moire-patterns | /src/index.js | UTF-8 | 1,163 | 2.875 | 3 | [] | no_license | import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const generateLines = () => {
const lines = [];
for (let i = 0; i < 1000; i++) {
lines.push(
<div
style={{
width: "500px",
position: "fixed",
top: `${i + 50}px`,
transform... | true |