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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
879c7da67b90afc1b76229be8acbec60a7c73444 | JavaScript | bastienbeurier/PartnersMobile | /screens/CreateTaskScreen.js | UTF-8 | 2,116 | 2.578125 | 3 | [] | no_license | import React from "react";
import { ActivityIndicator, Alert, Button, View, Text, TextInput } from "react-native";
import ApiUtils from "../utils/ApiUtils";
export default class CreateTaskScreen extends React.Component {
constructor() {
super();
this.state = {
isLoading: false,
};
}
goToTaskLi... | true |
009641e595feb8301fad1f416c374aa3594f2b58 | JavaScript | lunchtime-labs/videojs-vast-vpaid | /test/test-utils.js | UTF-8 | 3,828 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var utilities = require('utils/utilityFunctions');
function createMouseEvent(type) {
var event = document.createEvent('MouseEvents');
event.initEvent(type, true, false);
return event;
}
function click(element) {
if(element.click) {
return element.click();
}
return element.onclick(createMouseEvent('cli... | true |
c7d52c4985f3656bc824cce6dbeb218a60b69e26 | JavaScript | purplecabbage/WP7MouseDemo | /www/example2.js | UTF-8 | 2,758 | 3.234375 | 3 | [] | no_license |
var canvas, context, tool;
function offsetWindow(obj)
{
var topValue= 0,leftValue= 0;
while(obj) {
leftValue += obj.offsetLeft;
topValue += obj.offsetTop;
obj= obj.offsetParent;
}
return {x:leftValue,y:topValue};
}
document.addEventListener("deviceready",onDeviceReady);
... | true |
a60cbef1d8a81c337022ab9718f6b96680b7e51e | JavaScript | alexisVivier/apiNodeJS | /item.js | UTF-8 | 4,240 | 2.78125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const fs = require('fs')
//GET
router.get('/', (req, res) => {
fs.readFile('data.json', 'utf8', (err, data) => {
if(err){
console.error(err);
}else{
//On parse le JSON obtenu pour pouvoir l'utiliser
... | true |
5fd3ca78dfcabb81e2710d7624d318b917128d57 | JavaScript | 96xiaohao/LodashDemo | /chatRoom/tcpserver1.js | UTF-8 | 1,206 | 2.90625 | 3 | [] | no_license | let net = require('net');
//创建一个服务
let server = net.createServer(function (socket) {
//设置最大连接数为2
server.maxConnections = 2;
//连接请求到来时,会触发该方法
server.getConnections(function (err,count) {
socket.write(`当前最大容纳${server.maxConnections},现在${count}人`)
});
socket.setEncoding('utf-8');
//接受... | true |
16e6a53075c94a97078b2d7985d26f237bf64a11 | JavaScript | QM36/JS-test | /array.js | UTF-8 | 685 | 3.921875 | 4 | [] | no_license | var number_object = {
'0' : 'zero',
'1' : 'one',
'2' : 'two'
};
var array = ['zero','one','two'];
//console.log(array[0]);
var myArray = [];
//console.log(myArray.length) //0
myArray[10000] = true;
//console.log(myArray.length) //10001
number = ['zero','one','two'];
console.log(number.length);
number[number.le... | true |
10851960571fd28ca47890f0dfa1c6ee3a39fabc | JavaScript | superjerk/autotrimp | /autotrimp2.js | UTF-8 | 1,247 | 2.984375 | 3 | [] | no_license | //globals
document.getElementById("boneFlavorRow").innerHTML = "The Bone Trader trades bones for...bonuses"
var myVar=setInterval(function () {resourceTimer()}, 3000);
function resourceTimer() {
var food = game.resources.food.owned / (game.resources.food.max + (game.resources.food.max * game.portal.Packrat.modifie... | true |
0ad8d1756a68b3ccfd8aa6cca7798f143beccde0 | JavaScript | seananigan/CMPT276 | /calculator.js | UTF-8 | 8,293 | 3.359375 | 3 | [] | no_license | function decimalToPercent(num, denom) {
if (denom != 0) {
return (100*num/denom).toFixed(2).toString()+"%"
}
return ""
}
function getAvgA1() {
//divides the numerator input box by the denominator one
var numerator = document.getElementById("A1numerator").value;
var denominator = documen... | true |
ec49c0c7637e2f7fef1e37a8377299c6ac66bedf | JavaScript | tchambil/verdata | /graphs/computacion/json/cursos.js | UTF-8 | 2,121 | 2.609375 | 3 | [] | no_license | /* Aquí va el script para generar la visualización. */
function listaCurso(alpha){
var a="a";
nom="prefix u: <http://verdata.cl/graphs/computacion#> " +
"prefix e: <http://verdata.cl/graphs/escuela/> " +
"SELECT ?uni ?curname " +
"WHERE { GRAPH <http://verdata.cl/graphs/computacion/> " +
"{ ?esc a u:EscuelaPr... | true |
5c81b68c4b67da4b0dcaf2a7c62adcdf160072d7 | JavaScript | yackovtube/FlightSimulator | /src/dal/repository/plane.repository.js | UTF-8 | 1,190 | 2.5625 | 3 | [] | no_license | const Plane = require('./../models/plane.model');
class PlaneRepository {
create(data) {
return new Promise((resolve, reject) => {
let plane = new Plane({ mission: data.mission, missionStartTime: data.missionStartTime });
plane.save((err, doc) => {
if (err) {
... | true |
19d83b8609da2879fba5a47a1f43df4cea4cbb9e | JavaScript | BladeWork/slotmachine | /a2/Scripts/main.js | UTF-8 | 11,072 | 3 | 3 | [] | no_license | /// <reference path="jquery.js" />
//begin to set the stage
var playerMoney = 1000;
var winnings = 0;
var jackpot = 5000;
var playerBet = 10;
var spinResult;
var fruits = "";
var grapes = 0;
var bananas = 0;
var oranges = 0;
var cherries = 0;
var bars = 0;
var bells = 0;
var sevens = 0;
var blanks = 0;
var stage;
va... | true |
cbfa5913e9aa65a657318f122d6f6a423dee8325 | JavaScript | codeacademyprogramming/P313-Javascript | /10.DOM/assets/js/innerHtmlAndtextContent.js | UTF-8 | 887 | 3.015625 | 3 | [] | no_license | // let link1 = document.querySelector('#link1');
// let text = link1.textContent;
// let html = link1.innerHTML;
// console.log(text);
// console.log(html);
// output.textContent='<i class="fa fas-fly">M</i>';
let icon = document.getElementById('icon');
let output = document.getElementById('output');
icon.innerHTML=... | true |
85a97d9d8632124cf6413d488b5338729e7adc36 | JavaScript | jenninep/week11-Hangman | /game.js | UTF-8 | 209 | 2.875 | 3 | [] | no_license |
funcion game() {
var wordBank = ["Rudolph", "Frosty", "Santa", "Christmas", "Winter", "Turkey", "Prancer"];
var randomWord = Math.floor(Math.random() * wordBank.length);
return wordBank[randomWord];
};
| true |
0ddd9769c81bed8b36c93b8f4c4c334acd4367ac | JavaScript | xoninu/Transmission-Helper-Chrome-Extension | /jsScripts/helpers.js | UTF-8 | 957 | 2.84375 | 3 | [
"MIT"
] | permissive | // Class that holds the users settings
function UserSettings() {
// initialize all properties with defaults
this.ip = "127.0.0.1";
this.port = 9091;
this.username = "transmission";
this.password= "";
}
// class methods
UserSettings.prototype.updateSettings = function(userSettings) {
this.ip = userSetting... | true |
ddaaaa71ebe6b28e7c9d32a63883e179d8472839 | JavaScript | jkim333/react-hacker-news | /src/reducer.js | UTF-8 | 983 | 2.6875 | 3 | [] | no_license | const getPage = (page, noPages) => {
if (page < 0) {
return noPages - 1;
} else if (page > noPages - 1) {
return 0;
} else {
return page;
}
};
function reducer(state, action) {
if (action.type === 'set-stories') {
return {
...state,
stories: action.payload.hits,
loading: fal... | true |
f84dcd17dc17e21678f396feeb65991f3ad5af7c | JavaScript | what-watch-now/whatWatchNow | /borrar.js | UTF-8 | 178 | 2.796875 | 3 | [] | no_license | // Crear peliculas
createFilms()
.then(spanishMovies => {
if (spanishMovies.length == 100)
recursiveFunction(spanishMovies)
})
.catch(error => console.log(error)) | true |
147efc395e9998141ebeace7381acf8f394dd8d8 | JavaScript | JackDan9/WebPages | /JSGame-CatchTheBlack/js/main.js | UTF-8 | 9,782 | 3.296875 | 3 | [] | no_license | // 11 个单元格,每个单元格的大小就等于地图的大小(mapWH)/mapSize
var mapSize = 11;
// 地图大小
var mapWH = 440;
// 记录对象的ID
var computerID;
// 这个方向是否可走
var isPath = true;
// 记录四方位上距离对方的距离
var up = 0;
var left = 0;
var right = 0;
var down = 0;
// 障碍物的最多个数(可重叠)
var barrier = 3;
window.onerror = function() {
alert("异常!点击确定重新开始");
window.lo... | true |
e45b162f8594755e7ddfa06a79b6e74f0f56b04d | JavaScript | dnldxn/lostwithdan | /assets/js/google_map.js | UTF-8 | 2,888 | 2.578125 | 3 | [] | no_license | ---
---
{% assign current_lat = site.data.stats.current_location.lat %}
{% assign current_lon = site.data.stats.current_location.lon %}
var map;
var infowindow;
function initMap() {
var current_location = new google.maps.LatLng({{ current_lat }}, {{ current_lon }});
var zoomLevel = 8
/* define map cente... | true |
83b747a3071bc40b48bd68b0fb0dcfcc2f131b9e | JavaScript | jjm2317/ps | /section3/palindrome.js | UTF-8 | 1,299 | 4.15625 | 4 | [] | no_license | /*
회문 문자열
앞에서 읽을 때나 뒤에서 읽을 때나 같은 문자열을 회문 문자열이라고 합니다.
문자열이 입력되면 해당 문자열이 회문 문자열이면 "YES", 회문 문자열이 아니면 “NO"를 출력
하는 프로그램을 작성하세요.
단 회문을 검사할 때 대소문자를 구분하지 않습니다.
▣ 입력설명
첫 줄에 정수 길이 100을 넘지 않는 공백이 없는 문자열이 주어집니다.
▣ 출력설명
첫 번째 줄에 회문 문자열인지의 결과를 YES 또는 NO로 출력합니다.
▣ 입력예제 1
gooG
▣ 출력예제 1
YES
*/
const readline = require('readline');
... | true |
2c0a36038ffb4ee57a6bab24330794fadc61a582 | JavaScript | markgreenwood/http-single-resource | /lib/HttpSingleResourceServer.js | UTF-8 | 3,877 | 2.890625 | 3 | [
"MIT"
] | permissive | const http = require('http');
const parseUrl = require('url').parse;
const path = require('path');
const NoteStore = require('./NoteStore');
const noteStore = new NoteStore(path.join(__dirname, '../notes'));
// Marty's body parser from 10/26/2016 class
function bodyParser(req, cb) {
let body = '';
req.on('data'... | true |
6fb49f507d7a4e922001c8422e16827c1b867395 | JavaScript | gustavonovaes/doseet | /src/divinity-original-sin-xml-utils.js | UTF-8 | 1,207 | 2.625 | 3 | [] | no_license | const fs = require('fs')
const { parseString, Builder } = require('xml2js')
const formatXMLObject = xmlObject => {
const contents = xmlObject.contentList.content
return contents.map(content => {
return {
uid: content.$.contentuid,
message: content._
}
})
}
const parseXMLObject = arrObjects =... | true |
90674137d1a132b635e8232307e31ff30c794e43 | JavaScript | dvtegar/smartmombaru | /alertsign/js/index.js | UTF-8 | 569 | 2.8125 | 3 | [
"MIT"
] | permissive | var accItem = document.getElementsByClassName('accordionItem');
var accHD = document.getElementsByClassName('accordionItemHeading');
for (i = 0; i < accHD.length; i++) {
accHD[i].addEventListener('click', toggleItem, false);
}
function toggleItem() {
var itemClass = this.parentNode.clas... | true |
ff93b3cb47f82fdbf0790173823249269ab7bf2f | JavaScript | lscheibel/rover | /dist/render.js | UTF-8 | 5,098 | 2.9375 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const SCALE = 15;
const GRID_GUTTER = 3;
function drawRover(context, { width, height }, color) {
context.save();
context.beginPath();
context.strokeStyle = color;
context.lineWidth = 0.1;
context.rect(-width / 2, -height / ... | true |
407101af62e15bc0180bd33c62e3232aeec15d1e | JavaScript | nchlswtsn/warmupjs | /exoh.js | UTF-8 | 399 | 3.34375 | 3 | [] | no_license | function exOh(string){
var letters = string.split('');
var exs = [];
var ohs = [];
console.log(letters);
for (var i = 0; i < letters.length; i++){
if (letters[i] === "x"){
exs.push(letters[i]);
}else{
ohs.push(letters[i]);
}
}
console.log(exs);
console.log(ohs);
return exs.leng... | true |
4015dcb52ccd8b26e963f4d5d05f09d6177f90fd | JavaScript | wxiaolin/general-form | /src/main/webapp/js/show.js | UTF-8 | 645 | 2.625 | 3 | [
"MIT"
] | permissive | var names = new Array();
$(".cells-wrapper").each(function () {
var name = $(this).attr("name");
if (typeof(name) == undefined || name == null) {
} else {
names.push(name);
}
});
var json = {"names": names};
$.ajax({
url: "/filler",
type: "GET",
traditional: true,
data: json,
... | true |
90620eb3161102a5fefe1ed4ff8eaa41f2f73a5c | JavaScript | nastjasokolovaa/html-css-javascript | /javaScript/lesson-7/js.js | UTF-8 | 13,864 | 3.125 | 3 | [] | no_license | "use strict";
const settings = {
rowsCount: 21,
colsCount: 21,
speed: 2,
winFoodCount: 50,
};
const config = {
settings,
init(userSettings = {}) {
Object.assign(this.settings, userSettings);
},
getRowsCount() {
return this.settings.rowsCount;
},
... | true |
4dac1074e7e6dfb841fb3e3188d113aa5828e10d | JavaScript | Eduardo06sp/pomodoro-clock | /js/app.js | UTF-8 | 3,413 | 3.09375 | 3 | [] | no_license | const pomodoros = document.querySelector('.pomodoros-count');
const startButton = document.querySelector('.start');
const pauseButton = document.querySelector('.pause');
const stopButton = document.querySelector('.stop');
const increaseButton = document.querySelector('.increase');
const decreaseButton = document.queryS... | true |
683bc4f06e2e543d7d81fc19e627fd9c0a1d86a7 | JavaScript | mrChernicharo/algorithms-data-structures | /exercises/bubbleSort.js | UTF-8 | 573 | 3.65625 | 4 | [] | no_license | // function bubbleSort(array) {
// for (let i = array.length - 1; i >= 0; i--) {
// for (let j = 0; j < array.length; j++) {
// if (array[j] > array[j + 1]) {
// [array[j], array[j + 1]] = [array[j + 1], array[j]];
// }
// }
// }
// return array;
// }
function bubbleSort(array) {
for (let i = array.... | true |
6983c783b2f0a699be266fa107c8b36a68788011 | JavaScript | JohnAWorley/jquery-challenges | /challenges/testing.js | UTF-8 | 266 | 3.453125 | 3 | [] | no_license | function numComp(num1,num2) {
if (num1>num2){
return `$(num1) is bigger`;
}
if else(num2>num1){
`$(num2) is bigger`;
}
else {
return 'numbers are equal';
}
}
console.log(`entered 10, 0, expect 10 got ${numComp(10)}`);
| true |
8c0cba1d569c9a2136a1b237077eebfde7c4240f | JavaScript | Jalez/WebStore0.1 | /storeWebpage/public/js/utils.js | UTF-8 | 9,241 | 3.640625 | 4 | [] | no_license | console.log("User downloads this file for the first time. ")
/**
* Asynchronously fetch JSON from the given url. (GET)
*
* Uses fetch to get JSON from the backend and returns the parsed
* JSON back.
*
* Remember that an async function always returns a Promise which
* needs to be awaited or handled wi... | true |
e607cae69c9db0ca4f9d9c2122aa8be033a96045 | JavaScript | clauderic/twitter-app | /src/reducers/_tweets.reducer.js | UTF-8 | 444 | 2.75 | 3 | [] | no_license | const initialState = {
tweets : [],
isFetching : true,
errors : false
}
const tweets = (state = initialState, action) => {
switch (action.type) {
case 'TWEETS_IS_LOADED':
return {...state, tweets: action.tweets, isFetching: action.isFetching, errors: false };
case 'TWEETS_LOAD_FAILURE':
ret... | true |
f9ed67a5a080f372b69605b0d2060e138771bdeb | JavaScript | jslauter/fcc | /algoAndDataStruc/reverseLL.js | UTF-8 | 1,134 | 3.34375 | 3 | [] | no_license | class Node {
constructor(data, next = null) {
this.data = data;
this.next = next;
}
}
class LinkedListDeleteKthNode {
constructor() {
this.head = null;
}
insertFirst(data) {
if (!this.head) {
this.head = new Node(data, this.head);
} else {
this.next = this.head;
this.he... | true |
735a1a3f20ff6db4ada001e7de75410108f2392a | JavaScript | alberto963/jsTutorials | /rt_39_liftingStateUp/src/index.js | UTF-8 | 1,879 | 3.203125 | 3 | [] | no_license | import React, { useState, useCallback } from "react"
import ReactDOM from 'react-dom'
const BoilingVerdict = (props) => {
if (props.celsius >= 100) {
return <p>The water would boil.</p>;
}
return <p>The water would not boil.</p>;
}
const scaleNames = {
c: 'Celsius',
f: 'Fahrenheit'
};
function toCelsiu... | true |
d77aed1b13df3ed26b481b6593b4d279d0ccf454 | JavaScript | beomseok-kang/ChemEng-MEng-Project-gSAFT-NMRmethod | /nist/scrapper.js | UTF-8 | 2,927 | 2.75 | 3 | [] | no_license | delete compound, colToArr, array, availables, windows;
var compound = prompt("Compound Name:");
(function (console) {
console.save = function (data, filename) {
if (!data) {
console.error("Console.save: No data");
return;
}
if (!filename) filename = "console.json";
if (typeof data === ... | true |
eea27679f8ee776609492ea7fe80cfa51c5641ce | JavaScript | samanehvj/sandbox | /src/components/Ref.js | UTF-8 | 788 | 2.59375 | 3 | [] | no_license | import React from 'react'
class PasswordComponent extends React.Component {
constructor(props) {
super(props);
this.textInput = null;
//set ref method
this.setPWRef = element => {
this.textInput = element;
};
//set focus method
this.focusPWInput = () => {
... | true |
4c983a7da2ab54dab9cbf86207167240577ce830 | JavaScript | harutiro/Jquery | /move3.js | UTF-8 | 1,321 | 3.640625 | 4 | [] | no_license | // canvasを作ってHTMLに突っ込む。
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
canvas.width = 500;
canvas.height = 500;
document.body.appendChild(canvas);
// 円運動の中心座標。
// 今回はcanvasの真ん中を中心に移動する。
const centerX = 250;
const centerY = 250;
// 円を描画する中心からの距離。
const distanceFromCenter = 15... | true |
3234922c8a7be1e86d6066b65aac905bd21206e2 | JavaScript | shotaivanidze/uni | /geolab project/main.js | UTF-8 | 1,201 | 2.921875 | 3 | [] | no_license | const body = document.body;
body.addEventListener('click', LoginPopup);
function LoginPopup() {
let container = document.createElement('div');
container.id = "container";
let login = document.createElement('div');
login.id = 'login';
let loginContainer = document.createElement('div');
... | true |
202428dd18c2caef4eaefb1829b694e73c4afb16 | JavaScript | swolfson1/project-12-React-Movie | /code/src/pages/MovieDetails.js | UTF-8 | 1,240 | 2.515625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import { Link } from 'react-router-dom'
import './MovieDetails.css'
import { BackArrow } from 'icons/BackArrow'
export const MovieDetails = () => {
const apiKey = "77bea6b3bafb30d9ed8c7a03c3e8d404"
const [movie, setMo... | true |
c72c50a51b3b449083f7051211d15cfe32efbe07 | JavaScript | MernaSamir/Kiosk | /src/helpers/best_match_filter.js | UTF-8 | 408 | 2.546875 | 3 | [] | no_license | import {keys, filter, get} from 'lodash'
export function bestMatchFilter(list, filterObject, oKeys= keys(filterObject), index=0, last=oKeys.length){
if(index == last){
return list[0] || {};
}
const key = oKeys[index]
let out = filter(list, {[key]: get(filterObject, key)})
if(!out.length){
out = filter(list, {... | true |
79254d1ab6d73e8f5ccb7e3250bc477ba7bd35bd | JavaScript | julianapeace/material-react-app | /src/fsociety.js | UTF-8 | 991 | 2.625 | 3 | [] | no_license | import * as firebase from "firebase";
var config = {
apiKey: "AIzaSyD2YNT_86zGzkdYbdbR1x1hFIqbgb0i9kk",
authDomain: "react-app-3a4eb.firebaseapp.com",
databaseURL: "https://react-app-3a4eb.firebaseio.com",
storageBucket: "react-app-3a4eb.appspot.com",
};
firebase.initializeApp(config);
var database = firebase.d... | true |
9a8b47c74aa1a1999501065cff031b1fcebc2fa8 | JavaScript | node-opcua/node-opcua | /packages/node-opcua-service-query/schemas/ParsingResult_schema.js | UTF-8 | 1,524 | 2.59375 | 3 | [
"MIT"
] | permissive | require("node-opcua-data-model");
/*=
* List of parsing results for QueryFirst. The size and order of the list matches the size and order of the NodeTypes
* request parameter. This structure is defined in-line with the following indented items.
* This list is populated with any status codes that are related to the p... | true |
2984a253c432c03186e422c2925d3969c4b48abc | JavaScript | Nuri0/dailyprogrammer | /challenges/015/easy.js | UTF-8 | 1,045 | 3.21875 | 3 | [
"MIT"
] | permissive | // https://www.reddit.com/r/dailyprogrammer/comments/q4c34/2242012_challenge_15_easy/
"use strict";
let readline = require("readline");
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
let lines = [];
let longestLine = -1;
if (process.argv.length <= 2... | true |
e4987cd570d2600629012ad1c0f358c237b2b55c | JavaScript | xonecas/zen | /js/script.js | UTF-8 | 9,022 | 3.015625 | 3 | [] | no_license |
/* Author: Sean Caetano Martin
xonecas
*/
(function (window, undefined) {
var document = window.document,
LEFT = 37, RIGHT = 39, SPACE = 32,
IMGSIZE = 38, PADSIZE = 20,
BG = '#444',
BULL_W = 5, BULL_H = 10, BULL_COLOR = '#FFF';
function get (id) {
return document.getEle... | true |
4233656dff25e264cead3772b43ffb4c267c4bf5 | JavaScript | sudoRecycle/iRecycleThis | /Products.js | UTF-8 | 1,571 | 2.84375 | 3 | [] | no_license | var Products = new Meteor.Collection("Products");
Products.insert({Name : "Hammer", Price : 4.50, InStock : true});
Products.insert({Name : "Wrench", Price : 2.70, InStock : true});
Products.insert({Name : "Screw Driver", Price : 3.00, InStock : false});
Products.insert({Name : "Drill", Price : 5.25, InStock : true});
... | true |
85f7f47b1df1048f64d9a7b5e99f81d2b52cbb06 | JavaScript | VasylSaliuk/goit-js-hw-07 | /js/task-7-4.js | UTF-8 | 367 | 3.09375 | 3 | [] | no_license | const counterValue = document.querySelector('#value');
const decBtn = document.querySelector('[data-action="decrement"]');
const incBtn = document.querySelector('[data-action="increment"]');
incBtn.addEventListener("click", () => {counterValue.textContent = +counterValue.textContent + 1});
decBtn.addEventListener("cl... | true |
98c91929c4c7149faa35f8767ad51966aa575960 | JavaScript | GyroJoe/DiscoCal | /commands/calendar/EventCommand.js | UTF-8 | 1,502 | 2.703125 | 3 | [
"MIT"
] | permissive | "use strict";
const commando = require('discord.js-commando');
const discordjs = require('discord.js');
const moment = require('moment');
const Authenticator = require('../../network/Authenticator');
const CalendarInterface = require('../../OutlookInterface');
const EventCreator = require('../../EventCreator');
modu... | true |
4accaf5074ed1ad24b47567d7fe29b4585f5ed91 | JavaScript | ewape/fullstack-course5 | /assignments/assignment1/assignment1-starter-code/app.js | UTF-8 | 988 | 2.828125 | 3 | [] | no_license | (function() {
"use strict";
angular.module('LunchCheck', [])
.controller('LunchCheckController', LunchCheckController);
LunchCheckController.$inject = ['$scope'];
function LunchCheckController($scope) {
$scope.lunchList = "";
$scope.message = "";
$scope.messageClass = "";
$scope.checkItems = function... | true |
bccf8b602c6e205e6462bdca908b0fe6ae866584 | JavaScript | dqduy/pongjs | /source/scene/PlayScreen.js | UTF-8 | 8,341 | 2.796875 | 3 | [
"MIT"
] | permissive | class PlayScreen extends Scene {
constructor(type = "play") {
super(type);
//Member Variables
this.ball = null;
this.lines = [];
this.homeUser = null;
this.awayUser = null;
this.homeResult = null;
this.awayResult = null;
this.velocity ... | true |
fa6fb04cf03e8f540b9b77a6acb1cd62919a1019 | JavaScript | ZHDgit/HTML_LEARN | /day 25/js/index.js | UTF-8 | 3,174 | 2.953125 | 3 | [] | no_license | ! function() {
var title = document.querySelector('#title');
var question = document.querySelector('#question');
var solve = document.querySelector('#solve');
var btn = document.querySelector('#btn');
var title1 = document.querySelector('#title1');
var question1 = document.querySelector('#quest... | true |
b9e6e76142f02fc6d49d5cc9d66ed3e2c6765553 | JavaScript | JulianNicholls/Node-with-React | /client/src/actions/index.js | UTF-8 | 1,246 | 2.65625 | 3 | [] | no_license | import axios from 'axios';
import { FETCH_USER, FETCH_SURVEYS, FETCH_DETAIL } from './types';
// Return the logged in user, or null
export const fetchUser = () => async dispatch => {
const response = await axios.get('/api/current_user');
dispatch({ type: FETCH_USER, user: response.data });
};
// Add credits to ... | true |
ec75282e62c06a9dc21d1634fbfb2544cb1d63d8 | JavaScript | kognise/portal | /revers/index.js | UTF-8 | 453 | 2.796875 | 3 | [] | no_license | const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.text())
function reverse(string = '') {
return [ ...string ].reverse().join('')
}
app.use('/revers', express.static('demo'))
app.post('/revers', (req, res) => {
res.send(reverse(req.body))
})
ap... | true |
c7939469c59ecebc0bee34f253c0bf9eb89f1234 | JavaScript | niradler/nextjs-fullstack-concept | /pages/tags-client.js | UTF-8 | 488 | 2.53125 | 3 | [] | no_license | import fetch from 'isomorphic-unfetch'
const TagsClient = props => {
return (
<div>
<p>Tags:{props.tags.length}</p>
</div>
);
};
TagsClient.getInitialProps = async(props) => {
try {
const res = await fetch('http://localhost:3000/api/get-tags')
const json = awai... | true |
e6c309cacf923515eb65627eb661cfe997955f35 | JavaScript | akhanda4/cute-dogs | /Scripts/index.js | UTF-8 | 446 | 2.921875 | 3 | [] | no_license | let x = document.getElementById('xx');
let y = document.createElement("p");
let z = document.getElementsByClassName("ar")[0];
y.innerText="Please wait while the image loads";
function fn(){
setTimeout(function(){
z.style.height="400px"
y.replaceWith(x);
},1500);
fetch(`https://dog.ceo/api/breeds/image/random`)
... | true |
3098088d3050d39d92ea1c449b1fc6a82e524de1 | JavaScript | Asilo5/hate-it-n-rate-it | /src/reducers/error.test.js | UTF-8 | 584 | 2.53125 | 3 | [] | no_license | import { error } from './error';
describe('error reducer', () => {
it('should return the initial state', () => {
const expected = '';
const result = error(undefined, {});
expect(result).toEqual(expected);
})
it('should return the correct state when HAS_ERROR is passed in the action object', () => {
... | true |
e392367f7b9edf2a46ef90c8ecb02b692219fece | JavaScript | qqinzheng/node | /node 文档/fs/fsWatcger/fsWatcher.js | UTF-8 | 360 | 2.734375 | 3 | [] | no_license | var fs = require('fs');
console.log(process.cwd());
var changeFile = fs.watch(__dirname,(eventType, filename) => {
if (filename) {
console.log(filename);
}
});
changeFile.on('change',(err,name1,name2)=>{
console.log(123);
});
changeFile.on('error',(error) => {
console.log('一定是哪里发生了错误');
});
... | true |
eccdb22a7b4d8ece080935fe1abab11b962e1590 | JavaScript | viktor-velichkov/JS-Advanced-SoftUni | /01a. Syntax Functions and Statements - Exercise/greatestCommonDivisor.js | UTF-8 | 396 | 3.671875 | 4 | [
"MIT"
] | permissive | function greatestCommonDivisor(num1, num2){
let divisor = Math.min(num1,num2);
let result;
while ((num1 % divisor != 0 || num2 % divisor != 0) && divisor>0) {
divisor--;
}
if (divisor != 0) {
result = divisor;
}
else {
result = "No such number";
}
console.lo... | true |
31eadac531b47bf8f337eea604ad2852a27f3087 | JavaScript | LuisWitts/TypeScript | /ex01.ts/appproduto.js | UTF-8 | 458 | 2.671875 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
var Produto_1 = require("./Produto");
var p1; // aqui apenas declarei uma referencia a um carro , preciso criar o objeto
var p2;
p1 = new Produto_1.Produto(1, "teclado", "branco grande bonito", 100, 5, "fotinha"); // agora sim , aloquei (reservei ) memória para armazenar as cois... | true |
0156f569a0885055c348eea93105111d682a96eb | JavaScript | SimoneRomiti/js-jsnacks-blocco-5 | /JSnack/js/script.js | UTF-8 | 475 | 3.875 | 4 | [] | no_license | // jsnack 3
//Si scriva una funzione che accetti tre argomenti, un array e due numeri (a più piccolo di b). La funzione ritornerà un nuovo array con i valori che hanno la posizione compresa tra i due numeri
var myArray = [2, 5, 10, 25, 3, 30, 12];
var secondArray = subArray(myArray, 1, 5);
console.log(secondArr... | true |
a37ec2bcb720c2870ed0715192d8be4242f64228 | JavaScript | SandraJantos/Inzynierka | /routes/api/posts.js | UTF-8 | 687 | 2.515625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const Post = require('../../models/Post');
router.post('/sendMessage',(req,res) => {
const newPost = new Post({
sender:req.body.sender,
recipient:req.body.recipient,
text:req.body.text
})
newPost.save(function (err, data) {
if(err) {
... | true |
e8a1795d54ccde6a938fbdc5af0c179b0096df59 | JavaScript | mitikud/mwa | /examPractice/Lessons/lesson 5/app09/api/controllers/publisher.Controller.js | UTF-8 | 3,608 | 2.671875 | 3 | [] | no_license | const mongoose = require("mongoose");
const Game = mongoose.model("Game");
const _addPublisher = function (req, res, game) {
console.log("Publisher: ", req.body);
game.publisher.push(req.body);
game.save(function (err, updatedGame) {
console.log("sdfsdfsf ", game.publisher.name);
const resp... | true |
5d3016378acd06a2ec37b3995f529bc08feb0cf2 | JavaScript | rajendersaini/cabms | /src/main/webapp/WEB-INF/resources/js/bookingfrm.js | UTF-8 | 2,852 | 2.671875 | 3 | [] | no_license | // this function is used to verify phone number.
jQuery.validator.addMethod("phone",
function(value, element) {
return this.optional(element)
|| /^[0-9]{3}-[0-9]{3}-[0-9]{4}$/.test(value);
}, "Please specify the phone in format 999-999-9999");
function validateTab0(tab0) {
tab0
.validate({
rules : ... | true |
b1e5b413c99c87de1aaf1fc2758fbd8004c51fb2 | JavaScript | danzimm/danzimm.github.io | /dist/danzimmjs.js | UTF-8 | 30,131 | 2.515625 | 3 | [] | no_license | var ZimmBlog = (function() {
var that = {};
var concaturl = function(base, append) {
if (base[base.length-1] == '/')
return base + append;
else
return base + '/' + append;
};
that.createBlog = function(metaurl, posturl, name) {
var that = {},
c... | true |
d5541ea23846c946c6d02e60077cef045974ad7e | JavaScript | ajwpdx/pokematch | /src/App.js | UTF-8 | 1,763 | 2.78125 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import './App.css';
import { coding } from "./data"
import MemoryCard from "./MemoryCard"
function App() {
const [memCards, setMemCards] = useState([])
const [selection, setSelection] = useState()
const [matches, setMatches] = useState([])
const [guesses, se... | true |
5c927e1a15ebc433a5e8e334cd1d13052ba60e7b | JavaScript | samuelmartinsa/EG | /eg/static/task.js | UTF-8 | 10,673 | 3.109375 | 3 | [] | no_license |
/**********************
* Domain general code *
**********************/
// Helper functions
// Assert functions stolen from
// http://aymanh.com/9-javascript-tips-you-may-not-know#assertion
function AssertException(message) { this.message = message; }
AssertException.prototype.toString = function () {
r... | true |
85abdb813bc6d5f21bc0914a510ece1bd2081439 | JavaScript | davehenton/combo-js | /src/modules/utils.js | UTF-8 | 799 | 3.078125 | 3 | [
"MIT"
] | permissive | /**
* Removes the innerHTML of an element.
*
* @private
* @param {Element} el The element.
*
* @example
*
* _removeHTML(document.getElementById("root"));
*
*/
export function _removeHTML(el) {
if(typeof el.firstChild !== "undefined") {
while(el.firstChild) {
el.removeChild(el.firstChild);
}
}
}
/*... | true |
a76fc7d75503d8b8f21de89eefecc9e02b3282ae | JavaScript | merileewheelock/react101 | /scoreboard.jsx | UTF-8 | 3,405 | 3.734375 | 4 | [] | no_license | // Make a component calaled "Application" that returns a single DOM element.
// Components should be uppercase.
// Add props param so we can get properties sent by component rendering this component.
// class = className in JSX
// The app works, but it's big. It's no better than if we just copy and pased it into our H... | true |
5c7277b5a530aa6b2163d5700c3d7679b7e1ff46 | JavaScript | ramithperera/FitnessFactory | /frontend/src/components/ManageUsers.jsx | UTF-8 | 2,298 | 2.6875 | 3 | [] | no_license | //Create home component
import React, { useEffect, useState } from "react";
import axios from "axios";
//import components
import NavBar from "./NavBar";
import Footer from "./Footer";
import Form from 'react-bootstrap/Form';
import Container from 'react-bootstrap/Container';
const ManageUsers = () => {
//states
... | true |
678736308ac0c47ad665d682abc3b97d1fa1153f | JavaScript | audoralc/apt-appt-app | /server.js | UTF-8 | 1,298 | 2.859375 | 3 | [] | no_license | const express = require("express");
const app = express();
const fs = require("fs");
const router = require("express").Router();
const port = process.env.PORT || 5000;
var server = app.listen(port, () => console.log(`Listening on port ${port}`));
/*mock data endpoints
router.post("/book/", created);
router.get("/app... | true |
39d7c4e8290bdd463494bfe755555c0b1a8307b1 | JavaScript | isabella232/loc | /lib/strategy/subdomain.js | UTF-8 | 1,289 | 3.015625 | 3 | [
"MIT"
] | permissive | /**
* Stragety = subdomain
* example: `http://de-CH.test.localhost:3000/rest/of/the/path` or `http://en.suuper.com/path-to-the-end`
* in this case the locale would be `de-CH` or `en`
*/
exports.name = 'subdomain';
var utils = require('../utils');
var pattern = exports.pattern = new RegExp('^' + utils.languagePatt... | true |
271f499008f204c5c2c7615745725ea0cb0b3e79 | JavaScript | angeljohnnyday/kikoya | /src/ducks/user.js | UTF-8 | 558 | 2.515625 | 3 | [] | no_license | const data = {
modulos: [],
logged: false
}
const LOGIN = 'LOGIN'
const LOGOUT = 'LOGOUT'
const user = (state = data, action) => {
switch (action.type) {
case LOGIN:
return { ...state, ...action.payload }
case LOGOUT:
return data;
default:
return... | true |
418cd9e521127e96285fe8d2008ce2cee1b59f9a | JavaScript | vonnenaut/js210 | /exercises/practice_problems/rot13.js | UTF-8 | 1,828 | 4.75 | 5 | [] | no_license | /*
Rot13 ("rotate by 13 places") is a letter-substitution
cipher that translates a String into a new String.
For each character in the original String:
- If the character is a letter in the modern English
alphabet, change it to the character 13 positions
later in the alphabet. Thus, a becomes n. If you reach
the... | true |
82cccdae6308bb556345789d09069d4104942510 | JavaScript | skullflowerss/50projects | /day47/script.js | UTF-8 | 1,327 | 3.1875 | 3 | [] | no_license | const testimonialsContainer = document.querySelector('.user-testimonial')
let testimonials = []
let person = 0;
async function fetchData(){
const res = await fetch('https://testimonialapi.toolcarton.com/api')
const data = await res.json()
setData(data)
}
function setData(data){
testimonials = data
... | true |
c22336d8cb8f32d813a70b8c23f0379360b6a50e | JavaScript | orazyyy/html_blog | /server/app.js | UTF-8 | 1,950 | 2.5625 | 3 | [
"MIT"
] | permissive | //创建服务器
//加载http核心模块
const koa = require('koa');
const router = require('koa-router')();
const koaStatic = require('koa-static');
let fs = require('fs');
const path = require('path');
const app = new koa();
/*
创建web服务器
const server = http.createServer();
server.on('request', (req, res)=>{
res.setHeader('Con... | true |
83eca9cbd48989c21afdf519e1ad83fb5285975c | JavaScript | jernestmyers/rock-paper-scissors | /javascript.js | UTF-8 | 2,695 | 4.375 | 4 | [] | no_license | // ROCK PAPER SCISSORS
// sets initial scores to 0
let userScore = 0;
let cpuScore = 0;
let numberDraws = 0;
// randomly selects the index of an array containing options, then returns as Rock Paper or Scissors
function computerPlay() {
let cpuOptions = [`Rock`, `Paper`, `Scissors`];
return cpuOptions[Math.f... | true |
2b15c8b47a297265b43c9d17dc3f4307c3aa3d5b | JavaScript | psound/jm-liberty | /src/routes/Home/ducks/home.js | UTF-8 | 4,161 | 2.8125 | 3 | [
"MIT"
] | permissive | // ------------------------------------
// Action Constants
// ------------------------------------
export const CHANGE_VIEW = 'CHANGE_VIEW';
export const BACK_VIEW = 'BACK_VIEW';
export const RESULTS_VIEW = 'RESULTS_VIEW';
// ------------------------------------
// Action Creators (these update the app state)
// ---... | true |
26d76c7d5800dadf59f1da97cd8c93b43ab0c026 | JavaScript | EkanshSin23/meme-app | /src/components/App/UploadImage/index.js | UTF-8 | 1,623 | 2.546875 | 3 | [
"MIT"
] | permissive | import React, { useContext, useEffect } from 'react';
import { MemeContext } from '../../../context/MemeContext';
import ImageWrapper from './ImageWrapper';
import ImageLabel from './ImageLabel';
import ImageInput from './ImageInput';
import ImageCaption from './ImageCaption';
import ActiveImage from './ActiveImage';
i... | true |
8a62222867c53ee88db4c417b501b4021d30c91f | JavaScript | martin-danhier/Palerme | /src/game/robber.js | UTF-8 | 1,929 | 2.53125 | 3 | [] | no_license | import { playerIsNextToRobber } from "./hexes";
import { INVALID_MOVE } from "boardgame.io/core";
export function discardHalf(G, ctx, cards) {
let player = ctx.playerID;
// Discard half
if (cards.length === Math.floor(G.players[player].deck.resources.length / 2)) {
let newList = [];
//... | true |
835718ff03a1434ecdcf1acf9c81ce4c6064c803 | JavaScript | andrewphillips/MiU | /js/JSON.js | UTF-8 | 6,046 | 2.578125 | 3 | [] | no_license | // Andrew Phillips
// MiU 0212
// Default :: Dummy Data
var json = {
"asset1": {
"title": ["Title:", "Tim's Fall"]
"date": ["Date Added:", "2011-12-15"],
"category": ["Category:", "Images"],
"epic": ["Epic Moment:", "Yes"],
"rating": ["Stars:", "4"],
"notes": ["Notes :: Stories", "This is when Tim ... | true |
1cf147024fd4a6ca2d970864d3d97252411c584c | JavaScript | malcomwu/lbac-js | /app/scripts/lbac/11-lexical-scan-revisited.js | UTF-8 | 5,543 | 3.609375 | 4 | [] | no_license | /*global define*/
/**
* Chapter 11 Lexical Scan Revisited
* ==================================
*/
define(['./1.2-cradle', 'io'], function (cradle, io) {
'use strict';
/**
* 11.1 Introduction
* ------------------
* A way to simplify and improve the lexical scanning part of the
* compile... | true |
89a399c4eee17a6ccf2ed0aca26cce7ca81dd207 | JavaScript | Samir-Allaham/Unit7-04-HTML | /script.js | UTF-8 | 565 | 3.515625 | 4 | [] | no_license | document.getElementById('button').addEventListener('click', movie)
let age = 12
let day = ''
function movie () {
age = document.getElementById('input').value
age = parseInt(age)
day = document.getElementById('hello').value
if ((age > 12 && age < 21) || (day === 'Tuesday' || day === 'Thursday')) {
documen... | true |
34614c829f0ad0fdf8a1fa2962a856acc3dab093 | JavaScript | karthickvkumar/a_react | /karthick/Migrated code/src/datatable.js | UTF-8 | 2,671 | 2.71875 | 3 | [] | no_license | import React from 'react';
export default React.createClass({
getInitialState: function() {
return {
currentPage: 1
}
},
componentWillReceiveProps: function(nextProps) {
this.setState({
currentPage: 1
})
},
render: function() {
var page = this.getPage()
var thead_data = th... | true |
f8cc211640a44923b611362deacc0cb32b25da5c | JavaScript | tgienger/cereal_killers | /client/chat/chat.controller.es6 | UTF-8 | 2,494 | 2.5625 | 3 | [] | no_license |
const ROOTSCOPE = new WeakMap();
const TIMEOUT = new WeakMap();
const METEOR = new WeakMap();
class ChatController {
static $inject = ['$scope', '$meteor', '$timeout', '$rootScope'];
constructor($scope, $meteor, $timeout, $rootScope) {
this.chatTimer;
this.waitTime = 3000;
$... | true |
15d552ffb2047f70b8ce08ca21520c8c4b568875 | JavaScript | eosineye1/tweetgenerator | /src/utils/apiUtils.js | UTF-8 | 1,863 | 2.5625 | 3 | [] | no_license | import axios from "axios"
const textToVector = async (text) =>{
const response = await axios({
method :'post',
url : 'https://main-gpt-2-server-gkswjdzz.endpoint.ainize.ai/preprocess',
headers : {'Content-Type' : "application/json"},
data : {"context" : text}
}).then(respon... | true |
89853dbe432fc8fd08b1f6345fa3791245acc830 | JavaScript | alonbt/angular-animator | /test/spec/services/animator-class.spec.js | UTF-8 | 2,926 | 2.5625 | 3 | [] | no_license | 'use strict';
describe('Service: animatorClass', function () {
var animatorState, animatorClassName, animatorStatesMap;
// load the service's module
beforeEach(module('angularAnimator'));
// instantiate service
var animatorClass, element, className;
beforeEach(inject(function (_animatorClass_, _animator... | true |
1cb32433f4f3b5986f228a637f7fa31573722d28 | JavaScript | Synesso/log-client | /auth.js | UTF-8 | 4,544 | 2.578125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const storage = require('electron-json-storage');
const request = require('request');
const conf = require('./config')
const path = require('path')
const url = require('url')
const { remote } = require('electron')
const helpers = require('./helpers')
const statusWidget = document.querySelector("#status")
var statusLin... | true |
ab843118ad33af160a78cfd3522053e8bcc6df4b | JavaScript | icsantos/ud549-javascript-testing | /src/AddressBook.js | UTF-8 | 454 | 3.21875 | 3 | [
"MIT"
] | permissive | class AddressBook {
constructor() {
this.contacts = [];
this.initialComplete = false;
}
getInitialContacts(callback) {
setTimeout(() => {
this.initialComplete = true;
if (callback) {
return callback();
}
}, 3);
}
addContact(contact) {
this.contacts.push(contact)... | true |
8c49b503239df8ac891668c78c9d209ab0f35270 | JavaScript | CarberZ/MathAttackerz | /public/assets/js/leaderboard.js | UTF-8 | 1,940 | 3 | 3 | [] | no_license | var leaderboardVal;
var tempLeaderboardVal = [];
window.onload = function () {
leaderboard();
};
function leaderboard() {
var leaderboard = firebase.database().ref('users');
leaderboard.on('value', function(snapshot) {
leaderboardVal = snapshot.val();
var size = Object.keys(leaderboardVal).length;
co... | true |
a5cf81f90bd5443b332606ee3ef36cae505b338f | JavaScript | zero-to-mastery/visual-music | /src/components/VisualPanel/VisualPanel.js | UTF-8 | 3,034 | 2.828125 | 3 | [
"MIT"
] | permissive | /************************************************************
Main component for visualization list
Props:
- visualList: Type of array. An array contain all visualization data that need to be displayed
- onItemClick: Type of function. A callback function.
Callback:
- onItemClick: If provided i... | true |
2d08b34579538d6fb82d9dbf9e606c2a19710de9 | JavaScript | wilonashen/Big-Red-Gifts-Logistics | /matchemail/sendMatch.js | UTF-8 | 2,303 | 2.53125 | 3 | [] | no_license | //Helpful tutorial
//http://www.sqlitetutorial.net/sqlite-nodejs/connect/
const sqlite3 = require('sqlite3').verbose();
const nodemailer = require('nodemailer');
//Connect to SQlite3 DB
//Use ../fakedata.db for tests, prod db never goes on GitHub
let db = new sqlite3.Database('../prod-11-23-17-matching.db', sqlite3.OP... | true |
84ea435fa4dd467187d4375e6f2ee59b70878170 | JavaScript | zhubito/8reinas | /controlador.js | UTF-8 | 4,206 | 3.3125 | 3 | [] | no_license | var tablero = document.getElementById('tablero');
var tableroLogico;
var posicionReinas = [];
function CrearTablero() {
//Obtenemos tablero logico
tableroLogico = LlenarTablero();
//Limpiamos tablero
tablero.innerHTML = "";
// Crea un elemento <table> y un elemento <tbody>
var tabla = document.... | true |
5a02e9931ac79133404808f80ef3df7f3b48d510 | JavaScript | shumbul/shumbul.github.io | /js/app.js | UTF-8 | 1,184 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive |
$(document).ready(function() {
$('.chart').horizBarChart({
selector: '.bar',
speed: 1000
});
var stickyNavTop = $('.navbar-wrapper').offset().top;
var stickyNav = function() {
var scrollTop = $(window).scrollTop();
if (scrollTop > ... | true |
3418ec90595cf60f4f3a587d5a5fb00ebaecf160 | JavaScript | myohankyaw/JavaScript | /Date/Write_a_JavaScript_function_to_get_a_short_textual_representation_of_a_month,_three_letters_(Jan_through_Dec).js | UTF-8 | 291 | 3.1875 | 3 | [] | no_license | Date.shortMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function short_months(dt) {
return Date.shortMonths[dt.getMonth()];
}
dt = new Date();
console.log(short_months(dt));
dt = new Date(2015, 10, 1);
console.log(short_months(dt));
| true |
fecc5f30ac751e9bc81d5fba3d6f49e9f77bb65e | JavaScript | Siffersari/Questioner-Ultimate | /js/profile.js | UTF-8 | 2,776 | 2.734375 | 3 | [] | no_license | window.onload = function fetchProfile(event) {
event.preventDefault();
const url = 'https://questioner-apiv2-siffersari.herokuapp.com/api/v2/users';
fetch(url, {
method: 'GET',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${localStorage.getItem('token')}` },
})
.then(asyn... | true |
ea80976e8705dc5f865761fa5c2850bb6a7ab012 | JavaScript | Jimmy2507/DWWM | /Ajax/Parking/JS/script.js | UTF-8 | 1,869 | 2.90625 | 3 | [] | no_license | contenu = document.querySelector("#Contenu");
var repAPI;
const req = new XMLHttpRequest();
req.open('GET','https://opendata.lillemetropole.fr/api/records/1.0/search/?dataset=parkings-gratuits&q=&facet=nom_du_parking&facet=nombre_de_place&facet=adresse',true);
req.send(null);
req.onreadystatechange = function(e){
... | true |
3a884641499dad5023403fc85b91580aae83e9c7 | JavaScript | Jerome4914/Do2_algos | /Do2.js | UTF-8 | 5,022 | 4.1875 | 4 | [] | no_license | // Reverse
// Given a numerical array, reverse the order of values, in-place. The reversed array should have the same length, with existing elements moved to other indices so that order of elements is reversed. Working 'in-place' means that you cannot use a second
// array – move values within the array that you are g... | true |
7134b2eb4f9887e7c44e632c9f0ad9c642e76e35 | JavaScript | h578056/Lost-In-Translations | /src/store/reducers/loginReducer.js | UTF-8 | 777 | 2.609375 | 3 | [] | no_license | import { ACTION_LOGIN_ATTEMPTING, ACTION_LOGIN_ERROR, ACTION_LOGIN_SUCCESS } from "../actions/loginActions"
const initialState = {
loginAttempting: false,
loginError: ''
}
export const loginReducer = (state = { ...initialState }, action) => {
switch (action.type) {
case ACTION_LOGIN_ATTEMPTING:
... | true |
549aa58121307d71aa5949c491c22509fb208a0b | JavaScript | luispcunha/feup-laig | /tp3/src/primitives/MyCylinder2.js | UTF-8 | 1,878 | 3.078125 | 3 | [] | no_license | /**
* This class provides a primitive in the shape of a cylinder, with no
* caps, variable height, bottom and top radius, taking advantage of nurbs objects.
*/
class MyCylinder2 extends CGFobject {
/**
* Will yield a new Cylinder with the rotating axis on
* _scene_'s z axis.
* @constructor
* ... | true |
4618ed82ccf7e638d94b73694d77000367e05261 | JavaScript | wanghongyan/jqueryPluginCarousel | /jquery.carousel.js | UTF-8 | 3,540 | 2.765625 | 3 | [] | no_license | ;(function ($) {
//定义Carousel的构造函数
function Carousel (ele, options) {
this.$ele = $(ele);
this.timerId = 0;
this.isScrolling = false;
this.isMouseDown = false;
this.sx = 0;
this.sy = 0;
this.defaults = {
current: 0,
count: 4,
width: '300px',
autoScroll: true,
interval: 2000
};
this.op... | true |
39861b3362beaca84cd7edca73e3ccb1bd52c741 | JavaScript | ArmineKh/js | /lodash/give-me-an-overview.js | UTF-8 | 496 | 2.703125 | 3 | [] | no_license | const _ = require("lodash");
const worker = function (users) {
var result = [];
var orders = _.groupBy(users, "article");
_.forEach(orders, function (item, num) {
num = parseInt(num);
var total = _.reduce(item, function(sum, item){
return sum + item.quantity;
}, 0);
res... | true |
32045ca016f36055d1d1119556f7f990920107cf | JavaScript | Troofy/goit-js-hw-07 | /js/task-02.js | UTF-8 | 451 | 2.953125 | 3 | [] | no_license | const ingredients = [
'Картошка',
'Грибы',
'Чеснок',
'Помидоры',
'Зелень',
'Приправы',
];
const newIngredients = document.querySelector('#ingredients');
const newItem = elem => {
const itemEl = document.createElement('li');
itemEl.textContent = elem;
return itemEl;
};
const ingredientsArray = ingredi... | true |